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 {
20 void calcDist(Sequence A, Sequence B){
30 string seqA = A.getAligned();
31 string seqB = B.getAligned();
32 int alignLength = seqA.length();
34 // this assumes that sequences start and end with '.'s instead of'-'s.
35 for(int i=0;i<alignLength;i++){
36 if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){
38 // cout << "start: " << start << endl;
43 for(int i=alignLength-1;i>=0;i--){
44 if(seqA[i] != '.' && seqB[i] != '.' && seqA[i] != '-' && seqB[i] != '-' ){
46 // cout << "end: " << end << endl;
52 for(int i=start;i<=end;i++){
53 if(seqA[i] == '-' && seqB[i] == '-'){ ; }
54 else if(seqB[i] != '-' && seqA[i] == '-'){
62 else if(seqA[i] != '-' && seqB[i] == '-'){
70 else if(seqA[i] != '-' && seqB[i] != '-'){
71 if(seqA[i] != seqB[i]){
80 //non-overlapping sequences
81 if (!overlap) { minLength = 0; }
83 if(minLength == 0) { dist = 1.0000; }
84 else { dist = (double)difference / minLength; }
89 /**************************************************************************************************/