📄 nw_aligner.cpp
字号:
maxseg = cur; imax = i0; jmax = j0; if(maxseg >= min_size) goto ret_point; } cur = 0; } break; case eTS_Match: case eTS_Replace: { if(*p1 == *p2) { if(cur == 0) { i0 = p1 - m_Seq1; j0 = p2 - m_Seq2; } ++cur; } else { if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; if(maxseg >= min_size) goto ret_point; } cur = 0; } ++p1; ++p2; } break; default: { NCBI_THROW(CAlgoAlignException, eInternal, "Invalid transcript symbol"); } } } if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } ret_point: *q0 = imax; *s0 = jmax; *q1 = *q0 + maxseg - 1; *s1 = *s0 + maxseg - 1; return maxseg;}size_t CNWAligner::GetRightSeg(size_t* q0, size_t* q1, size_t* s0, size_t* s1, size_t min_size) const{ size_t trdim = m_Transcript.size(); size_t cur = 0, maxseg = 0; const char* seq1_end = m_Seq1 + m_SeqLen1; const char* seq2_end = m_Seq2 + m_SeqLen2; const char* p1 = seq1_end - 1; const char* p2 = seq2_end - 1; size_t i0 = m_SeqLen1 - 1, j0 = m_SeqLen2 - 1, imax = i0, jmax = j0; for(size_t k = 0; k < trdim; ++k) { switch(m_Transcript[k]) { case eTS_Insert: { --p2; if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; if(maxseg >= min_size) goto ret_point; } cur = 0; } break; case eTS_Delete: { --p1; if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; if(maxseg >= min_size) goto ret_point; } cur = 0; } break; case eTS_Match: case eTS_Replace: { if(*p1 == *p2) { if(cur == 0) { i0 = p1 - m_Seq1; j0 = p2 - m_Seq2; } ++cur; } else { if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; if(maxseg >= min_size) goto ret_point; } cur = 0; } --p1; --p2; } break; default: { NCBI_THROW(CAlgoAlignException, eInternal, "Invalid transcript symbol"); } } } if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } ret_point: *q1 = imax; *s1 = jmax; *q0 = imax - maxseg + 1; *s0 = jmax - maxseg + 1; return maxseg;}size_t CNWAligner::GetLongestSeg(size_t* q0, size_t* q1, size_t* s0, size_t* s1) const{ size_t trdim = m_Transcript.size(); size_t cur = 0, maxseg = 0; const char* p1 = m_Seq1; const char* p2 = m_Seq2; size_t i0 = 0, j0 = 0, imax = i0, jmax = j0; for(int k = trdim-1; k >= 0; --k) { switch(m_Transcript[k]) { case eTS_Insert: { ++p2; if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } cur = 0; } break; case eTS_Delete: { ++p1; if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } cur = 0; } break; case eTS_Match: case eTS_Replace: { if(*p1 == *p2) { if(cur == 0) { i0 = p1 - m_Seq1; j0 = p2 - m_Seq2; } ++cur; } else { if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } cur = 0; } ++p1; ++p2; } break; default: { NCBI_THROW(CAlgoAlignException, eInternal, "Invalid transcript symbol"); } } } if(cur > maxseg) { maxseg = cur; imax = i0; jmax = j0; } *q0 = imax; *s0 = jmax; *q1 = *q0 + maxseg - 1; *s1 = *s0 + maxseg - 1; return maxseg;}END_NCBI_SCOPE/* * =========================================================================== * $Log: nw_aligner.cpp,v $ * Revision 1000.3 2004/06/01 18:04:52 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.48 * * Revision 1.48 2004/05/21 21:41:02 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.47 2004/05/19 13:37:47 kapustin * Remove test dumping code * * Revision 1.46 2004/05/18 21:43:40 kapustin * Code cleanup * * Revision 1.45 2004/05/17 14:50:56 kapustin * Add/remove/rearrange some includes and object declarations * * Revision 1.44 2004/04/23 14:39:47 kapustin * Add Splign library and other changes * * Revision 1.42 2003/12/29 13:03:48 kapustin * Return string from GetTranscriptString(). * * Revision 1.41 2003/10/31 19:40:13 kapustin * Get rid of some WS and GCC complains * * Revision 1.40 2003/10/27 20:47:35 kapustin * Minor code cleanup * * Revision 1.39 2003/10/14 18:44:46 kapustin * Adjust esf flags during pattern-guided alignment * * Revision 1.38 2003/09/30 19:50:04 kapustin * Make use of standard score matrix interface * * Revision 1.37 2003/09/26 14:43:18 kapustin * Remove exception specifications * * Revision 1.36 2003/09/15 20:49:11 kapustin * Clear the transcript when setting new sequences * * Revision 1.35 2003/09/04 16:07:38 kapustin * Use STL vectors for exception-safe dynamic arrays and matrices * * Revision 1.34 2003/09/03 17:28:40 kapustin * Clean the list of includes * * Revision 1.33 2003/09/02 22:38:18 kapustin * Move format functionality out of the class * * Revision 1.32 2003/07/09 15:11:22 kapustin * Update plain text output with seq ids and use inequalities instead of * binary operation to verify intron boundaries * * Revision 1.31 2003/06/26 20:39:39 kapustin * Rename formal parameters in SetEndSpaceFree() to avoid conflict with macro * under some configurations * * Revision 1.30 2003/06/17 17:20:44 kapustin * CNWAlignerException -> CAlgoAlignException * * Revision 1.29 2003/06/17 16:06:13 kapustin * Detect all variety of splices in Seq-Align formatter (restored from 1.27) * * Revision 1.28 2003/06/17 14:51:04 dicuccio * Fixed after algo/ rearragnement * * Revision 1.26 2003/06/02 14:04:49 kapustin * Progress indication-related updates * * Revision 1.25 2003/05/23 18:27:02 kapustin * Use weak comparisons in core recurrences. Adjust for new * transcript identifiers. * * Revision 1.24 2003/04/17 14:44:40 kapustin * A few changes to eliminate gcc warnings * * Revision 1.23 2003/04/14 19:00:55 kapustin * Add guide creation facility. x_Run() -> x_Align() * * Revision 1.22 2003/04/10 19:15:16 kapustin * Introduce guiding hits approach * * Revision 1.21 2003/04/02 20:52:55 kapustin * Make FormatAsText virtual. Pass output string as a parameter. * * Revision 1.20 2003/03/31 15:32:05 kapustin * Calculate score independently from transcript * * Revision 1.19 2003/03/19 16:36:39 kapustin * Reverse memory limit condition * * Revision 1.18 2003/03/18 15:15:51 kapustin * Implement virtual memory checking function. Allow separate free end * gap specification * * Revision 1.17 2003/03/17 15:31:46 kapustin * Forced conversion to double in memory limit checking to avoid integer * overflow * * Revision 1.16 2003/03/14 19:18:50 kapustin * Add memory limit checking. Fix incorrect seq index references when * reporting about incorrect input seq character. Support all characters * within IUPACna coding * * Revision 1.15 2003/03/07 13:51:11 kapustin * Use zero-based indices to specify seq coordinates in ASN * * Revision 1.14 2003/03/05 20:13:48 kapustin * Simplify FormatAsText(). Fix FormatAsSeqAlign(). Convert sequence * alphabets to capitals * * Revision 1.13 2003/02/11 16:06:54 kapustin * Add end-space free alignment support * * Revision 1.12 2003/02/04 23:04:50 kapustin * Add progress callback support * * Revision 1.11 2003/01/31 02:55:48 lavr * User proper argument for ::time() * * Revision 1.10 2003/01/30 20:32:36 kapustin * Add EstiamteRunningTime() * * Revision 1.9 2003/01/28 12:39:03 kapustin * Implement ASN.1 and SeqAlign output * * Revision 1.8 2003/01/24 16:48:50 kapustin * Support more output formats - type 2 and gapped FastA * * Revision 1.7 2003/01/21 16:34:21 kapustin * Get rid of reverse() and reverse_copy() not supported by MSVC and/or ICC * * Revision 1.6 2003/01/21 12:41:37 kapustin * Use class neg infinity constant to specify least possible score * * Revision 1.5 2003/01/08 15:42:59 kapustin * Fix initialization for the first column of the backtrace matrix * * Revision 1.4 2003/01/06 18:04:10 kapustin * CNWAligner: add sequence size verification * * Revision 1.3 2002/12/31 13:53:13 kapustin * CNWAligner::Format() -- use CNcbiOstrstreamToString * * Revision 1.2 2002/12/12 17:59:28 kapustin * Enable spliced alignments * * Revision 1.1 2002/12/06 17:41:21 ivanov * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -