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 {
25 void calcDist(Sequence A, Sequence B){
31 string seqA = A.getAligned();
32 string seqB = B.getAligned();
33 int alignLength = seqA.length();
35 for(int i=0;i<alignLength;i++){
36 if(seqA[i] != '.' && seqB[i] != '.'){
43 for(int i=start; i<alignLength; i++){
44 if(seqA[i] == '.' || seqB[i] == '.'){
47 else if((seqA[i] != '-' && seqB[i] != '-')){
48 if(seqA[i] != seqB[i]){
55 //non-overlapping sequences
56 if (!overlap) { length = 0; }
58 if(length == 0) { dist = 1.0000; }
59 else { dist = ((double)diff / (double)length); }
65 /**************************************************************************************************/