]> git.donarmstrong.com Git - mothur.git/commitdiff
another pds fix to sffinfo
authorpschloss <pschloss>
Thu, 29 Jul 2010 06:05:49 +0000 (06:05 +0000)
committerpschloss <pschloss>
Thu, 29 Jul 2010 06:05:49 +0000 (06:05 +0000)
sffinfocommand.cpp

index cb5f87410e64583afa710ba034448e15cffb8fd1..bbfcfd4510443de7edc42b7527083a52fc032728 100644 (file)
@@ -410,6 +410,7 @@ int SffInfoCommand::readHeader(ifstream& in, Header& header){
                        char buffer5 [2];
                        in.read(buffer5, 2);
                        header.clipQualRight =  be_int2(*(unsigned short *)(&buffer5));
+                       if(header.clipQualRight == 0){  header.clipQualRight = numBases;        }
                        
                        //read clipAdapterLeft
                        char buffer6 [2];
@@ -585,22 +586,14 @@ int SffInfoCommand::printFastaSeqData(ofstream& out, seqRead& read, Header& head
                string seq = read.bases;
                
                if (trim) {
-                       if(header.clipQualRight != 0){
-                               seq = seq.substr((header.clipQualLeft-1), (header.clipQualRight-header.clipQualLeft+1));
-                       }
-                       else{
-                               seq = seq.substr(header.clipQualLeft-1);
-                       }
+                       seq = seq.substr((header.clipQualLeft-1), (header.clipQualRight-header.clipQualLeft+1));
                }else{
                        //if you wanted the sfftxt then you already converted the bases to the right case
                        if (!sfftxt) {
                                //make the bases you want to clip lowercase and the bases you want to keep upper case
                                for (int i = 0; i < (header.clipQualLeft-1); i++) { seq[i] = tolower(seq[i]);  }
                                for (int i = (header.clipQualLeft-1); i < (header.clipQualRight-1); i++)  {   seq[i] = toupper(seq[i]);  }
-                               
-                               if(header.clipQualRight != 0){
-                                       for (int i = (header.clipQualRight-1); i < seq.length(); i++) {   seq[i] = tolower(seq[i]);  }
-                               }
+                               for (int i = (header.clipQualRight-1); i < seq.length(); i++) {   seq[i] = tolower(seq[i]);  }
                        }
                }