|
| void | clearAlignment () |
| void | clear () |
| | SmithWaterman (Atype *A, QualityType *qualities, Btype *B, int m, int n, int allowedInsertDelete=INT_MAX, int direction=1, readIndexType MOffset=0, referenceIndexType NOffset=0) |
| void | setRead (Atype *A) |
| void | setReadQuality (QualityType *qualities) |
| void | setReference (Btype *B) |
| void | setReadLength (int m) |
| void | setReadOffset (readIndexType MOffset) |
| void | setReferenceLength (int n) |
| void | setReferenceOffset (referenceIndexType NOffset) |
| void | setAllowedInsertDelete (int allowedInsertDelete=INT_MAX) |
| void | setDirection (int direction) |
| void | clearH () |
| void | populateH () |
| void | printH (bool prettyPrint=true) |
| void | debugPrint (bool doPrintH=true) |
| void | populateAlignment () |
| int | getSumQ () |
| int | getSumQForward () |
| int | getSumQBackward () |
| void | rollCigarForward (CigarRoller &cigar) |
| void | rollCigarBackward (CigarRoller &cigar) |
| int | getSoftClipCount () |
| void | rollCigar (CigarRoller &cigar) |
| bool | localAlignment (uint32_t bandSize, Atype &read, readIndexType readLength, QualityType &quality, Btype &reference, referenceIndexType referenceLength, referenceIndexType referenceOffset, CigarRoller &cigarRoller, uint32_t &softClipCount, referenceIndexType &cigarStartingPoint, int &sumQ) |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
class SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >
Definition at line 127 of file SmithWaterman.h.
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::SmithWaterman |
( |
| ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::SmithWaterman |
( |
Atype * | A, |
|
|
QualityType * | qualities, |
|
|
Btype * | B, |
|
|
int | m, |
|
|
int | n, |
|
|
int | allowedInsertDelete = INT_MAX, |
|
|
int | direction = 1, |
|
|
readIndexType | MOffset = 0, |
|
|
referenceIndexType | NOffset = 0 ) |
|
inline |
Definition at line 211 of file SmithWaterman.h.
220 :
221 A(A),
222 qualities(qualities),
223 B(B),
224 m(m),
225 n(n),
226 allowedInsertDelete(allowedInsertDelete),
227 direction(direction),
228 MOffset(MOffset),
229 NOffset(NOffset),
231 {
232 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::clear |
( |
| ) |
|
|
inline |
Definition at line 185 of file SmithWaterman.h.
186 {
187 maxCostPosition.first = 0;
188 maxCostPosition.second = 0;
192 m = 0;
193 n = 0;
194 MOffset = 0;
195 NOffset = 0;
196 allowedInsertDelete = 0;
197 direction = 0;
198 gapOpenCount = 0;
199 gapCloseCount = 0;
200 gapExtendCount = 0;
201 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::clearAlignment |
( |
| ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::clearH |
( |
| ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::debugPrint |
( |
bool | doPrintH = true | ) |
|
|
inline |
Definition at line 369 of file SmithWaterman.h.
370 {
372 cout <<
"maxCostPosition = " << maxCostPosition <<
std::endl;
373 if (alignment.empty())
cout <<
"alignment vector is empty.\n";
374 else
375 {
376 cout <<
"alignment vector:\n";
378 {
379 cout << (
i - alignment.begin()) <<
": " << *
i <<
"\n";
380 }
381 }
383 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::getSoftClipCount |
( |
| ) |
|
|
inline |
Definition at line 680 of file SmithWaterman.h.
681 {
682 if (direction>0)
683 {
684
685 return m - maxCostPosition.first;
686 }
687 else
688 {
689
690
691
692 return m - maxCostPosition.first;
693 }
694 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::getSumQ |
( |
| ) |
|
|
inline |
Definition at line 448 of file SmithWaterman.h.
449 {
450 if (direction>0) return getSumQForward();
451 else return getSumQBackward();
452 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::getSumQBackward |
( |
| ) |
|
|
inline |
Definition at line 497 of file SmithWaterman.h.
498 {
501
502 for (
i=alignment.begin();
i < alignment.end() - 1;
i++)
503 {
504#if defined(DEBUG_GETSUMQ)
506#endif
507 if ((*(
i+1)).
first == ((*i).first-1) && (*(
i+1)).second == ((*i).second - 1))
508 {
509
510#if defined(DEBUG_GETSUMQ)
511 cout <<
"Match/Mismatch";
512#endif
513 if ((*A)[MOffset + m - (*i).first] != (*B)[NOffset + n - (*i).second])
514 sumQ += (*qualities)[MOffset + m - (*i).first] -
'!';
515 }
516 else if ((*(
i+1)).
first == ((*i).first-1) && (*(
i+1)).second == ((*i).second))
517 {
518
519#if defined(DEBUG_GETSUMQ)
521#endif
523 }
524 else if ((*(
i+1)).
first == ((*i).first) && (*(
i+1)).second == ((*i).second - 1))
525 {
526
527#if defined(DEBUG_GETSUMQ)
529#endif
531 }
532 }
533#if defined(DEBUG_GETSUMQ)
535#endif
537 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::getSumQForward |
( |
| ) |
|
|
inline |
Definition at line 454 of file SmithWaterman.h.
455 {
458
459 for (
i=alignment.rbegin();
i < alignment.rend() - 1;
i++)
460 {
461
462#if defined(DEBUG_GETSUMQ)
464#endif
465 if ((*(
i+1)).
first == ((*i).first+1) && (*(
i+1)).second == ((*i).second + 1))
466 {
467
468#if defined(DEBUG_GETSUMQ)
469 cout <<
"Match/Mismatch";
470#endif
471 if ((*A)[MOffset + (*i).first] != (*B)[NOffset + (*i).second])
472 sumQ += (*qualities)[MOffset + (*i).first] -
'!';
473 }
474 else if ((*(
i+1)).
first == ((*i).first+1) && (*(
i+1)).second == ((*i).second))
475 {
476
477#if defined(DEBUG_GETSUMQ)
479#endif
481 }
482 else if ((*(
i+1)).
first == ((*i).first) && (*(
i+1)).second == ((*i).second + 1))
483 {
484
485#if defined(DEBUG_GETSUMQ)
487#endif
489 }
490 }
491#if defined(DEBUG_GETSUMQ)
493#endif
495 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| bool SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::localAlignment |
( |
uint32_t | bandSize, |
|
|
Atype & | read, |
|
|
readIndexType | readLength, |
|
|
QualityType & | quality, |
|
|
Btype & | reference, |
|
|
referenceIndexType | referenceLength, |
|
|
referenceIndexType | referenceOffset, |
|
|
CigarRoller & | cigarRoller, |
|
|
uint32_t & | softClipCount, |
|
|
referenceIndexType & | cigarStartingPoint, |
|
|
int & | sumQ ) |
|
inline |
Definition at line 713 of file SmithWaterman.h.
726 {
727
728 clear();
729
731
732 setDirection(+1);
734
736 setReadOffset(0);
738
740
744
745 populateH();
746
748
749 populateAlignment();
750
752
754
755 return false;
756
757 };
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::populateAlignment |
( |
| ) |
|
|
inline |
Definition at line 389 of file SmithWaterman.h.
390 {
391 alignment.clear();
393
394 i = maxCostPosition.first;
395 j = maxCostPosition.second;
396
397
398
399
400
401
402
403 while (H[
i][
j] > 0 || (
i>0 &&
j>0))
404 {
405
406#if defined(DEBUG_ALIGNMENT_VECTOR)
407 cout <<
"alignment.push_back(" <<
i <<
", " <<
j <<
")" <<
endl;
408#endif
410 if (H[
i-1][
j-1]>=H[
i-1][
j] && H[
i-1][
j-1]>=H[
i][
j-1])
411 {
412
415 }
416 else if (H[
i-1][
j] < H[
i][
j-1])
417 {
418
420 }
421 else
422 {
423
425 }
426 }
428#if defined(DEBUG_ALIGNMENT_VECTOR)
429 cout <<
"alignment.push_back(" <<
i <<
", " <<
j <<
")" <<
endl;
430 cout <<
"alignment.size(): " << alignment.size() <<
endl;
431#endif
432 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::populateH |
( |
| ) |
|
|
inline |
Definition at line 300 of file SmithWaterman.h.
301 {
302
303 maxCostValue = 0;
304
305 for (
int i=1;
i<=m ;
i++)
306 {
307
308
309 int low =
MAX(1,
i - allowedInsertDelete);
310 int high =
MIN(n,
i + allowedInsertDelete);
311
313 {
316 if (direction>0)
c =
MAX(
c, H[
i-1][
j-1] + (((*A)[MOffset +
i-1]==(*B)[NOffset +
j-1]) ? w.match : w.misMatch));
317 else c =
MAX(
c, H[
i-1][
j-1] + (((*A)[MOffset + m-
i+0]==(*B)[NOffset + n-
j+0]) ? w.match : w.misMatch));
319 c =
MAX(
c, H[
i][
j-1] + w.insert);
322 {
324 maxCostPosition.first =
i;
325 maxCostPosition.second =
j;
326 }
327 }
328 }
329 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::rollCigar |
( |
CigarRoller & | cigar | ) |
|
|
inline |
Definition at line 696 of file SmithWaterman.h.
697 {
698 if (direction>0) rollCigarForward(
cigar);
699 else rollCigarBackward(
cigar);
700 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setAllowedInsertDelete |
( |
int | allowedInsertDelete = INT_MAX | ) |
|
|
inline |
Definition at line 281 of file SmithWaterman.h.
282 {
283 this->allowedInsertDelete = allowedInsertDelete;
284 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setDirection |
( |
int | direction | ) |
|
|
inline |
Definition at line 290 of file SmithWaterman.h.
291 {
292 this->direction = direction;
293 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setRead |
( |
Atype * | A | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReadLength |
( |
int | m | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReadOffset |
( |
readIndexType | MOffset | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReadQuality |
( |
QualityType * | qualities | ) |
|
|
inline |
Definition at line 238 of file SmithWaterman.h.
239 {
240 this->qualities = qualities;
241 }
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReference |
( |
Btype * | B | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReferenceLength |
( |
int | n | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| void SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::setReferenceOffset |
( |
referenceIndexType | NOffset | ) |
|
|
inline |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| Atype* SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::A |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| vector<pair<int,int> > SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::alignment |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::allowedInsertDelete |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| Btype* SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::B |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::direction |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::gapCloseCount |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::gapExtendCount |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::gapOpenCount |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| HCellType SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::H[maxReadLengthH][maxReferenceLengthH] |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::m |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| pair<int,int> SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::maxCostPosition |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| HCellType SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::maxCostValue |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| readIndexType SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::MOffset |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| int SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::n |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| referenceIndexType SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::NOffset |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| QualityType* SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::qualities |
template<int maxReadLengthH, int maxReferenceLengthH, typename HCellType, typename Atype, typename Btype, typename QualityType, typename readIndexType, typename referenceIndexType>
| weight SmithWaterman< maxReadLengthH, maxReferenceLengthH, HCellType, Atype, Btype, QualityType, readIndexType, referenceIndexType >::w |