NCBI C++ ToolKit
hmm.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef ALGO_GNOMON___HMM__HPP
2 #define ALGO_GNOMON___HMM__HPP
3 
4 /* $Id: hmm.hpp 100392 2023-07-27 15:57:51Z souvorov $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Alexandre Souvorov
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
37 #include <algo/gnomon/gnomon.hpp>
38 #include <algo/gnomon/gnomon__.hpp>
39 #include "gnomon_seq.hpp"
40 #include "score.hpp"
41 
43 BEGIN_SCOPE(gnomon)
44 
45 extern const double kLnHalf;
46 extern const double kLnThree;
47  const int kTooFarLen = 500;
48 
49 
50 template<int order> class CMarkovChain
51 {
52  public:
54  void InitScore(const objects::CMarkov_chain_params& hmm_param_asn);
55  double& Score(const EResidue* seq) { return m_next[(int)*(seq-order)].Score(seq); }
56  const double& Score(const EResidue* seq) const { return m_next[(int)*(seq-order)].Score(seq); }
57  CMarkovChain<order-1>& SubChain(int i) { return m_next[i]; }
58  void Average(Type& mc0, Type& mc1, Type& mc2, Type& mc3);
59  void toScore();
60 
61  private:
62  friend class CMarkovChain<order+1>;
63  void Init(const objects::CMarkov_chain_params& hmm_param_asn);
64 
65  CMarkovChain<order-1> m_next[5];
66 };
67 
68 template<> class CMarkovChain<0>
69 {
70  public:
72  void InitScore(const objects::CMarkov_chain_params& from);
73  double& Score(const EResidue* seq) { return m_score[(int)*seq]; }
74  const double& Score(const EResidue* seq) const { return m_score[(int)*seq]; }
75  double& SubChain(int i) { return m_score[i]; }
76  void Average(Type& mc0, Type& mc1, Type& mc2, Type& mc3);
77  void toScore();
78  private:
79  friend class CMarkovChain<1>;
80  void Init(const objects::CMarkov_chain_params& from);
81 
82  double m_score[5];
83 };
84 
85 template<int order> class CMarkovChainArray
86 {
87  public:
88  void InitScore(int l, const objects::CMarkov_chain_array& from);
89  double Score(const EResidue* seq) const;
90  private:
91  int m_length;
92  vector< CMarkovChain<order> > m_mc;
93 };
94 
96 {
97  public:
98  virtual ~CInputModel() = 0;
99 
100  static void Error(const string& label)
101  {
102  NCBI_THROW(CGnomonException, eGenericError, label+" initialisation error");
103  }
104 };
105 
106 //Terminal's score is located on the last position of the left state
107 class CTerminal : public CInputModel
108 {
109  public:
111  int InExon() const { return m_inexon; }
112  int InIntron() const { return m_inintron; }
113  int Left() const { return m_left; }
114  int Right() const { return m_right; }
115  virtual double Score(const CEResidueVec& seq, int i) const = 0;
116 
117  protected:
119 };
120 
121 
122 template<int order> class CWAM_Donor : public CTerminal
123 {
124  public:
126  static string class_id() { return "WAM_Donor_"+NStr::NumericToString(order); }
127  CWAM_Donor(const objects::CGnomon_param::C_Param& from);
128  double Score(const CEResidueVec& seq, int i) const;
129 
130  private:
132 };
133 
134 template<int order> class CWAM_Acceptor : public CTerminal
135 {
136  public:
137  static string class_id() { return "WAM_Acceptor_"+NStr::NumericToString(order); }
138  CWAM_Acceptor(const objects::CGnomon_param::C_Param& from);
140  double Score(const CEResidueVec& seq, int i) const;
141 
142  private:
144 
145 };
146 
147 class CWMM_Start : public CTerminal
148 {
149  public:
150  static string class_id() { return "WMM_Start"; }
151  CWMM_Start(const objects::CGnomon_param::C_Param& from);
153  double Score(const CEResidueVec& seq, int i) const;
154 
155  private:
157 };
158 
159 class CWAM_Stop : public CTerminal
160 {
161  public:
162  static string class_id() { return "WAM_Stop_1"; }
163  CWAM_Stop(const objects::CGnomon_param::C_Param& from);
165  double Score(const CEResidueVec& seq, int i) const;
166 
167  private:
169 };
170 
172 {
173  public:
174  static string class_id() { return "CodingRegion"; }
175  virtual double Score(const CEResidueVec& seq, int i, int codonshift) const = 0;
177 };
178 
179 template<int order> class CMC3_CodingRegion : public CCodingRegion
180 {
181  public:
182  static string class_id() { return "MC3_CodingRegion_"+NStr::NumericToString(order); }
183  CMC3_CodingRegion(const objects::CGnomon_param::C_Param& from);
185  double Score(const CEResidueVec& seq, int i, int codonshift) const;
186 
187  private:
189 };
190 
192 {
193  public:
194  static string class_id() { return "NonCodingRegion"; }
195  virtual double Score(const CEResidueVec& seq, int i) const = 0;
197 };
198 
199 template<int order> class CMC_NonCodingRegion : public CNonCodingRegion
200 {
201  public:
202  static string class_id() { return "MC_NonCodingRegion_"+NStr::NumericToString(order); }
203  CMC_NonCodingRegion(const objects::CGnomon_param::C_Param& from);
205  double Score(const CEResidueVec& seq, int i) const;
206 
207  private:
209 };
210 
212 {
213  public:
215  double Score(const CEResidueVec&, int) const { return 0; };
216 };
217 
219 {
221 };
222 
223 template<class State> SStateScores CalcStateScores(const State& st)
224 {
225  SStateScores sc;
226 
227  if(st.NoLeftEnd())
228  {
229  if(st.NoRightEnd()) sc.m_length = st.ThroughLengthScore();
230  else sc.m_length = st.InitialLengthScore();
231  }
232  else
233  {
234  if(st.NoRightEnd()) sc.m_length = st.ClosingLengthScore();
235  else sc.m_length = st.LengthScore();
236  }
237 
238  sc.m_region = st.RgnScore();
239  sc.m_term = st.TermScore();
240  if(sc.m_term == BadScore()) sc.m_term = 0;
241  sc.m_score = st.Score();
242  if(st.LeftState()) sc.m_score -= st.LeftState()->Score();
243  sc.m_branch = sc.m_score-sc.m_length-sc.m_region-sc.m_term;
244 
245  return sc;
246 }
247 
248 class CLorentz
249 {
250  public:
251  void Init(const objects::CLength_distribution_params& from);
252  double Score(int l) const { return m_score[(l-1)/m_step]; }
253  double ClosingScore(int l) const;
254  int MinLen() const { return m_minl; }
255  int MaxLen() const { return m_maxl; }
256  double AvLen() const { return m_avlen; }
257  double Through(int seqlen) const;
258 
259  private:
261  double m_A, m_L, m_avlen;
263 };
264 
265 class CSeqScores;
266 
267 class CHMM_State {
268 public:
269  CHMM_State(EStrand strn, int point, const CSeqScores& seqscr);
270  virtual ~CHMM_State() {}
271  const CHMM_State* LeftState() const { return m_leftstate; }
272  const CTerminal* TerminalPtr() const { return m_terminal; }
273  void UpdateLeftState(const CHMM_State& left) { m_leftstate = &left; }
274  void ClearLeftState() { m_leftstate = 0; }
275  void UpdateScore(double scr) { m_score = scr; }
276  int MaxLen() const { return numeric_limits<int>::max(); }
277  int MinLen() const { return 1; };
278  bool StopInside() const { return false; }
279  EStrand Strand() const { return m_strand; }
280  bool isPlus() const { return (m_strand == ePlus); }
281  bool isMinus() const { return (m_strand == eMinus); }
282  double Score() const { return m_score; }
283  int Start() const { return m_leftstate ? m_leftstate->m_stop+1 : 0; }
284  bool NoRightEnd() const { return m_stop < 0; }
285  bool NoLeftEnd() const { return m_leftstate == 0; }
286  int Stop() const { return NoRightEnd() ? m_seqscr->SeqLen()-1 : m_stop; }
287  int RegionStart() const;
288  int RegionStop() const;
289  const CSeqScores& GetSeqScores() const { return *m_seqscr; }
290  virtual SStateScores GetStateScores() const = 0;
291  virtual string GetStateName() const = 0;
292 
293  virtual bool isExon() const { return false; }
294  virtual bool isGeneLeftEnd() const { return false; }
295  virtual bool isGeneRightEnd() const { return false; }
296  virtual double VirtTermScore() const = 0;
297 
298 protected:
299  int m_stop;
301  double m_score;
305 };
306 
307 class CIntron;
308 class CIntergenic;
309 
311 public:
312  static string class_id() { return "Exon"; }
313  CExonParameters(const objects::CGnomon_param::C_Param& from);
315 
316  double m_firstphase[3], m_internalphase[3][3];
319 };
320 
321 class CExon : public CHMM_State
322 {
323 public:
324  CExon(EStrand strn, int point, int ph, const CSeqScores& seqscr, const CExonParameters& params);
325  virtual ~CExon() {}
326 
327  int Phase() const { return m_phase; } // frame of right exon end relatively start-codon
328  bool StopInside() const;
329  bool OpenRgn() const;
330  double RgnScore() const;
331  double DenScore() const { return 0; }
332  double ThroughLengthScore() const { return BadScore(); }
333  double InitialLengthScore() const { return BadScore(); }
334  double ClosingLengthScore() const { return BadScore(); }
335  void UpdatePrevExon(const CExon& e);
336  double MScore() const { return m_mscore; }
337 
338  virtual bool isExon() const { return true; }
339  double ExonScore() const { return LeftState()->VirtTermScore() + VirtTermScore(); }
340 
341 protected:
342  int m_phase;
344  double m_mscore;
345 
347 };
348 
349 class CSingleExon : public CExon
350 {
351 public:
353  CSingleExon(EStrand strn, int point, const CSeqScores& seqscr, const CExonParameters& params);
354  int MaxLen() const { return m_param->m_singlelen.MaxLen(); }
355  int MinLen() const { return m_param->m_singlelen.MinLen(); }
356  const CSingleExon* PrevExon() const { return static_cast<const CSingleExon*>(m_prevexon); }
357  double LengthScore() const;
358  double TermScore() const;
359  virtual double VirtTermScore() const { return TermScore(); }
360  double BranchScore(const CHMM_State& ) const { return BadScore(); }
361  double BranchScore(const CIntergenic& next) const;
362  SStateScores GetStateScores() const { return CalcStateScores(*this); }
363  string GetStateName() const { return "SingleExon"; }
364 
365  virtual bool isGeneLeftEnd() const { return true; }
366  virtual bool isGeneRightEnd() const { return true; }
367 };
368 
369 class CFirstExon : public CExon
370 {
371  public:
373  CFirstExon(EStrand strn, int ph, int point, const CSeqScores& seqscr, const CExonParameters& params);
374  int MaxLen() const { return m_param->m_firstlen.MaxLen(); }
375  int MinLen() const { return m_param->m_firstlen.MinLen(); }
376  const CFirstExon* PrevExon() const { return static_cast<const CFirstExon*>(m_prevexon); }
377  double LengthScore() const;
378  double TermScore() const;
379  virtual double VirtTermScore() const { return TermScore(); }
380  double BranchScore(const CHMM_State& ) const { return BadScore(); }
381  double BranchScore(const CIntron& next) const;
382  SStateScores GetStateScores() const { return CalcStateScores(*this); }
383  string GetStateName() const { return "FirstExon"; }
384 
385  virtual bool isGeneLeftEnd() const { return isPlus(); }
386  virtual bool isGeneRightEnd() const { return isMinus(); }
387 };
388 
389 class CInternalExon : public CExon
390 {
391  public:
393  CInternalExon(EStrand strn, int ph, int point, const CSeqScores& seqscr, const CExonParameters& params);
394  int MaxLen() const { return m_param->m_internallen.MaxLen(); }
395  int MinLen() const { return m_param->m_internallen.MinLen(); }
396  const CInternalExon* PrevExon() const { return static_cast<const CInternalExon*>(m_prevexon); }
397  double LengthScore() const;
398  double TermScore() const;
399  virtual double VirtTermScore() const { return TermScore(); }
400  double BranchScore(const CHMM_State& ) const { return BadScore(); }
401  double BranchScore(const CIntron& next) const;
402  SStateScores GetStateScores() const { return CalcStateScores(*this); }
403  string GetStateName() const { return "InternalExon"; }
404 };
405 
406 class CLastExon : public CExon
407 {
408  public:
410  CLastExon(EStrand strn, int ph, int point, const CSeqScores& seqscr, const CExonParameters& params);
411  int MaxLen() const { return m_param->m_lastlen.MaxLen(); }
412  int MinLen() const { return m_param->m_lastlen.MinLen(); }
413  const CLastExon* PrevExon() const { return static_cast<const CLastExon*>(m_prevexon); }
414  double LengthScore() const;
415  double TermScore() const;
416  virtual double VirtTermScore() const { return TermScore(); }
417  double BranchScore(const CHMM_State& ) const { return BadScore(); }
418  double BranchScore(const CIntergenic& next) const;
419  SStateScores GetStateScores() const { return CalcStateScores(*this); }
420  string GetStateName() const { return "LastExon"; }
421 
422  virtual bool isGeneLeftEnd() const { return isMinus(); }
423  virtual bool isGeneRightEnd() const { return isPlus(); }
424 };
425 
427 public:
428  static string class_id() { return "Intron"; }
429  CIntronParameters(const objects::CGnomon_param::C_Param& from);
431 
432  void SetSeqLen(int seqlen) const;
433  int MinLen() const { return m_intronlen.MinLen(); }
434 
435  mutable double m_lnThrough[3];
436  mutable double m_lnDen[3];
439 private:
440  double m_initp, m_phasep[3];
441  mutable bool m_initialised;
442 
443  friend class CIntron;
444 };
445 
446 class CIntron : public CHMM_State
447 {
448 public:
449  CIntron(EStrand strn, int ph, int point, const CSeqScores& seqscr,const CIntronParameters& params);
450  virtual ~CIntron() {}
451  int MinLen() const { return m_param->MinLen(); }
452  int MaxLen() const { return m_param->m_intronlen.MaxLen(); }
453  int Phase() const { return m_phase; }
454  bool OpenRgn() const { return m_seqscr->OpenNonCodingRegion(Start(),Stop(),Strand()); }
455  double RgnScore() const;
456  double TermScore() const
457  {
458  if(isPlus()) return m_seqscr->AcceptorScore(Stop(),Strand());
459  else return m_seqscr->DonorScore(Stop(),Strand());
460  }
461  virtual double VirtTermScore() const { return TermScore(); }
462  double DenScore() const { return m_param->m_lnDen[Phase()]; }
463  double LengthScore() const
464  {
465  if(SplittedStop())
466  return BadScore();
467  else
468  return m_param->m_intronlen.Score(Stop()-Start()+1);
469  }
470  double ClosingLengthScore() const;
471  double ThroughLengthScore() const { return m_param->m_lnThrough[Phase()]; }
472  double InitialLengthScore() const { return m_param->m_lnDen[Phase()]+ClosingLengthScore(); } // theoretically we should substract log(AvLen) but it gives to much penalty to the first element
473  double BranchScore(const CHMM_State& ) const { return BadScore(); }
474  double BranchScore(const CLastExon& next) const;
475  double BranchScore(const CInternalExon& next) const;
476  bool SplittedStop() const
477  {
478  if(Phase() == 0 || NoLeftEnd() || NoRightEnd())
479  return false;
480  else if (isPlus())
481  return m_seqscr->SplittedStop(LeftState()->Stop(),Stop(),Strand(),Phase()-1);
482  else
483  return m_seqscr->SplittedStop(Stop(),LeftState()->Stop(),Strand(),Phase()-1);
484  }
485 
486 
487  SStateScores GetStateScores() const { return CalcStateScores(*this); }
488  string GetStateName() const { return "Intron"; }
489 
490 protected:
491  int m_phase;
493 };
494 
495 inline double CIntron::BranchScore(const CInternalExon& next) const
496 {
497  if(Strand() != next.Strand()) return BadScore();
498 
499  if(isPlus()) {
500  int shift = next.Stop()-next.Start();
501  if((Phase()+shift)%3 == next.Phase())
502  return m_param->m_lnInternal;
503  } else if(Phase() == next.Phase())
504  return m_param->m_lnInternal;
505 
506  return BadScore();
507 }
508 
509 inline double CInternalExon::BranchScore(const CIntron& next) const
510 {
511  if(Strand() != next.Strand()) return BadScore();
512 
513  int ph = isPlus() ? Phase() : Phase()+Stop()-Start();
514 
515  if((ph+1)%3 == next.Phase()) return 0;
516  else return BadScore();
517 }
518 
520 public:
521  static string class_id() { return "Intergenic"; }
522  CIntergenicParameters(const objects::CGnomon_param::C_Param& from);
524 
525  void SetSeqLen(int seqlen) const;
526  int MinLen() const { return m_intergeniclen.MinLen(); }
527 
528  mutable double m_lnThrough, m_lnDen;
531 private:
532  double m_initp;
533  mutable bool m_initialised;
534  friend class CIntergenic;
535 };
536 
537 class CIntergenic : public CHMM_State
538 {
539  public:
540  CIntergenic(EStrand strn, int point, const CSeqScores& seqscr, const CIntergenicParameters& params);
541  virtual ~CIntergenic() {}
542  bool OpenRgn() const;
543  double RgnScore() const;
544  double TermScore() const;
545  virtual double VirtTermScore() const { return TermScore(); }
546  double DenScore() const { return m_param->m_lnDen; }
547  double LengthScore() const { return m_param->m_intergeniclen.Score(Stop()-Start()+1); }
549  double ThroughLengthScore() const { return m_param->m_lnThrough; }
550  double InitialLengthScore() const { return m_param->m_lnDen+ClosingLengthScore(); } // theoretically we should substract log(AvLen) but it gives to much penalty to the first element
551  double BranchScore(const CHMM_State& ) const { return BadScore(); }
552  double BranchScore(const CFirstExon& next) const;
553  double BranchScore(const CSingleExon& next) const;
554  SStateScores GetStateScores() const { return CalcStateScores(*this); }
555  string GetStateName() const { return "Intergenic"; }
556 
557  protected:
559 };
560 
562 public:
563  SDetails(const objects::CGnomon_params& hmm_params_asn);
564  ~SDetails();
565  const CInputModel& GetParameter(const string& type, int cgcontent) const;
566 private:
567  template <class CParam>
568  void ReadParameters(const objects::CGnomon_params& hmm_params_asn, objects::CGnomon_param::C_Param::E_Choice choice);
569  typedef vector< pair<int,CInputModel*> > TCGContentList;
572 
573  vector<CInputModel*> all_created_models;
574 
575  void DeleteAllCreatedModels();
576  TCGContentList& GetCGList(const string& type);
577  void StoreParam( const string& type, CInputModel* input_model, int low, int high );
578 };
579 
580 
581 
582 
583 END_SCOPE(gnomon)
585 
586 #endif // ALGO_GNOMON___HMM__HPP
virtual double Score(const CEResidueVec &seq, int i, int codonshift) const =0
static string class_id()
Definition: hmm.hpp:174
~CCodingRegion()
Definition: hmm.hpp:176
double m_firstphase[3]
Definition: hmm.hpp:316
static string class_id()
Definition: hmm.hpp:312
CLorentz m_internallen
Definition: hmm.hpp:317
double m_internalphase[3][3]
Definition: hmm.hpp:316
CLorentz m_singlelen
Definition: hmm.hpp:317
bool m_initialised
Definition: hmm.hpp:318
~CExonParameters()
Definition: hmm.hpp:314
CExonParameters(const objects::CGnomon_param::C_Param &from)
Definition: hmm.cpp:565
CLorentz m_lastlen
Definition: hmm.hpp:317
CLorentz m_firstlen
Definition: hmm.hpp:317
Definition: hmm.hpp:322
double InitialLengthScore() const
Definition: hmm.hpp:333
double m_mscore
Definition: hmm.hpp:344
void UpdatePrevExon(const CExon &e)
Definition: hmm.cpp:168
bool OpenRgn() const
Definition: hmm.cpp:134
const CExonParameters * m_param
Definition: hmm.hpp:346
double DenScore() const
Definition: hmm.hpp:331
virtual ~CExon()
Definition: hmm.hpp:325
double ClosingLengthScore() const
Definition: hmm.hpp:334
double MScore() const
Definition: hmm.hpp:336
bool StopInside() const
Definition: hmm.cpp:118
CExon(EStrand strn, int point, int ph, const CSeqScores &seqscr, const CExonParameters &params)
Definition: hmm.cpp:109
virtual bool isExon() const
Definition: hmm.hpp:338
double ThroughLengthScore() const
Definition: hmm.hpp:332
const CExon * m_prevexon
Definition: hmm.hpp:343
double RgnScore() const
Definition: hmm.cpp:150
int m_phase
Definition: hmm.hpp:342
int Phase() const
Definition: hmm.hpp:327
double ExonScore() const
Definition: hmm.hpp:339
double TermScore() const
Definition: hmm.cpp:223
virtual bool isGeneLeftEnd() const
Definition: hmm.hpp:385
virtual bool isGeneRightEnd() const
Definition: hmm.hpp:386
~CFirstExon()
Definition: hmm.hpp:372
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:380
virtual double VirtTermScore() const
Definition: hmm.hpp:379
string GetStateName() const
Definition: hmm.hpp:383
int MaxLen() const
Definition: hmm.hpp:374
int MinLen() const
Definition: hmm.hpp:375
const CFirstExon * PrevExon() const
Definition: hmm.hpp:376
SStateScores GetStateScores() const
Definition: hmm.hpp:382
CFirstExon(EStrand strn, int ph, int point, const CSeqScores &seqscr, const CExonParameters &params)
Definition: hmm.cpp:201
double LengthScore() const
Definition: hmm.cpp:217
void DeleteAllCreatedModels()
Definition: hmm.cpp:660
map< string, TCGContentList > TParamMap
Definition: hmm.hpp:570
void ReadParameters(const objects::CGnomon_params &hmm_params_asn, objects::CGnomon_param::C_Param::E_Choice choice)
vector< pair< int, CInputModel * > > TCGContentList
Definition: hmm.hpp:569
TCGContentList & GetCGList(const string &type)
Definition: hmm.cpp:668
void StoreParam(const string &type, CInputModel *input_model, int low, int high)
Definition: hmm.cpp:677
SDetails(const objects::CGnomon_params &hmm_params_asn)
Definition: hmm.cpp:742
vector< CInputModel * > all_created_models
Definition: hmm.hpp:573
const CInputModel & GetParameter(const string &type, int cgcontent) const
Definition: hmm.cpp:763
int MinLen() const
Definition: hmm.hpp:277
const CSeqScores * m_seqscr
Definition: hmm.hpp:304
const CSeqScores & GetSeqScores() const
Definition: hmm.hpp:289
double m_score
Definition: hmm.hpp:301
int Start() const
Definition: hmm.hpp:283
bool NoRightEnd() const
Definition: hmm.hpp:284
virtual ~CHMM_State()
Definition: hmm.hpp:270
int RegionStop() const
Definition: hmm.cpp:97
bool isPlus() const
Definition: hmm.hpp:280
int RegionStart() const
Definition: hmm.cpp:85
bool NoLeftEnd() const
Definition: hmm.hpp:285
virtual bool isGeneRightEnd() const
Definition: hmm.hpp:295
EStrand m_strand
Definition: hmm.hpp:300
int MaxLen() const
Definition: hmm.hpp:276
double Score() const
Definition: hmm.hpp:282
EStrand Strand() const
Definition: hmm.hpp:279
void ClearLeftState()
Definition: hmm.hpp:274
const CHMM_State * LeftState() const
Definition: hmm.hpp:271
virtual string GetStateName() const =0
virtual double VirtTermScore() const =0
const CTerminal * TerminalPtr() const
Definition: hmm.hpp:272
int Stop() const
Definition: hmm.hpp:286
const CTerminal * m_terminal
Definition: hmm.hpp:303
virtual SStateScores GetStateScores() const =0
CHMM_State(EStrand strn, int point, const CSeqScores &seqscr)
Definition: hmm.cpp:57
void UpdateLeftState(const CHMM_State &left)
Definition: hmm.hpp:273
void UpdateScore(double scr)
Definition: hmm.hpp:275
virtual bool isGeneLeftEnd() const
Definition: hmm.hpp:294
bool isMinus() const
Definition: hmm.hpp:281
const CHMM_State * m_leftstate
Definition: hmm.hpp:302
int m_stop
Definition: hmm.hpp:299
bool StopInside() const
Definition: hmm.hpp:278
virtual bool isExon() const
Definition: hmm.hpp:293
static void Error(const string &label)
Definition: hmm.hpp:100
virtual ~CInputModel()=0
Definition: hmm.cpp:431
int MinLen() const
Definition: hmm.hpp:526
double m_lnThrough
Definition: hmm.hpp:528
static string class_id()
Definition: hmm.hpp:521
void SetSeqLen(int seqlen) const
Definition: hmm.cpp:647
CIntergenicParameters(const objects::CGnomon_param::C_Param &from)
Definition: hmm.cpp:634
CLorentz m_intergeniclen
Definition: hmm.hpp:530
virtual ~CIntergenic()
Definition: hmm.hpp:541
CIntergenic(EStrand strn, int point, const CSeqScores &seqscr, const CIntergenicParameters &params)
Definition: hmm.cpp:340
double LengthScore() const
Definition: hmm.hpp:547
double ClosingLengthScore() const
Definition: hmm.hpp:548
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:551
const CIntergenicParameters * m_param
Definition: hmm.hpp:558
double RgnScore() const
Definition: hmm.cpp:355
virtual double VirtTermScore() const
Definition: hmm.hpp:545
string GetStateName() const
Definition: hmm.hpp:555
double TermScore() const
Definition: hmm.cpp:360
SStateScores GetStateScores() const
Definition: hmm.hpp:554
double DenScore() const
Definition: hmm.hpp:546
bool OpenRgn() const
Definition: hmm.cpp:350
double ThroughLengthScore() const
Definition: hmm.hpp:549
double InitialLengthScore() const
Definition: hmm.hpp:550
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:400
double LengthScore() const
Definition: hmm.cpp:247
double TermScore() const
Definition: hmm.cpp:266
SStateScores GetStateScores() const
Definition: hmm.hpp:402
string GetStateName() const
Definition: hmm.hpp:403
int MaxLen() const
Definition: hmm.hpp:394
CInternalExon(EStrand strn, int ph, int point, const CSeqScores &seqscr, const CExonParameters &params)
Definition: hmm.cpp:239
virtual double VirtTermScore() const
Definition: hmm.hpp:399
~CInternalExon()
Definition: hmm.hpp:392
int MinLen() const
Definition: hmm.hpp:395
const CInternalExon * PrevExon() const
Definition: hmm.hpp:396
CLorentz m_intronlen
Definition: hmm.hpp:438
int MinLen() const
Definition: hmm.hpp:433
bool m_initialised
Definition: hmm.hpp:441
double m_lnThrough[3]
Definition: hmm.hpp:435
double m_lnTerminal
Definition: hmm.hpp:437
double m_lnDen[3]
Definition: hmm.hpp:436
double m_initp
Definition: hmm.hpp:440
double m_lnInternal
Definition: hmm.hpp:437
~CIntronParameters()
Definition: hmm.hpp:430
static string class_id()
Definition: hmm.hpp:428
void SetSeqLen(int seqlen) const
Definition: hmm.cpp:621
CIntronParameters(const objects::CGnomon_param::C_Param &from)
Definition: hmm.cpp:600
double m_phasep[3]
Definition: hmm.hpp:440
bool SplittedStop() const
Definition: hmm.hpp:476
SStateScores GetStateScores() const
Definition: hmm.hpp:487
const CIntronParameters * m_param
Definition: hmm.hpp:492
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:473
virtual ~CIntron()
Definition: hmm.hpp:450
int Phase() const
Definition: hmm.hpp:453
double TermScore() const
Definition: hmm.hpp:456
double InitialLengthScore() const
Definition: hmm.hpp:472
double LengthScore() const
Definition: hmm.hpp:463
double RgnScore() const
Definition: hmm.cpp:335
CIntron(int j_in, char amin_in, char don11, char don21, char acs11, char acs21, const CAlignInfo &prev, const CAlignInfo &cur, const CNSeq &nseq_in, const CProSplignScaledScoring &scoring)
Definition: intron.hpp:317
bool OpenRgn() const
Definition: hmm.hpp:454
double ThroughLengthScore() const
Definition: hmm.hpp:471
double DenScore() const
Definition: hmm.hpp:462
double ClosingLengthScore() const
Definition: hmm.cpp:316
string GetStateName() const
Definition: hmm.hpp:488
int MinLen() const
Definition: hmm.hpp:451
virtual double VirtTermScore() const
Definition: hmm.hpp:461
int MaxLen() const
Definition: hmm.hpp:452
int m_phase
Definition: hmm.hpp:491
double LengthScore() const
Definition: hmm.cpp:288
SStateScores GetStateScores() const
Definition: hmm.hpp:419
string GetStateName() const
Definition: hmm.hpp:420
CLastExon(EStrand strn, int ph, int point, const CSeqScores &seqscr, const CExonParameters &params)
Definition: hmm.cpp:272
double TermScore() const
Definition: hmm.cpp:294
int MinLen() const
Definition: hmm.hpp:412
virtual double VirtTermScore() const
Definition: hmm.hpp:416
virtual bool isGeneLeftEnd() const
Definition: hmm.hpp:422
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:417
virtual bool isGeneRightEnd() const
Definition: hmm.hpp:423
const CLastExon * PrevExon() const
Definition: hmm.hpp:413
int MaxLen() const
Definition: hmm.hpp:411
~CLastExon()
Definition: hmm.hpp:409
int MaxLen() const
Definition: hmm.hpp:255
double Score(int l) const
Definition: hmm.hpp:252
int m_minl
Definition: hmm.hpp:260
void Init(const objects::CLength_distribution_params &from)
Definition: hmm.cpp:478
double Through(int seqlen) const
Definition: hmm.cpp:532
int MinLen() const
Definition: hmm.hpp:254
int m_step
Definition: hmm.hpp:260
double m_A
Definition: hmm.hpp:261
double ClosingScore(int l) const
Definition: hmm.cpp:48
double AvLen() const
Definition: hmm.hpp:256
double m_avlen
Definition: hmm.hpp:261
TDVec m_score
Definition: hmm.hpp:262
int m_maxl
Definition: hmm.hpp:260
double m_L
Definition: hmm.hpp:261
TDVec m_clscore
Definition: hmm.hpp:262
~CMC3_CodingRegion()
Definition: hmm.hpp:184
static string class_id()
Definition: hmm.hpp:182
double Score(const CEResidueVec &seq, int i, int codonshift) const
CMarkovChain< order > m_matrix[3]
Definition: hmm.hpp:188
CMC3_CodingRegion(const objects::CGnomon_param::C_Param &from)
CMarkovChain< order > m_matrix
Definition: hmm.hpp:208
double Score(const CEResidueVec &seq, int i) const
static string class_id()
Definition: hmm.hpp:202
CMC_NonCodingRegion(const objects::CGnomon_param::C_Param &from)
void InitScore(int l, const objects::CMarkov_chain_array &from)
Definition: hmm_inlines.hpp:94
vector< CMarkovChain< order > > m_mc
Definition: hmm.hpp:92
double Score(const EResidue *seq) const
Definition: hmm_inlines.hpp:82
const double & Score(const EResidue *seq) const
Definition: hmm.hpp:74
CMarkovChain< 0 > Type
Definition: hmm.hpp:71
double & SubChain(int i)
Definition: hmm.hpp:75
double & Score(const EResidue *seq)
Definition: hmm.hpp:73
void Init(const objects::CMarkov_chain_params &hmm_param_asn)
Definition: hmm_inlines.hpp:50
CMarkovChain< order-1 > & SubChain(int i)
Definition: hmm.hpp:57
CMarkovChain< order > Type
Definition: hmm.hpp:53
void toScore()
Definition: hmm_inlines.hpp:73
CMarkovChain< order-1 > m_next[5]
Definition: hmm.hpp:65
const double & Score(const EResidue *seq) const
Definition: hmm.hpp:56
double & Score(const EResidue *seq)
Definition: hmm.hpp:55
void InitScore(const objects::CMarkov_chain_params &hmm_param_asn)
Definition: hmm_inlines.hpp:44
void Average(Type &mc0, Type &mc1, Type &mc2, Type &mc3)
Definition: hmm_inlines.hpp:64
virtual double Score(const CEResidueVec &seq, int i) const =0
~CNonCodingRegion()
Definition: hmm.hpp:196
static string class_id()
Definition: hmm.hpp:194
double Score(const CEResidueVec &, int) const
Definition: hmm.hpp:215
~CNullRegion()
Definition: hmm.hpp:214
CObject –.
Definition: ncbiobj.hpp:180
double AcceptorScore(int i, int strand) const
Definition: score.hpp:69
double DonorScore(int i, int strand) const
Definition: score.hpp:70
int SeqLen() const
Definition: score.hpp:90
bool SplittedStop(int id, int ia, int strand, int ph) const
Definition: score.hpp:91
bool OpenNonCodingRegion(int a, int b, int strand) const
Definition: score.cpp:125
virtual bool isGeneRightEnd() const
Definition: hmm.hpp:366
string GetStateName() const
Definition: hmm.hpp:363
int MaxLen() const
Definition: hmm.hpp:354
SStateScores GetStateScores() const
Definition: hmm.hpp:362
int MinLen() const
Definition: hmm.hpp:355
double BranchScore(const CHMM_State &) const
Definition: hmm.hpp:360
virtual double VirtTermScore() const
Definition: hmm.hpp:359
~CSingleExon()
Definition: hmm.hpp:352
virtual bool isGeneLeftEnd() const
Definition: hmm.hpp:365
double LengthScore() const
Definition: hmm.cpp:184
const CSingleExon * PrevExon() const
Definition: hmm.hpp:356
CSingleExon(EStrand strn, int point, const CSeqScores &seqscr, const CExonParameters &params)
Definition: hmm.cpp:175
double TermScore() const
Definition: hmm.cpp:189
int m_right
Definition: hmm.hpp:118
int m_inintron
Definition: hmm.hpp:118
virtual double Score(const CEResidueVec &seq, int i) const =0
int Right() const
Definition: hmm.hpp:114
int m_inexon
Definition: hmm.hpp:118
~CTerminal()
Definition: hmm.hpp:110
int InIntron() const
Definition: hmm.hpp:112
int InExon() const
Definition: hmm.hpp:111
int Left() const
Definition: hmm.hpp:113
int m_left
Definition: hmm.hpp:118
CWAM_Acceptor(const objects::CGnomon_param::C_Param &from)
static string class_id()
Definition: hmm.hpp:137
double Score(const CEResidueVec &seq, int i) const
~CWAM_Acceptor()
Definition: hmm.hpp:139
CMarkovChainArray< order > m_matrix
Definition: hmm.hpp:143
CMarkovChainArray< order > m_matrix
Definition: hmm.hpp:131
static string class_id()
Definition: hmm.hpp:126
~CWAM_Donor()
Definition: hmm.hpp:125
double Score(const CEResidueVec &seq, int i) const
CWAM_Donor(const objects::CGnomon_param::C_Param &from)
double Score(const CEResidueVec &seq, int i) const
Definition: hmm.cpp:465
CWAM_Stop(const objects::CGnomon_param::C_Param &from)
Definition: hmm.cpp:454
static string class_id()
Definition: hmm.hpp:162
CMarkovChainArray< 1 > m_matrix
Definition: hmm.hpp:168
~CWAM_Stop()
Definition: hmm.hpp:164
CWMM_Start(const objects::CGnomon_param::C_Param &from)
Definition: hmm.cpp:433
CMarkovChainArray< 0 > m_matrix
Definition: hmm.hpp:156
static string class_id()
Definition: hmm.hpp:150
~CWMM_Start()
Definition: hmm.hpp:152
double Score(const CEResidueVec &seq, int i) const
Definition: hmm.cpp:444
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
vector< double > TDVec
double BadScore()
EStrand
@ eMinus
@ ePlus
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
const int kTooFarLen
Definition: hmm.hpp:47
const double kLnThree
Definition: hmm.cpp:46
SStateScores CalcStateScores(const State &st)
Definition: hmm.hpp:223
const double kLnHalf
Definition: hmm.cpp:45
int i
T max(T x_, T y_)
double m_score
Definition: hmm.hpp:220
double m_region
Definition: hmm.hpp:220
double m_term
Definition: hmm.hpp:220
double m_branch
Definition: hmm.hpp:220
double m_length
Definition: hmm.hpp:220
Definition: type.c:6
Modified on Wed Apr 24 14:17:29 2024 by modify_doxy.py rev. 669887