- Sequence* tempsub = new Sequence(subject->getName(), seqFragsub);
- subjectFragment.push_back(tempsub);
-
- startpoint += increment;
- }
-
-
- for(int j = 0; j < iters; j++){
-
- distCalculator->calcDist(*(queryFragment[j]), *(subjectFragment[j]));
- float dist = distCalculator->getDist();
-
- //convert to similiarity
- //dist = 1 - dist;
+
+ int diff = 0;
+ for (int b = 0; b < seqFrag.length(); b++) {
+
+ //if this is not a gap
+ if ((isalpha(seqFrag[b])) && (isalpha(seqFragsub[b]))) {
+ //and they are different - penalize
+ if (seqFrag[b] != seqFragsub[b]) { diff++; }
+ }
+ }
+
+ //percentage of mismatched bases
+ float dist = diff / (float)seqFrag.length();