]> git.donarmstrong.com Git - mothur.git/commitdiff
finished chimera changes
authorwestcott <westcott>
Wed, 24 Feb 2010 11:07:33 +0000 (11:07 +0000)
committerwestcott <westcott>
Wed, 24 Feb 2010 11:07:33 +0000 (11:07 +0000)
chimera.cpp
chimera.h
chimeraseqscommand.cpp
pintail.cpp
sharedcommand.cpp

index 85b0b38c8daab23e44c5c676ed1f38009afb7a62..e7253ec27d25c47157527c0f386ffb84fba4d55d 100644 (file)
@@ -47,7 +47,7 @@ string Chimera::createFilter(vector<Sequence*> seqs, float t) {
                        if(gaps[i] == seqs.size())      {       filterString[i] = '0';  numColRemoved++;  }
                        
                        else if (((a[i] < threshold) && (t[i] < threshold) && (g[i] < threshold) && (c[i] < threshold))) {      filterString[i] = '0';  numColRemoved++;  }
-                       cout << "a = " << a[i] <<  " t = " << t[i] <<  " g = " << g[i] <<  " c = " << c[i] << endl;
+                       //cout << "a = " << a[i] <<  " t = " << t[i] <<  " g = " << g[i] <<  " c = " << c[i] << endl;
                }
 
                mothurOut("Filter removed " + toString(numColRemoved) + " columns.");  mothurOutEndLine();
