X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=onegapignore.h;h=fdbc196e9f2f7ff539a9b61bf35a8120483ac66b;hp=af284fcc6857a3c5a42545ca6c78c22cded9424d;hb=cf9987b67aa49777a4c91c2d21f96e58bf17aa82;hpb=e4ca037c5e637e3d34e64cb5e8ab11b03220188d diff --git a/onegapignore.h b/onegapignore.h index af284fc..fdbc196 100644 --- a/onegapignore.h +++ b/onegapignore.h @@ -17,6 +17,9 @@ class oneGapIgnoreTermGapDist : public Dist { public: + + oneGapIgnoreTermGapDist() {} + void calcDist(Sequence A, Sequence B){ int difference = 0; @@ -25,6 +28,7 @@ public: int minLength = 0; int start = 0; int end = 0; + bool overlap = false; string seqA = A.getAligned(); string seqB = B.getAligned(); @@ -34,14 +38,16 @@ public: for(int i=0;i=0;i--){ if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){ end = i; - cout << "end: " << end << endl; +// cout << "end: " << end << endl; + overlap = true; break; } } @@ -73,7 +79,10 @@ public: openGapB = 0; } } - + + //non-overlapping sequences + if (!overlap) { minLength = 0; } + if(minLength == 0) { dist = 1.0000; } else { dist = (double)difference / minLength; } }