]> git.donarmstrong.com Git - mothur.git/blobdiff - ignoregaps.h
changed random forest output filename
[mothur.git] / ignoregaps.h
index e81ab92e2aaaced862fad7ae0e2f14cdf1d9f386..894f92d9644182ece0a7d18e491384d2058f2d54 100644 (file)
@@ -20,10 +20,13 @@ class ignoreGaps : public Dist {
        
 public:
        
+       ignoreGaps() {}
+       
        void calcDist(Sequence A, Sequence B){          
                int diff = 0;
                int length = 0;
                int start = 0;
+               bool overlap = false;
                
                string seqA = A.getAligned();
                string seqB = B.getAligned();
@@ -32,6 +35,7 @@ public:
                for(int i=0;i<alignLength;i++){
                        if(seqA[i] != '.' && seqB[i] != '.'){
                                start = i;
+                               overlap = true;
                                break;
                        }
                }
@@ -47,6 +51,9 @@ public:
                                length++;
                        }
                }
+               
+               //non-overlapping sequences
+               if (!overlap) { length = 0; }
 
                if(length == 0)         {       dist = 1.0000;                                                          }
                else                            {       dist = ((double)diff  / (double)length);        }