* seq2,
size_tlen2,
50:
CNWAligner(seq1, len1, seq2, len2, scoremat)
88list<ETranscriptSymbol>::const_iterator ii =
m_TransList.begin();
92 for(
size_tk = 1; k <= nsize; ++k)
114list<ETranscriptSymbol>::iterator translist_pos,
115 boolleft_top,
boolright_bottom )
122 const Int8dimI = submatr.
i2- submatr.
i1+ 1;
123 const Int8dimJ = submatr.
j2- submatr.
j1+ 1;
124 if(dimI < 1 || dimJ < 1)
return;
126 booltop_level = submatr.
i1== 0 && submatr.
j1== 0 &&
130 if(dimI < 3 || dimJ < 3) {
132list<ETranscriptSymbol> lts;
134 if(top_level)
m_score= score;
139 const size_tI = submatr.
i1+ dimI / 2;
140 const size_tdim = dimJ + 1;
144vector<TScore> vEtop (dim), vFtop (dim), vGtop (dim);
145vector<unsigned char> trace_top (dim);
148vector<TScore> vEbtm (dim), vFbtm (dim), vGbtm (dim);
149vector<unsigned char> trace_btm (dim);
153&vEtop, &vFtop, &vGtop,
154&trace_top, left_top );
156 x_RunBtm(rbtm, vEbtm, vFbtm, vGbtm, trace_btm, right_bottom);
160 x_RunTop(rtop, vEtop, vFtop, vGtop, trace_top, left_top);
161 x_RunBtm(rbtm, vEbtm, vFbtm, vGbtm, trace_btm, right_bottom);
169 size_ttrans_pos = 0;
172trans_pos, trans_type );
177 if(trans_type ==
eII) {
178 unsigned charmask_top =
kMaskE;
179 if(trace_top[trans_pos] &
kMaskEc)
181trace_top[trans_pos] = mask_top;
184 if(trans_type ==
eDD) {
185trace_top[trans_pos] = (trace_top[trans_pos] &
kMaskFc)?
kMaskFc: 0;
186trace_btm[trans_pos] =
kMaskFc;
190vector<unsigned char>::const_iterator trace_it_top =
191trace_top.begin() + trans_pos;
192list<ETranscriptSymbol> subpath_left;
193 size_tsteps_left =
x_ExtendSubpath(trace_it_top,
false, subpath_left);
195vector<unsigned char>::const_iterator trace_it_btm =
196trace_btm.begin() + trans_pos;
197list<ETranscriptSymbol> subpath_right;
198 size_tsteps_right =
x_ExtendSubpath(trace_it_btm,
true, subpath_right);
202 Int8nc0 = trans_pos - steps_left;
205 "Assertion: LT underflow");
207 boolbLeft = nc0 == 0;
208 boolbTop = I == submatr.
i1;
209 if(bLeft && !bTop) {
210 Int8jump = I - submatr.
i1;
211subpath_left.insert(subpath_left.begin(), jump,
eTS_Delete);
213 if(!bLeft && bTop) {
214subpath_left.insert(subpath_left.begin(), nc0,
eTS_Insert);
222 Int8nc1 = trans_pos + steps_right;
225 "Assertion: RB overflow");
227 boolbRight = nc1 == dimJ;
228 boolbBottom = I == submatr.
i2- 1;
229 if(bRight && !bBottom) {
230 Int8jump = submatr.
i2- I - 1;
231subpath_right.insert(subpath_right.end(), jump,
eTS_Delete);
233 if(!bRight && bBottom) {
234 Int8jump = dimJ - nc1;
235subpath_right.insert(subpath_right.end(), jump,
eTS_Insert);
237 if(bRight || bBottom) {
243 boolrb = subpath_left.front() ==
eTS_Delete;
247subpath_left.splice( subpath_left.end(), subpath_right );
249list<ETranscriptSymbol>::iterator ti0, ti1;
254 m_TransList.splice( translist_pos, subpath_left );
263 size_tleft_bnd = submatr.
j1+ trans_pos - steps_left - 1;
264 if(left_bnd >= submatr.
j1) {
265rlt.
i1= submatr.
i1;
266rlt.
j1= submatr.
j1;
272 "Assertion: Left boundary out of range");
279 size_tright_bnd = submatr.
j1+ trans_pos + steps_right;
280 if(right_bnd <= submatr.
j2) {
283rrb.
i2= submatr.
i2;
284rrb.
j2= submatr.
j2;
288 "Assertion: Right boundary out of range");
292 if(!bNoLT && !bNoRB) {
329 constvector<TScore>& vEtop,
constvector<TScore>& vFtop,
330 constvector<TScore>& vGtop,
constvector<TScore>& vEbtm,
331 constvector<TScore>& vFbtm,
constvector<TScore>& vGbtm,
335 const size_tdim = vEtop.size();
342 for(
size_t i= 0;
i< dim ; ++
i) {
343trans_alts [0] = vEtop[
i] + vEbtm[
i] -
m_Wg;
344trans_alts [1] = vFtop[
i] + vEbtm[
i];
345trans_alts [2] = vGtop[
i] + vEbtm[
i];
346trans_alts [3] = vEtop[
i] + vFbtm[
i];
347 TScorewg = ((bFreeGapLeft2 &&
i== 0) || ( bFreeGapRight2 &&
i== dim -1) )?
349trans_alts [4] = vFtop[
i] + vFbtm[
i] - wg;
350trans_alts [5] = vGtop[
i] + vFbtm[
i];
351trans_alts [6] = vEtop[
i] + vGbtm[
i];
352trans_alts [7] = vFtop[
i] + vGbtm[
i];
353trans_alts [8] = vGtop[
i] + vGbtm[
i];
355 for(
size_tk = 0; k < 9; ++k) {
356 if(trans_alts[k] > score) {
357score = trans_alts[k];
369vector<unsigned char>::const_iterator trace_it,
371list<ETranscriptSymbol>& subpath )
const 374 size_tstep_counter = 0;
377 unsigned charKey = *trace_it;
393 else if((Key &
kMaskE) == 0) {
399 "Assertion: incorrect backtrace symbol " 400 "(right expansion)");
406 unsigned charKey = *trace_it;
422 else if((Key &
kMaskE) == 0) {
428 "Assertion: incorrect backtrace symbol " 429 "(left expansion)");
443vector<TScore>& vE, vector<TScore>& vF, vector<TScore>& vG,
444vector<unsigned char>&
trace,
bool lt)
const 450 const size_tdim1 = rect.
i2- rect.
i1+ 1;
451 const size_tdim2 = rect.
j2- rect.
j1+ 1;
452 const size_tN1 = dim1 + 1;
453 const size_tN2 = dim2 + 1;
455vector<TScore> stl_rowV (N2), stl_rowF (N2);
456 TScore* rowV = &stl_rowV [0];
457 TScore* rowF = &stl_rowF [0];
461 const char* seq1 =
m_Seq1- 1 + rect.
i1;
462 const char* seq2 =
m_Seq2- 1 + rect.
j1;
466 boolbFreeGapLeft1 =
m_esf_L1&& rect.
i1== 0;
467 boolbFreeGapLeft2 =
m_esf_L2&& rect.
j1== 0;
471 const size_tprg_rep_rate = 100;
472 const size_tprg_rep_increment = prg_rep_rate*N2;
481 for(j = 1; j < N2; ++j) {
482rowV[j] = pV[j] + ws;
489wg = bFreeGapLeft2? 0:
m_Wg;
490ws = bFreeGapLeft2? 0:
m_Ws;
496 for(
i= 1;
i< N1 - 1; ++
i) {
500 unsigned charci = seq1[
i];
504 for(j = 1; j < N2; ++j) {
506 G= pV[j] + sm[ci][(
unsignedchar)seq2[j]];
515 if(j == N2 - 1 && bFreeGapRight2)
524V = (
E>= rowF[j])? (
E>=
G?
E:
G): (rowF[j] >=
G? rowF[j]:
G);
542vG[0] = vE[0] =
E= kInfMinus;
543vF[0] = V = V0 += ws;
545 unsigned charci = seq1[
i];
549 unsigned chartracer;
550 for(j = 1; j < N2; ++j) {
552vG[j] =
G= pV[j] + sm[ci][(
unsignedchar)seq2[j]];
566 if(j == N2 - 1 && bFreeGapRight2) {
613vector<TScore>& vE, vector<TScore>& vF, vector<TScore>& vG,
614vector<unsigned char>&
trace,
boolrb)
const 620 const size_tdim1 = rect.
i2- rect.
i1+ 1;
621 const size_tdim2 = rect.
j2- rect.
j1+ 1;
622 const size_tN1 = dim1 + 1;
623 const size_tN2 = dim2 + 1;
625vector<TScore> stl_rowV (N2), stl_rowF (N2);
626 TScore* rowV = &stl_rowV [0];
627 TScore* rowF = &stl_rowF [0];
631 const char* seq1 =
m_Seq1+ rect.
i1;
632 const char* seq2 =
m_Seq2+ rect.
j1;
638 boolbFreeGapLeft2 =
m_esf_L2&& rect.
j1== 0;
642 const size_tprg_rep_rate = 100;
643 const size_tprg_rep_increment = prg_rep_rate*N2;
652 for(j = N2 - 2; j >= 0; --j) {
653rowV[j] = pV[j] + ws;
660wg = bFreeGapRight2? 0:
m_Wg;
661ws = bFreeGapRight2? 0:
m_Ws;
667 for(
i= N1 - 2;
i> 0; --
i) {
671 unsigned charci = seq1[
i];
675 for(j = N2 - 2; j >= 0; --j) {
677 G= pV[j] + sm[ci][(
unsignedchar)seq2[j]];
686 if(j == 0 && bFreeGapLeft2) {
696V = (
E>= rowF[j])? (
E>=
G?
E:
G): (rowF[j] >=
G? rowF[j]:
G);
714vF[N2-1] = V = V0 += ws;
715vG[N2-1] = vE[N2-1] =
E= kInfMinus;
717 unsigned charci = seq1[
i];
721 unsigned chartracer;
722 for(j = N2 - 2; j >= 0; --j) {
724vG[j] =
G= pV[j] + sm[ci][(
unsignedchar)seq2[j]];
738 if(j == 0 && bFreeGapLeft2) {
785 boolleft_top,
boolright_bottom,
786list<ETranscriptSymbol>& subpath)
792 const size_tN1 = rect.
i2- rect.
i1+ 2;
793 const size_tN2 = rect.
j2- rect.
j1+ 2;
795vector<TScore> stl_rowV (N2), stl_rowF (N2);
796 TScore* rowV = &stl_rowV [0];
797 TScore* rowF = &stl_rowF [0];
800vector<unsigned char> stl_bm (N1*N2);
801 unsigned char* backtrace = &stl_bm[0];
805 const char* seq1 =
m_Seq1+ rect.
i1- 1;
806 const char* seq2 =
m_Seq2+ rect.
j1- 1;
810 boolbFreeGapLeft1 =
m_esf_L1&& rect.
i1== 0;
812 boolbFreeGapLeft2 =
m_esf_L2&& rect.
j1== 0;
823 for(k = 1; k < N2; k++) {
824rowV[k] = pV[k] + wsleft1;
835 TScoreV0 = left_top? 0: wgleft2;
837 unsigned chartracer;
840 for(
i= 1;
i< N1; ++
i) {
845 unsigned charci = seq1[
i];
847 if(
i== N1 - 1 && bFreeGapRight1) {
853 for(j = 1; j < N2; ++j, ++k) {
855 G= pV[j] + sm[ci][(
unsignedchar)seq2[j]];
868 if(j == N2 - 1 && bFreeGapRight2) {
871n0 = rowV[j] + ((right_bottom && j == N2 - 1)? 0: wg2);
898backtrace[k] = tracer;
910 unsigned charKey = backtrace[k];
917 while(k > 0 && (Key &
kMaskEc)) {
919Key = backtrace[k--];
925 while(k > 0 && (Key &
kMaskFc)) {
TScore x_FindBestJ(const vector< TScore > &vEtop, const vector< TScore > &vFtop, const vector< TScore > &vGtop, const vector< TScore > &vEbtm, const vector< TScore > &vFbtm, const vector< TScore > &vGbtm, size_t &pos, ETransitionType &trans_type) const
friend class CThreadRunOnTop
void x_DoSubmatrix(const SCoordRect &submatr, list< ETranscriptSymbol >::iterator translist_pos, bool left_top, bool right_bottom)
list< ETranscriptSymbol > m_TransList
void x_RunBtm(const SCoordRect &rect, vector< TScore > &vE, vector< TScore > &vF, vector< TScore > &vG, vector< unsigned char > &trace, bool rb) const
TScore x_RunTerm(const SCoordRect &rect, bool left_top, bool right_bottom, list< ETranscriptSymbol > &subpath)
size_t x_ExtendSubpath(vector< unsigned char >::const_iterator trace_it, bool direction, list< ETranscriptSymbol > &subpath) const
void x_RunTop(const SCoordRect &rect, vector< TScore > &vE, vector< TScore > &vF, vector< TScore > &vG, vector< unsigned char > &trace, bool lt) const
virtual bool x_CheckMemoryLimit()
SNCBIFullScoreMatrix m_ScoreMatrix
FProgressCallback m_prg_callback
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
bool Run(TRunMode flags=fRunDefault)
Run the thread.
void Join(void **exit_data=0)
Wait for the thread termination.
const unsigned char kMaskFc
const unsigned char kMaskEc
const unsigned char kMaskE
const unsigned char kMaskD
DEFINE_STATIC_FAST_MUTEX(masterlist_mutex)
bool MM_RequestNewThread(const size_t max_threads)
Multi-threading â mutexes; rw-locks; semaphore.
#define NCBI_FSM_DIM
Recommended approach: unpack and index directly.
int TNCBIScore
data types
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