1 #ifndef ONEIGNOREGAPS_H
2 #define ONEIGNOREGAPS_H
7 * Created by Sarah Westcott on 5/7/09.
8 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
15 /**************************************************************************************************/
17 class oneGapIgnoreTermGapDist : public Dist {
21 oneGapIgnoreTermGapDist() {}
23 void calcDist(Sequence A, Sequence B){
33 string seqA = A.getAligned();
34 string seqB = B.getAligned();
35 int alignLength = seqA.length();
37 // this assumes that sequences start and end with '.'s instead of'-'s.
38 for(int i=0;i<alignLength;i++){
39 if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){
41 // cout << "start: " << start << endl;
46 for(int i=alignLength-1;i>=0;i--){
47 if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){
49 // cout << "end: " << end << endl;
55 for(int i=start;i<=end;i++){
56 if(seqA[i] == '-' && seqB[i] == '-'){ ; }
57 else if(seqB[i] != '-' && seqA[i] == '-'){
65 else if(seqA[i] != '-' && seqB[i] == '-'){
73 else if(seqA[i] != '-' && seqB[i] != '-'){
74 if(seqA[i] != seqB[i]){
83 //non-overlapping sequences
84 if (!overlap) { minLength = 0; }
86 if(minLength == 0) { dist = 1.0000; }
87 else { dist = (double)difference / minLength; }
92 /**************************************************************************************************/