7 * Created by Sarah Westcott on 5/7/09.
8 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
14 /**************************************************************************************************/
16 // this class calculates distances by ignoring all gap characters. so if seq a has an "A" and seq
17 // b has a '-', there is no penalty
19 class ignoreGaps : public Dist {
23 void calcDist(Sequence A, Sequence B){
29 string seqA = A.getAligned();
30 string seqB = B.getAligned();
31 int alignLength = seqA.length();
33 for(int i=0;i<alignLength;i++){
34 if(seqA[i] != '.' && seqB[i] != '.'){
41 for(int i=start; i<alignLength; i++){
42 if(seqA[i] == '.' || seqB[i] == '.'){
45 else if((seqA[i] != '-' && seqB[i] != '-')){
46 if(seqA[i] != seqB[i]){
53 //non-overlapping sequences
54 if (!overlap) { length = 0; }
56 if(length == 0) { dist = 1.0000; }
57 else { dist = ((double)diff / (double)length); }
63 /**************************************************************************************************/