X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=gotohoverlap.cpp;h=ea27df07068a5e2060d3a1be4220a9b2de57822c;hp=57d884bf5f17a1d00a524c52997dac751f47fe81;hb=d1c97b8c04bb75faca1e76ffad60b37a4d789d3d;hpb=526a868606faa50caf86e7399f7554c0335b39e5 diff --git a/gotohoverlap.cpp b/gotohoverlap.cpp index 57d884b..ea27df0 100644 --- a/gotohoverlap.cpp +++ b/gotohoverlap.cpp @@ -17,7 +17,6 @@ * */ -using namespace std; #include "alignmentcell.hpp" #include "overlap.hpp" @@ -26,65 +25,78 @@ using namespace std; /**************************************************************************************************/ -GotohOverlap::GotohOverlap(float gO, float gE, float m, float mm, int r) : - gapOpen(gO), gapExtend(gE), match(m), mismatch(mm), Alignment(r) { +GotohOverlap::GotohOverlap(float gO, float gE, float f, float mm, int r) : + gapOpen(gO), gapExtend(gE), match(f), mismatch(mm), Alignment(r) { - for(int i=1;ierrorOut(e, "GotohOverlap", "GotohOverlap"); + exit(1); } } /**************************************************************************************************/ void GotohOverlap::align(string A, string B){ - - seqA = ' ' + A; lA = seqA.length(); // the algorithm requires that the first character be a dummy value - seqB = ' ' + B; lB = seqB.length(); // the algorithm requires that the first character be a dummy value - - for(int i=1;i alignment[i][j].dValue){ - if(alignment[i][j].iValue > diagonal){ - alignment[i][j].cValue = alignment[i][j].iValue; - alignment[i][j].prevCell = 'l'; + try { + seqA = ' ' + A; lA = seqA.length(); // the algorithm requires that the first character be a dummy value + seqB = ' ' + B; lB = seqB.length(); // the algorithm requires that the first character be a dummy value + + for(int i=1;i alignment[i][j].dValue){ + if(alignment[i][j].iValue > diagonal){ + alignment[i][j].cValue = alignment[i][j].iValue; + alignment[i][j].prevCell = 'l'; + } + else{ + alignment[i][j].cValue = diagonal; + alignment[i][j].prevCell = 'd'; + } } else{ - alignment[i][j].cValue = diagonal; - alignment[i][j].prevCell = 'd'; + if(alignment[i][j].dValue > diagonal){ + alignment[i][j].cValue = alignment[i][j].dValue; + alignment[i][j].prevCell = 'u'; + } + else{ + alignment[i][j].cValue = diagonal; + alignment[i][j].prevCell = 'd'; + } } + } - else{ - if(alignment[i][j].dValue > diagonal){ - alignment[i][j].cValue = alignment[i][j].dValue; - alignment[i][j].prevCell = 'u'; - } - else{ - alignment[i][j].cValue = diagonal; - alignment[i][j].prevCell = 'd'; - } - } - } + Overlap over; + over.setOverlap(alignment, lA, lB, 0); // Fix the gaps at the ends of the sequences + traceBack(); // Construct the alignment and set seqAaln and seqBaln + + } + catch(exception& e) { + m->errorOut(e, "GotohOverlap", "align"); + exit(1); } - Overlap over; - over.setOverlap(alignment, lA, lB, 0); // Fix the gaps at the ends of the sequences - traceBack(); // Construct the alignment and set seqAaln and seqBaln } /**************************************************************************************************/