]> git.donarmstrong.com Git - mothur.git/blobdiff - trimseqscommand.cpp
major change to the tree class to use the count table class instead of tree map....
[mothur.git] / trimseqscommand.cpp
index 3b9d195f34fa3e916ae9b3d92328195c1337579e..a90e7adc5c8cb870714c716b02bec5eb6bfddd73 100644 (file)
@@ -607,11 +607,11 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
 
                        Sequence currSeq(inFASTA); m->gobble(inFASTA);
                        //cout << currSeq.getName() << '\t' << currSeq.getUnaligned().length() << endl;
-            if (m->debug) { m->mothurOut("[DEBUG]: " + toString(count) + " fasta = " + currSeq.getName() + '\n'); }
+            
                        QualityScores currQual;
                        if(qFileName != ""){
                                currQual = QualityScores(qFile);  m->gobble(qFile);
-                 if (m->debug) { m->mothurOut("[DEBUG]: qual = " + currQual.getName() + '\n'); }
+                //cout << currQual.getName() << endl;
                        }
                        
                        string origSeq = currSeq.getUnaligned();
@@ -883,6 +883,8 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName
                                                                 tempNameFileNames,
                                                                 lines[process],
                                                                 qLines[process]);
+                
+                if (m->debug) { m->mothurOut("[DEBUG]: " + toString(lines[process].start) + '\t' + toString(qLines[process].start) + '\t' + toString(getpid()) + '\n'); }
                                
                                //pass groupCounts to parent
                                if(createGroup){
@@ -1253,7 +1255,9 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                while(!inOligos.eof()){
 
                        inOligos >> type; 
-                                       
+            
+                       if (m->debug) { m->mothurOut("[DEBUG]: reading type - " + type + ".\n"); }      
+            
                        if(type[0] == '#'){
                                while (!inOligos.eof()) {       char c = inOligos.get();  if (c == 10 || c == 13){      break;  }       } // get rest of line if there's any crap there
                                m->gobble(inOligos);
@@ -1264,6 +1268,8 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                                for(int i=0;i<type.length();i++){       type[i] = toupper(type[i]);  }
                                
                                inOligos >> oligo;
+                
+                if (m->debug) { m->mothurOut("[DEBUG]: reading - " + oligo + ".\n"); }
                                
                                for(int i=0;i<oligo.length();i++){
                                        oligo[i] = toupper(oligo[i]);
@@ -1285,6 +1291,8 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                                        map<string, int>::iterator itPrime = primers.find(oligo);
                                        if (itPrime != primers.end()) { m->mothurOut("primer " + oligo + " is in your oligos file already."); m->mothurOutEndLine();  }
                                        
+                    if (m->debug) {  if (group != "") { m->mothurOut("[DEBUG]: reading group " + group + ".\n"); }else{ m->mothurOut("[DEBUG]: no group for primer " + oligo + ".\n"); }  }
+                    
                                        primers[oligo]=indexPrimer; indexPrimer++;              
                                        primerNameVector.push_back(group);
                                }
@@ -1309,15 +1317,22 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                                        
                     //then this is illumina data with 4 columns
                     if (temp != "") {  
-                        string reverseBarcode = reverseOligo(group); //reverse barcode
-                        group = temp;
                         
+                        for(int i=0;i<group.length();i++){
+                            group[i] = toupper(group[i]);
+                            if(group[i] == 'U')        {       group[i] = 'T'; }
+                        }
+                        
+                        if (m->debug) { m->mothurOut("[DEBUG]: reading reverse " + group + ", and group = " + temp + ".\n"); }
+                        
+                        string reverseBarcode = reverseOligo(group); //reverse barcode
                         //check for repeat barcodes
                         map<string, int>::iterator itBar = rbarcodes.find(reverseBarcode);
-                        if (itBar != rbarcodes.end()) { m->mothurOut("barcode " + reverseBarcode + " is in your oligos file already."); m->mothurOutEndLine();  }
-                                               
+                        if (itBar != rbarcodes.end()) { m->mothurOut("reverse barcode " + group + " is in your oligos file already."); m->mothurOutEndLine();  }
+                        
+                        group = temp;
                         rbarcodes[reverseBarcode]=indexBarcode; 
-                    }
+                    }else { if (m->debug) { m->mothurOut("[DEBUG]: reading group " + group + ".\n"); } }
                         
                                        //check for repeat barcodes
                                        map<string, int>::iterator itBar = barcodes.find(oligo);
@@ -1330,7 +1345,7 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                                }else if(type == "SPACER"){
                                        spacer.push_back(oligo);
                                }
-                               else{   m->mothurOut(type + " is not recognized as a valid type. Choices are forward, reverse, and barcode. Ignoring " + oligo + "."); m->mothurOutEndLine();  }
+                               else{   m->mothurOut("[WARNING]: " + type + " is not recognized as a valid type. Choices are forward, reverse, and barcode. Ignoring " + oligo + "."); m->mothurOutEndLine(); }
                        }
                        m->gobble(inOligos);
                }       
@@ -1436,7 +1451,7 @@ bool TrimSeqsCommand::getOligos(vector<vector<string> >& fastaFileNames, vector<
                                break;
                        }
                }
-               
+
                if (allBlank) {
                        m->mothurOut("[WARNING]: your oligos file does not contain any group names.  mothur will not create a groupfile."); m->mothurOutEndLine();
                        allFiles = false;