8 * Created by Sarah Westcott on 6/29/09.
9 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
14 #include "sequence.hpp"
17 /***********************************************************************/
25 string getFilter() { return filter; }
26 void setFilter(string s) { filter = s; }
27 void setLength(int l) { alignmentLength = l; }
28 void setSoft(float s) { soft = s; }
29 void setTrump(float t) { trump = t; }
30 void setNumSeqs(int num) { numSeqs = num; }
31 vector<int> a, t, g, c, gap;
35 a.assign(alignmentLength, 0);
36 t.assign(alignmentLength, 0);
37 g.assign(alignmentLength, 0);
38 c.assign(alignmentLength, 0);
39 gap.assign(alignmentLength, 0);
43 int threshold = int (soft * numSeqs);
45 for(int i=0;i<alignmentLength;i++){
46 if(a[i] < threshold && t[i] < threshold && g[i] < threshold && c[i] < threshold){ filter[i] = 0; }
52 for(int i=0;i<alignmentLength;i++){
53 if(gap[i] == numSeqs) { filter[i] = '0'; }
58 void doTrump(Sequence seq) {
60 string curAligned = seq.getAligned();
62 for(int j = 0; j < alignmentLength; j++) {
63 if(curAligned[j] == trump){
70 void doHard(string hard) {
72 openInputFile(hard, fileHandle);
79 void getFreqs(Sequence seq) {
81 string curAligned = seq.getAligned();
83 for(int j=0;j<alignmentLength;j++){
84 if(toupper(curAligned[j]) == 'A') { a[j]++; }
85 else if(toupper(curAligned[j]) == 'T' || toupper(curAligned[j]) == 'U') { t[j]++; }
86 else if(toupper(curAligned[j]) == 'G') { g[j]++; }
87 else if(toupper(curAligned[j]) == 'C') { c[j]++; }
88 else if(curAligned[j] == '-' || curAligned[j] == '.') { gap[j]++; }
94 int alignmentLength, numSeqs;
100 /***********************************************************************/