]> git.donarmstrong.com Git - mothur.git/blobdiff - sequence.cpp
added keep dots to pcr.seqs. fixed pre.cluster name file name when group option is...
[mothur.git] / sequence.cpp
index 162d3be9e69d0f86f7e4f2122c3c914b613392c3..9cdbfb91cf6ba148dbf4e2f5b4252b33604c906c 100644 (file)
@@ -571,7 +571,45 @@ void Sequence::padToPos(int start){
        startPos = start;
 
 }
+//********************************************************************************************************************
 
+int Sequence::filterToPos(int start){
+    
+    if (start > aligned.length()) { start = aligned.length(); m->mothurOut("[ERROR]: start to large.\n"); }
+    
+       for(int j = 0; j < start-1; j++) {
+               aligned[j] = '.';
+       }
+       
+    //things like ......----------AT become ................AT
+    for(int j = start-1; j < aligned.length(); j++) {
+        if (isalpha(aligned[j])) { break; }
+        else { aligned[j] = '.'; }
+    }
+    setUnaligned(aligned);
+    
+    return 0;
+    
+}
+//********************************************************************************************************************
+
+int Sequence::filterFromPos(int end){
+    
+    if (end > aligned.length()) { end = aligned.length(); m->mothurOut("[ERROR]: end to large.\n"); }
+    
+       for(int j = end; j < aligned.length(); j++) {
+               aligned[j] = '.';
+       }
+       
+    for(int j = aligned.length()-1; j < 0; j--) {
+        if (isalpha(aligned[j])) { break; }
+        else { aligned[j] = '.'; }
+    }
+    
+    setUnaligned(aligned);
+    
+    return 0;
+}
 //********************************************************************************************************************
 
 int Sequence::getEndPos(){
@@ -591,7 +629,7 @@ int Sequence::getEndPos(){
 //********************************************************************************************************************
 
 void Sequence::padFromPos(int end){
-       
+       cout << end << '\t' << endPos << endl;
        for(int j = end; j < endPos; j++) {
                aligned[j] = '.';
        }
@@ -604,7 +642,6 @@ void Sequence::padFromPos(int end){
 bool Sequence::getIsAligned(){
        return isAligned;
 }
-
 //********************************************************************************************************************
 
 void Sequence::reverseComplement(){