X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=onegapignore.h;h=6421741c0d4c153794ab40efc9318af6d64349a4;hb=786d5631d9cd5baa6ed6ef16f8b4b384cbc7470f;hp=ee6cc5267931816a654c99f4e748d19bb2940901;hpb=b01e4c8527e66f227eff16cf296eeadf060306b6;p=mothur.git diff --git a/onegapignore.h b/onegapignore.h index ee6cc52..6421741 100644 --- a/onegapignore.h +++ b/onegapignore.h @@ -25,27 +25,27 @@ public: int start = 0; int end = 0; - for(int i=0;i=0;i--){ - if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){ - } - else{ + for(int i=alignLength-1;i>=0;i--){ + if(seqA[i] != '.' && seqB[i] != '.'){ end = i; break; } } - for(int i=start;i<=end;i++){ - if(A.getAligned()[i] == '-' && B.getAligned()[i] == '-'){} - else if(A.getAligned()[i] == '-' && B.getAligned()[i] != '-'){ + if(seqA[i] == '-' && seqB[i] == '-'){ ; } + else if(seqB[i] != '-' && seqA[i] == '-'){ if(openGapA == 0){ difference++; minLength++; @@ -53,7 +53,7 @@ public: openGapB = 0; } } - else if(A.getAligned()[i] != '-' && B.getAligned()[i] == '-'){ + else if(seqA[i] != '-' && seqB[i] == '-'){ if(openGapB == 0){ difference++; minLength++; @@ -61,20 +61,16 @@ public: openGapB = 1; } } - else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){ - if(A.getAligned()[i] != B.getAligned()[i]){ + else if(seqA[i] != '-' && seqB[i] != '-'){ + if(seqA[i] != seqB[i]){ difference++; - minLength++; - openGapA = 0; - openGapB = 0; - } - else{ - minLength++; - openGapA = 0; - openGapB = 0; } + minLength++; + openGapA = 0; + openGapB = 0; } } + if(minLength == 0) { dist = 1.0000; } else { dist = (double)difference / minLength; } }