]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed a trimming bug in sffinfo which occurs when the right trim point is smaller...
authorpschloss <pschloss>
Thu, 12 Aug 2010 14:53:23 +0000 (14:53 +0000)
committerpschloss <pschloss>
Thu, 12 Aug 2010 14:53:23 +0000 (14:53 +0000)
sffinfocommand.cpp

index 0e860db9df44f7c5a4380469ff823c0bd999c82b..4e53f69cb3e7dd51c3d4b30c10a09d76339b6f2c 100644 (file)
@@ -587,7 +587,10 @@ int SffInfoCommand::printFastaSeqData(ofstream& out, seqRead& read, Header& head
                string seq = read.bases;
                
                if (trim) {
-                       if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){
+                       if(header.clipQualRight < header.clipQualLeft){
+                               seq = "NNNN";
+                       }
+                       else if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){
                                seq = seq.substr((header.clipQualLeft-1), (header.clipQualRight-header.clipQualLeft));
                        }
                        else {
@@ -620,7 +623,10 @@ int SffInfoCommand::printQualSeqData(ofstream& out, seqRead& read, Header& heade
        try {
                
                if (trim) {
-                       if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){
+                       if(header.clipQualRight < header.clipQualLeft){
+                               out << "0\t0\t0\t0";
+                       }
+                       else if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){
                                out << ">" << header.name << " length=" << (header.clipQualRight-header.clipQualLeft) << endl;
                                for (int i = (header.clipQualLeft-1); i < (header.clipQualRight-1); i++) {   out << read.qualScores[i] << '\t'; }
                        }