]> git.donarmstrong.com Git - mothur.git/commitdiff
finished adding the names option to trim.seqs
authorwestcott <westcott>
Fri, 20 May 2011 10:48:01 +0000 (10:48 +0000)
committerwestcott <westcott>
Fri, 20 May 2011 10:48:01 +0000 (10:48 +0000)
getgroupscommand.cpp
removegroupscommand.cpp
seqerrorcommand.cpp
seqerrorcommand.h
trimseqscommand.cpp

index e38ac9bc3c683eff7b0915b7fa450d1858b793fe..37e5d404b4c39765ff17be9a087c03183abff391 100644 (file)
@@ -241,11 +241,9 @@ int GetGroupsCommand::execute(){
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
                m->mothurOut("Selected " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
-               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i])) + " sequences."); m->mothurOutEndLine(); }
+               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
                m->mothurOutEndLine();
                
-               
-               
                if (outputNames.size() != 0) {
                        m->mothurOutEndLine();
                        m->mothurOut("Output File names: "); m->mothurOutEndLine();
index 5a70b27456e782ddba0ab0c2a133ad1d9831a540..7034941e73e6a02ae07a02ab11631e8a7b752f3d 100644 (file)
@@ -243,7 +243,7 @@ int RemoveGroupsCommand::execute(){
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
                m->mothurOut("Removed " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
-               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i])) + " sequences."); m->mothurOutEndLine(); }
+               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
                m->mothurOutEndLine();
                
                if (outputNames.size() != 0) {
index 2bb0e57566e59b39a04ce4b4968086894bf64355..d06a5addf90f74334224a4220e64ea4f0320dedf 100644 (file)
@@ -22,6 +22,7 @@ vector<string> SeqErrorCommand::setParameters(){
                CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
                CommandParameter pignorechimeras("ignorechimeras", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pignorechimeras);
                CommandParameter pthreshold("threshold", "Number", "", "1.0", "", "", "",false,false); parameters.push_back(pthreshold);
+               CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
                CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
                CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
                
@@ -200,6 +201,10 @@ SeqErrorCommand::SeqErrorCommand(string option)  {
                        
                        temp = validParameter.validFile(parameters, "ignorechimeras", false);   if (temp == "not found") { temp = "1"; }
                        convert(temp, ignoreChimeras);  
+                       
+                       temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = m->getProcessors();      }
+                       m->setProcessors(temp);
+                       convert(temp, processors); 
 
                        substitutionMatrix.resize(6);
                        for(int i=0;i<6;i++){   substitutionMatrix[i].resize(6,0);      }
index a47f182e1157fc8c76e247451a520b7b696f530f..7e87ec63eb209a184f7036fafeeb35184fef9b90 100644 (file)
@@ -70,7 +70,7 @@ private:
        string queryFileName, referenceFileName, qualFileName, reportFileName, namesFileName, outputDir;
        double threshold;
        bool ignoreChimeras;
-       int numRefs;
+       int numRefs, processors;
        int maxLength;
        ofstream errorSummaryFile, errorSeqFile;
        vector<string> outputNames;
index ed84cc0c60d404b0d7c12eb0c3751a2e2a601706..64522a5f157820e529b3261d0acaf898f32136b6 100644 (file)
@@ -432,8 +432,9 @@ int TrimSeqsCommand::execute(){
                //output group counts
                m->mothurOutEndLine();
                int total = 0;
+               if (groupCounts.size() != 0) {  m->mothurOut("Group count: \n");  }
                for (map<string, int>::iterator it = groupCounts.begin(); it != groupCounts.end(); it++) {
-                        total += it->second; m->mothurOut("Group " + it->first + " contains " + toString(it->second) + " sequences."); m->mothurOutEndLine(); 
+                        total += it->second; m->mothurOut(it->first + "\t" + toString(it->second)); m->mothurOutEndLine(); 
                }
                if (total != 0) { m->mothurOut("Total of all groups is " + toString(total)); m->mothurOutEndLine(); }
                
@@ -650,6 +651,17 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                                
                                                outGroupsFile << currSeq.getName() << '\t' << thisGroup << endl;
                                                
+                                               if (nameFile != "") {
+                                                       map<string, string>::iterator itName = nameMap.find(currSeq.getName());
+                                                       if (itName != nameMap.end()) { 
+                                                               vector<string> thisSeqsNames; 
+                                                               m->splitAtChar(itName->second, thisSeqsNames, ',');
+                                                               for (int k = 1; k < thisSeqsNames.size(); k++) { //start at 1 to skip self
+                                                                       outGroupsFile << thisSeqsNames[k] << '\t' << thisGroup << endl;
+                                                               }
+                                                       }else { m->mothurOut("[ERROR]: " + currSeq.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); }                                                   
+                                               }
+                                               
                                                map<string, int>::iterator it = groupCounts.find(thisGroup);
                                                if (it == groupCounts.end()) {  groupCounts[thisGroup] = 1; }
                                                else { groupCounts[it->first]++; }