X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sequence.cpp;h=9cdbfb91cf6ba148dbf4e2f5b4252b33604c906c;hb=9aa36ad8297141ef9fcab04fea10e96d2fed26fe;hp=162d3be9e69d0f86f7e4f2122c3c914b613392c3;hpb=3094cb29c613d9687e861e1d0cf9104b7141d24e;p=mothur.git diff --git a/sequence.cpp b/sequence.cpp index 162d3be..9cdbfb9 100644 --- a/sequence.cpp +++ b/sequence.cpp @@ -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(){