X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=onegapignore.h;h=dba3f38292ced957330631ece5572901ee3438ae;hb=d3aed959ca3b68890eeb7b815e24210bcfeb256c;hp=785272e08c69a3e1491d5d1d2792bbc9ba3eda5d;hpb=f2d22832d127f781989c98457f42e94aea96075f;p=mothur.git diff --git a/onegapignore.h b/onegapignore.h index 785272e..dba3f38 100644 --- a/onegapignore.h +++ b/onegapignore.h @@ -17,6 +17,10 @@ class oneGapIgnoreTermGapDist : public Dist { public: + + oneGapIgnoreTermGapDist() {} + oneGapIgnoreTermGapDist(const oneGapIgnoreTermGapDist& ddb) {} + void calcDist(Sequence A, Sequence B){ int difference = 0; @@ -25,6 +29,7 @@ public: int minLength = 0; int start = 0; int end = 0; + bool overlap = false; string seqA = A.getAligned(); string seqB = B.getAligned(); @@ -35,6 +40,7 @@ public: if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){ start = i; // cout << "start: " << start << endl; + overlap = true; break; } } @@ -42,6 +48,7 @@ public: if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){ end = i; // cout << "end: " << end << endl; + overlap = true; break; } } @@ -73,7 +80,10 @@ public: openGapB = 0; } } - + + //non-overlapping sequences + if (!overlap) { minLength = 0; } + if(minLength == 0) { dist = 1.0000; } else { dist = (double)difference / minLength; } }