index f893d63ed9c57e7d53d84843cb3b647cc9dd89d6..8c00aecf720433bec4610968bc1c227bc93d5a03 100644 (file)
--- a/chimera.h
+++ b/chimera.h
@@ -92,7 +92,7 @@ class Chimera {
                Chimera(string);
                Chimera(string, bool, string);
                Chimera(string, string);
-               virtual ~Chimera(){};
+               virtual ~Chimera(){     for (int i = 0; i < templateSeqs.size(); i++) { delete templateSeqs[i];  } };
                virtual void setFilter(bool f)                  {       filter = f;                     }
                virtual void setCorrection(bool c)              {       correction = c;         }
                virtual void setProcessors(int p)               {       processors = p;         }
@@ -111,9 +111,8 @@ class Chimera {
                virtual void setMinBS(int b)                    {       minBS = b;                      }
                virtual void setMinSNP(int s)                   {       minSNP = s;                     }
                virtual void setIters(int i)                    {       iters = i;                      }
-               virtual void setTemplateSeqs(vector<Sequence*> t)       {       templateSeqs = t;       }
                virtual bool getUnaligned()                             {       return unaligned;                       }
-               virtual void setTemplateFile(string t)  {   templateFileName = t;       }
+               virtual void setTemplateFile(string t)  {   templateFileName = t;       templateSeqs = readSeqs(t);  }
                virtual int getLength()                                 {   return length;      }
                
                virtual void setCons(string){};
index d34149d1e74fb8738a89133fc9e343268ef9121f..1758cf682fad21efcd0201b0b50b0ada7857d100 100644 (file)
@@ -315,20 +315,12 @@ int ChimeraSeqsCommand::execute(){
                string accnosFileName = outputDir + getRootName(getSimpleName(fastafile)) + method + maskfile + ".accnos";
 
                
-               vector<Sequence*> templateSeqs;
                if ((method != "bellerophon") && (method != "chimeracheck")) {   
-                       templateSeqs = chimera->readSeqs(templatefile);   
                        if (chimera->getUnaligned()) { 
                                mothurOut("Your template sequences are different lengths, please correct."); mothurOutEndLine(); 
-                               //free memory
-                               for (int i = 0; i < templateSeqs.size(); i++)           {  delete templateSeqs[i];              }
                                delete chimera;
                                return 0; 
                        }
-                       
-                       //set options
-                       chimera->setTemplateSeqs(templateSeqs);
-
                }else if (method == "bellerophon") {//run bellerophon separately since you need to read entire fastafile to run it
                        chimera->getChimeras();
                        
@@ -435,7 +427,6 @@ int ChimeraSeqsCommand::execute(){
                remove(outputFileName.c_str());
                rename(tempHeader.c_str(), outputFileName.c_str());
        
-               for (int i = 0; i < templateSeqs.size(); i++)           {  delete templateSeqs[i];      } 
                delete chimera;
                
                if (method == "chimeracheck") { remove(accnosFileName.c_str());  mothurOutEndLine(); mothurOut("This method does not determine if a sequence is chimeric, but allows you to make that determination based on the IS values."); mothurOutEndLine();  }
index 63a90148699985581c80febe11288a99d5cd87bf..90c97c5e77d50f478aeb1b4bb7b1fa28713ee468 100644 (file)
@@ -80,8 +80,6 @@ void Pintail::doPrep() {
                bool reRead = false;
                //create filter if needed for later
                if (filter) {
-                       
-cout << "filter" << endl;                      
                                                
                        //read in all query seqs
                        ifstream in; 
@@ -100,10 +98,9 @@ cout << "filter" << endl;
                        //merge query seqs and template seqs
                        temp = templateSeqs;
                        for (int i = 0; i < tempQuerySeqs.size(); i++) {  temp.push_back(tempQuerySeqs[i]);  }
-cout << temp.size() << endl;   
+       
                        if (seqMask != "") {
                            reRead = true;
-       cout << "masked "  << seqMask << endl;
                                //mask templates
                                for (int i = 0; i < temp.size(); i++) {
                                        decalc->runMask(temp[i]);
@@ -111,9 +108,9 @@ cout << temp.size() << endl;
                        }
 
                        mergedFilterString = createFilter(temp, 0.5);
-       cout << "here" << endl;         
+                       
                        //reread template seqs
-                       //for (int i = 0; i < tempQuerySeqs.size(); i++) { delete tempQuerySeqs[i];  }
+                       for (int i = 0; i < tempQuerySeqs.size(); i++) { delete tempQuerySeqs[i];  }
                }
                
                
index 1fe2300387a96e81500a0b41c76190df02aba935..4cc0ea73b6a4a561ce0a511ca5cbb5da4b9d581c 100644 (file)
@@ -289,6 +289,9 @@ void SharedCommand::createMisMatchFile() {
                        
                        openOutputFile(outputMisMatchName, outMisMatch);
                        
+                       map<string, string> listNames;
+                       map<string, string>::iterator itList;
+                       
                        //go through list and if group returns "not found" output it
                        for (int i = 0; i < SharedList->getNumBins(); i++) {
                        
@@ -298,13 +301,22 @@ void SharedCommand::createMisMatchFile() {
                                        string name = names.substr(0,names.find_first_of(','));
                                        names = names.substr(names.find_first_of(',')+1, names.length());
                                        string group = groupMap->getGroup(name);
-                               
+                                       
                                        if(group == "not found") {      outMisMatch << name << endl;  }
+                                       
+                                       itList = listNames.find(name);
+                                       if (itList != listNames.end()) {  mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                                       else { listNames[name] = name; }
                                }
                        
                                //get last name
                                string group = groupMap->getGroup(names);
-                               if(group == "not found") {      outMisMatch << names << endl;  }                                
+                               if(group == "not found") {      outMisMatch << names << endl;  }        
+                               
+                               itList = listNames.find(names);
+                               if (itList != listNames.end()) {  mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                               else { listNames[names] = names; }
+
                        }
                        
                        outMisMatch.close();
@@ -316,6 +328,7 @@ void SharedCommand::createMisMatchFile() {
                        mothurOut("For a list of names that are in your group file and not in your list file, please refer to " + outputMisMatchName + "."); mothurOutEndLine();
                        
                        map<string, string> namesInList;
+                       map<string, string>::iterator itList;
                        
                        //go through listfile and get names
                        for (int i = 0; i < SharedList->getNumBins(); i++) {
@@ -326,9 +339,16 @@ void SharedCommand::createMisMatchFile() {
                                        string name = names.substr(0,names.find_first_of(','));
                                        names = names.substr(names.find_first_of(',')+1, names.length());
                                        
+                                       itList = namesInList.find(name);
+                                       if (itList != namesInList.end()) {  mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+
                                        namesInList[name] = name;
+                                       
                                }
                                
+                               itList = namesInList.find(names);
+                               if (itList != namesInList.end()) {  mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+
                                //get last name
                                namesInList[names] = names;                             
                        }