template<class L, class
R> inline
49 if(left.MScore() ==
BadScore())
return true;
50 int len= right.Stop()-left.Stop();
51 return(
len>
kTooFarLen&& score+left.MScore() < right.Score());
68 template<
classLeft,
classRight>
inline 69 bool s_EvaluateNewScore(
constLeft& left,
constRight& right,
double& rscore,
bool& openrgn,
boolrightanchor =
false)
76 int len= right.Stop()-left.Stop();
77 if(
len> right.MaxLen())
return false;
78 if(!right.NoRightEnd() &&
len< right.MinLen())
return true;
80 doublescr, score = 0;
83scr = left.BranchScore(right);
84 if(scr ==
BadScore())
return true;
88scr = right.BranchScore(left);
89 if(scr ==
BadScore())
return true;
90scr += right.DenScore()-left.DenScore();
95 if(right.StopInside())
return false;
97 if(right.NoRightEnd() && !rightanchor) scr = right.ClosingLengthScore();
98 elsescr = right.LengthScore();
99 if(scr ==
BadScore())
return true;
102scr = right.RgnScore();
103 if(scr ==
BadScore())
return true;
106 if(!right.NoRightEnd())
108scr = right.TermScore();
109 if(scr ==
BadScore())
return true;
113openrgn = right.OpenRgn();
120 template<
classL,
classR>
121 inline bool s_ForwardStep(
constL& left,
R& right,
intleftprot,
intrightprot)
126 else if(score ==
BadScore())
return true;
128 intprotnum = right.GetSeqScores().ProtNumber(left.Stop(),right.Stop());
130 if(rightprot == 0 && (leftprot != 0 || protnum != 0))
137 if(rightprot == 1 && protnum == 0)
return true;
138 else if(protnum > 0) --protnum;
141 if(left.Score() !=
BadScore() && openrgn)
143 doublescr = score-protnum*right.GetSeqScores().MultiProtPenalty()+left.Score();
144 if(scr > right.Score())
146right.UpdateLeftState(left);
147right.UpdateScore(scr);
160 else if(score ==
BadScore())
return true;
162 if(left.Score() !=
BadScore() && openrgn)
164 doublescr = score+left.Score();
165 if(scr > right.
Score())
172 return(openrgn && !
s_TooFar(left, right, score));
181 else if(score ==
BadScore())
return true;
183 if(left.Score() !=
BadScore() && openrgn)
185 doublescr = score+left.Score();
186 if(scr > right.
Score())
193 return(openrgn && !
s_TooFar(left, right, score));
197 template<
classL,
classR>
198 inline void s_MakeStep(vector<L>& lvec, vector<R>& rvec,
intleftprot,
intrightprot)
200 if(lvec.empty())
return;
201 typenamevector<L>::reverse_iterator
i= lvec.rbegin();
202 if(
i->Stop() == rvec.back().Stop()) ++
i;
203 for(;
i!= lvec.rend() &&
s_ForwardStep(*
i,rvec.back(),leftprot,rightprot);++
i);
205 if(rvec.size() > 1) {
206rvec.back().UpdatePrevExon(rvec[rvec.size()-2]);
211 inline void s_MakeStep(vector<L>& lvec, vector<CIntron>& rvec)
213 if(lvec.empty())
return;
215 typenamevector<L>::reverse_iterator
i= lvec.rbegin();
217 intrlimit = right.
Stop();
218 if(
i->Stop() == rlimit) ++
i;
220 while(
i!= lvec.rend() &&
i->Stop() >= nearlimit)
225 if(
i== lvec.rend())
return;
226 for(
constL* p = &*
i; p !=0; p = p->PrevExon())
234 inline void s_MakeStep(
const CSeqScores& seqscr, vector<L>& lvec, vector<CIntergenic>& rvec,
boolrightanchor =
false)
236 if(lvec.empty())
return;
239 intrlimit = right.
Stop();
240 if(lvec[
i].Stop() == rlimit) --
i;
243 while(
i>= 0 && lvec[
i].Stop() >= nearlimit)
248 for(
constL* p = &lvec[
i]; p !=0; p = p->PrevExon())
256rvec.push_back(
CSingleExon(strand, point, seqscr, exon_params));
258 if(rvec.back().Score() ==
BadScore()) rvec.pop_back();
264 for(
intkr = 0; kr < 2; ++kr)
266 for(
intphr = 0; phr < 3; ++phr)
268rvec[kr][phr].push_back(
R(strand,phr,point,seqscr,exon_params));
270 if(rvec[kr][phr].back().Score() ==
BadScore()) rvec[kr][phr].pop_back();
278rvec.push_back(
R(strand,0,point,seqscr,exon_params));
279 for(
intkl = 0; kl < 2; ++kl)
281 for(
intphl = 0; phl < 3; ++phl)
286 if(rvec.back().Score() ==
BadScore()) rvec.pop_back();
291 for(
intphr = 0; phr < 3; ++phr)
293 for(
intkr = 0; kr < 2; ++kr)
295rvec[kr][phr].push_back(
CInternalExon(strand,phr,point,seqscr,exon_params));
296 for(
intphl = 0; phl < 3; ++phl)
298 for(
intkl = 0; kl < 2; ++kl)
300 s_MakeStep(lvec[kl][phl], rvec[kr][phr], kl, kr);
303 if(rvec[kr][phr].back().Score() ==
BadScore()) rvec[kr][phr].pop_back();
308 template<
classL1,
classL2>
311 for(
intk = 0; k < 2; ++k)
313 for(
intphl = 0; phl < 3; ++phl)
315 intphr = (shift+phl)%3;
316rvec[k][phr].push_back(
CIntron(strand,phr,point,seqscr,intron_params));
317 if(k == 1) rvec[k][phr].back().UpdateScore(
BadScore());
320 if(rvec[k][phr].back().Score() ==
BadScore()) rvec[k][phr].pop_back();
327 if(scr1 ==
BadScore())
returnscr2;
328 else if(scr2 ==
BadScore())
returnscr1;
329 else if(scr1 >= scr2)
returnscr1+
log(1+exp(scr2-scr1));
330 else returnscr2+
log(1+exp(scr1-scr2));
337 boolleftanchor,
boolrightanchor)
348 for(
intk = 0; k < 2; ++k)
350 for(
intphase = 0; phase < 3; ++phase)
368 doubleBigScore = 10000;
371 m_seplus.back().UpdateScore(BigScore);
374 for(
int i= 0;
i<
len; ++
i)
449 for(
intk = 0; k < 2; ++k) {
450 for(
intph = 0; ph < 3; ++ph) {
470to.setf(IOS_BASE::right,IOS_BASE::adjustfield);
477to.setf(IOS_BASE::right,IOS_BASE::adjustfield);
478to.setf(IOS_BASE::fixed,IOS_BASE::floatfield);
481 if(
t> 1000000000) to <<
"+Inf";
482 else if(
t< -1000000000) to <<
"-Inf";
499support.
Extend(algn,
false);
501supporting_align = &algn;
516 if(!support.
Exons().empty()) {
524gene.
Extend(support,
false);
528gene = *supporting_align;
549vector< vector<const CExon*> > gen_exons;
552 if(
dynamic_cast<const CIntron*
>(
Path()) &&
Path()->LeftState())
553gen_exons.push_back(vector<const CExon*>());
557 if(p->isGeneRightEnd())
558gen_exons.push_back(vector<const CExon*>());
560gen_exons.back().push_back(
static_cast<const CExon*
>(p));
565 ITERATE(vector< vector<const CExon*> >, g_it, gen_exons) {
566 EStrandstrand = g_it->back()->Strand();
573 for(
int i= (
int)g_it->size()-1;
i>= 0; --
i) {
574 const CExon* pe = (*g_it)[
i];
579local_gene.
AddExon(local_exon);
583 if(
i!= (
int)g_it->size()-1) {
588ssig.push_back(
toACGT(seqp[local_exon.
GetTo()+1]));
589ssig.push_back(
toACGT(seqp[local_exon.
GetTo()+2]));
596gene.
AddExon(exon, fsig, ssig);
602 TSignedSeqRangelocal_reading_frame(g_it->back()->Start(), g_it->front()->Stop());
604 if(!g_it->back()->isGeneLeftEnd()) {
605 const CExon* pe = g_it->back();
606 intestart = pe->
Start();
607 intestop = pe->
Stop();
608 intrframe = pe->
Phase();
609 intlframe = pe->
isPlus() ? (rframe-(estop-estart))%3 : (rframe+(estop-estart))%3;
612 intdel = pe->
isPlus() ? (3-lframe)%3 : (1+lframe)%3;
614 if(localmap.
FShiftedLen(local_reading_frame) <= del) {
621 if(!g_it->front()->isGeneRightEnd()) {
622 const CExon* pe = g_it->front();
623 intrframe = pe->
Phase();
624 intdel = pe->
isPlus() ? (1+rframe)%3 : (3-rframe)%3;
626 if(localmap.
FShiftedLen(local_reading_frame) <= del) {
634 if(local_reading_frame.
Empty()) {
646gene, reading_frame);
650 if(g_it->back()->isGeneLeftEnd()) {
667 if(g_it->front()->isGeneRightEnd()) {
708vector<const CHMM_State*> states;
710reverse(states.begin(),states.end());
724 for(
int i= 0;
i< (
int)states.size(); ++
i)
727 if(
dynamic_cast<const CIntergenic*
>(p)) cout << endl;
TSignedSeqPos FShiftedMove(TSignedSeqPos orig_pos, int len) const
TSignedSeqRange MapRangeEditedToOrig(TSignedSeqRange edited_range, bool withextras=true) const
TSignedSeqPos MapEditedToOrig(TSignedSeqPos edited_pos) const
int FShiftedLen(TSignedSeqRange ab, ERangeEnd lend, ERangeEnd rend) const
TSignedSeqRange MapRangeOrigToEdited(TSignedSeqRange orig_range, ERangeEnd lend, ERangeEnd rend) const
void SetStart(TSignedSeqRange r, bool confirmed=false)
void SetScore(double score, bool open=false)
TSignedSeqRange Start() const
void AddPStop(SPStop stp)
TSignedSeqRange ProtReadingFrame() const
void SetStop(TSignedSeqRange r, bool confirmed=false)
const TPStops & PStops() const
void SetReadingFrame(TSignedSeqRange r, bool protein=false)
void AddExon(TSignedSeqRange exon, const string &fs="", const string &ss="", double ident=0, const string &seq="", const CInDelInfo::SSource &src=CInDelInfo::SSource())
void ExtendRight(int amount)
const list< CRef< CSeq_id > > & TrustedProt() const
void Extend(const CGeneModel &a, bool ensure_cds_invariant=true)
void InsertTrustedProt(CRef< CSeq_id > g)
int FShiftedLen(TSignedSeqRange ab, bool withextras=true) const
const CSupportInfoSet & Support() const
const TExons & Exons() const
TSignedSeqRange ReadingFrame() const
virtual CAlignMap GetAlignMap() const
void SetStrand(EStrand s)
void ReplaceSupport(const CSupportInfoSet &support_set)
void SetCdsInfo(const CCDSInfo &cds_info)
bool ConfirmedStop() const
void InsertTrustedmRNA(CRef< CSeq_id > g)
bool AddSupport(const CSupportInfo &support)
TSignedSeqRange Limits() const
const list< CRef< CSeq_id > > & TrustedmRNA() const
const CCDSInfo & GetCdsInfo() const
TSignedSeqRange MaxCdsLimits() const
bool ConfirmedStart() const
void ExtendLeft(int amount)
int isCompatible(const CGeneModel &a) const
const CHMM_State * LeftState() const
virtual string GetStateName() const =0
virtual SStateScores GetStateScores() const =0
void UpdateLeftState(const CHMM_State &left)
void UpdateScore(double scr)
vector< CSingleExon > m_seplus
vector< CInternalExon > m_ieminus[2][3]
vector< CLastExon > m_leplus
vector< CIntergenic > m_igplus
vector< CLastExon > m_leminus[2][3]
vector< CIntron > m_inminus[2][3]
const CHMM_State * m_path
vector< CSingleExon > m_seminus
const CHMM_State * Path() const
list< CGeneModel > GetGenes() const
vector< CFirstExon > m_feplus[2][3]
vector< CIntron > m_inplus[2][3]
const CSeqScores & m_seqscr
CParse(const CSeqScores &ss, const CIntronParameters &intron_params, const CIntergenicParameters &intergenic_params, const CExonParameters &exon_params, bool leftanchor, bool rightanchor)
vector< CIntergenic > m_igminus
vector< CInternalExon > m_ieplus[2][3]
vector< CFirstExon > m_feminus
bool isReadingFrameRightEnd(int i, int strand) const
int LeftAlignmentBoundary(int b) const
int DonorNumber(int strand) const
double StartScore(int i, int strand) const
const TGeneModelList & Alignments() const
TSignedSeqPos From() const
int StopNumber(int strand) const
const EResidue * SeqPtr(int i, int strand) const
double AcceptorScore(int i, int strand) const
double DonorScore(int i, int strand) const
int AcceptorNumber(int strand) const
bool isReadingFrameLeftEnd(int i, int strand) const
const CAlignMap & FrameShiftedSeqMap() const
double StopScore(int i, int strand) const
int StartNumber(int strand) const
bool Include(TSignedSeqRange big, TSignedSeqRange small)
void ReverseComplement(const BidirectionalIterator &first, const BidirectionalIterator &last)
list< CGeneModel > TGeneModelList
TResidue toACGT(EResidue c)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
bool NotEmpty(void) const
CRange< TSignedSeqPos > TSignedSeqRange
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
unsigned int
A callback function used to compare two keys in a database.
constexpr bool empty(list< Ts... >) noexcept
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void s_MakeStep(vector< L > &lvec, vector< R > &rvec, int leftprot, int rightprot)
double AddProbabilities(double scr1, double scr2)
void Out(T t, int w, CNcbiOstream &to=cout)
bool s_ForwardStep(const L &left, R &right, int leftprot, int rightprot)
void AddSupport(const TGeneModelList &align_list, TSignedSeqRange inside_range, CGeneModel &gene, TSignedSeqRange reading_frame)
bool s_TooFar(const L &left, const R &right, double score)
bool s_EvaluateNewScore(const Left &left, const Right &right, double &rscore, bool &openrgn, bool rightanchor=false)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
SRState(const CHMM_State &l, const CHMM_State &r)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4