]> git.donarmstrong.com Git - mothur.git/commitdiff
1.19.0
authorwestcott <westcott>
Mon, 9 May 2011 11:54:45 +0000 (11:54 +0000)
committerwestcott <westcott>
Mon, 9 May 2011 11:54:45 +0000 (11:54 +0000)
chimeraslayer.cpp
chimeraslayercommand.cpp
getoturepcommand.cpp
maligner.cpp
slayer.cpp
trimseqscommand.cpp

index 423f7c0e713eef53a8904c2dcaff49a35844f35f..729ef1f854fa445aed5a84b5ca5b90a3b2255aaa 100644 (file)
@@ -773,7 +773,7 @@ int ChimeraSlayer::getChimeras(Sequence* query) {
                for (int i = 0; i < refSeqs.size(); i++) {  delete refSeqs[i];  }
                
                if (chimeraFlag == "yes") {
-
+                       
                        if (realign) {
                                vector<string> parents;
                                for (int i = 0; i < Results.size(); i++) {
@@ -1113,7 +1113,8 @@ vector<Sequence*> ChimeraSlayer::getBlastSeqs(Sequence* q, vector<Sequence*>& db
                                seen[tempIndexesRight[i]] = tempIndexesRight[i];
                        }
                }
-               
+               //string qname = q->getName().substr(0, q->getName().find_last_of('_'));        
+               //cout << qname << endl;        
                
                for (int i = 0; i < mergedResults.size(); i++) {
                        //cout << mergedResults[i]  << '\t' << db[mergedResults[i]]->getName() << endl; 
@@ -1201,7 +1202,6 @@ vector<Sequence*> ChimeraSlayer::getKmerSeqs(Sequence* q, vector<Sequence*>& db,
                        }
                }
                
-               
                for (int i = 0; i < mergedResults.size(); i++) {
                        //cout << mergedResults[i]  << '\t' << db[mergedResults[i]]->getName() << endl; 
                        if (db[mergedResults[i]]->getName() != q->getName()) { 
index 7dfebb06b8ff229639ced1b7fb1aec472cd9a689..8835290a8a0208fec200a4d0620d3760f3e837ae 100644 (file)
@@ -25,7 +25,7 @@ vector<string> ChimeraSlayerCommand::setParameters(){
                CommandParameter pmincov("mincov", "Number", "", "70", "", "", "",false,false); parameters.push_back(pmincov);
                CommandParameter pminsnp("minsnp", "Number", "", "10", "", "", "",false,false); parameters.push_back(pminsnp);
                CommandParameter pminbs("minbs", "Number", "", "90", "", "", "",false,false); parameters.push_back(pminbs);
-               CommandParameter psearch("search", "Multiple", "kmer-blast-distance", "blast", "", "", "",false,false); parameters.push_back(psearch);
+               CommandParameter psearch("search", "Multiple", "kmer-blast", "blast", "", "", "",false,false); parameters.push_back(psearch);
                CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
                CommandParameter prealign("realign", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(prealign);
                CommandParameter ptrim("trim", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(ptrim);
@@ -77,7 +77,7 @@ string ChimeraSlayerCommand::getHelpString(){
                helpString += "The mincov parameter allows you to specify minimum coverage by closest matches found in template. Default is 70, meaning 70%. \n";
                helpString += "The minbs parameter allows you to specify minimum bootstrap support for calling a sequence chimeric. Default is 90, meaning 90%. \n";
                helpString += "The minsnp parameter allows you to specify percent of SNPs to sample on each side of breakpoint for computing bootstrap support (default: 10) \n";
-               helpString += "The search parameter allows you to specify search method for finding the closest parent. Choices are distance, blast, and kmer, default distance. \n";
+               helpString += "The search parameter allows you to specify search method for finding the closest parent. Choices are blast, and kmer, default blast. \n";
                helpString += "The realign parameter allows you to realign the query to the potential parents. Choices are true or false, default true.  \n";
                helpString += "The chimera.slayer command should be in the following format: \n";
                helpString += "chimera.slayer(fasta=yourFastaFile, reference=yourTemplate, search=yourSearch) \n";
@@ -351,7 +351,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                        temp = validParameter.validFile(parameters, "split", false);                    if (temp == "not found") { temp = "f"; }
                        trimera = m->isTrue(temp); 
                        
-                       search = validParameter.validFile(parameters, "search", false);                 if (search == "not found") { search = "distance"; }
+                       search = validParameter.validFile(parameters, "search", false);                 if (search == "not found") { search = "blast"; }
                        
                        temp = validParameter.validFile(parameters, "iters", false);                    if (temp == "not found") { temp = "1000"; }             
                        convert(temp, iters); 
@@ -362,7 +362,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                        temp = validParameter.validFile(parameters, "numwanted", false);                if (temp == "not found") { temp = "15"; }               
                        convert(temp, numwanted);
 
-                       if ((search != "distance") && (search != "blast") && (search != "kmer")) { m->mothurOut(search + " is not a valid search."); m->mothurOutEndLine(); abort = true;  }
+                       if ((search != "blast") && (search != "kmer")) { m->mothurOut(search + " is not a valid search."); m->mothurOutEndLine(); abort = true;  }
                }
        }
        catch(exception& e) {
@@ -732,7 +732,6 @@ int ChimeraSlayerCommand::driver(linePair* filePos, string outputFName, string f
                        
                        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                                unsigned long int pos = inFASTA.tellg();
-                       //cout << candidateSeq->getName() << '\t' << pos << endl;
                                if ((pos == -1) || (pos >= filePos->end)) { break; }
                        #else
                                if (inFASTA.eof()) { break; }
index 342190db9a8f178aca59dfd94e7918fcd6e527c9..06a633e446d907cb7e6a5a5caa615e901a8c37c7 100644 (file)
@@ -645,7 +645,7 @@ string GetOTURepCommand::findRep(vector<string> names) {
        try{
                // if only 1 sequence in bin or processing the "unique" label, then 
                // the first sequence of the OTU is the representative one
-               if ((names.size() == 1) || (list->getLabel() == "unique")) {
+               if ((names.size() == 1)) {
                        return names[0];
                }else{
                        vector<int> seqIndex(names.size());
index 0cd8336c6de865d85d0fea9d607199599f10ab9e..f4c4a9821350c38a9bde8ca7a4fcd6ae01d6b3c3 100644 (file)
@@ -42,7 +42,7 @@ string Maligner::getResults(Sequence* q, DeCalculator* decalc) {
                }
                
                int chimeraPenalty = computeChimeraPenalty();
-               
+       
                //fills outputResults
                chimera = chimeraMaligner(chimeraPenalty, decalc);
                
@@ -95,7 +95,7 @@ string Maligner::chimeraMaligner(int chimeraPenalty, DeCalculator* decalc) {
                if (m->control_pressed) { return chimera;  }
                
                vector<trace_struct> trace = mapTraceRegionsToAlignment(path, refSeqs);
-                       
+                               
                if (trace.size() > 1) {         chimera = "yes";        }
                else { chimera = "no";  return chimera; }
                
@@ -161,7 +161,7 @@ string Maligner::chimeraMaligner(int chimeraPenalty, DeCalculator* decalc) {
                        
                        temp.queryToParentLocal = computePercentID(queryInRegion, parentInRegion);
                        
-//                     cout << query->getName() << '\t' << temp.parent << '\t' << "NAST:" << temp.nastRegionStart << '-' << temp.nastRegionEnd << " G:" << temp.queryToParent << " L:" << temp.queryToParentLocal << ", " <<  temp.divR << endl;
+                       //cout << query->getName() << '\t' << temp.parent << '\t' << "NAST:" << temp.nastRegionStart << '-' << temp.nastRegionEnd << " G:" << temp.queryToParent << " L:" << temp.queryToParentLocal << ", " <<  temp.divR << endl;
 
                        outputResults.push_back(temp);
                }
@@ -490,7 +490,7 @@ vector<trace_struct> Maligner::mapTraceRegionsToAlignment(vector<score_struct> p
                for (int i = 1; i < path.size(); i++) {
                        
                        int next_region_index = path[i].row;
-//                     cout << i << '\t' << next_region_index << endl;
+                       //cout << i << '\t' << next_region_index << endl;
 
                        if (next_region_index != region_index) {
                                
index 92b4673979197d4591b771a1011470d46f22b973..4987d4170337f6d4e172c395c137be71832759ed 100644 (file)
@@ -17,8 +17,7 @@ string Slayer::getResults(Sequence* query, vector<Sequence*> refSeqs) {
        try {
                vector<data_struct> all; all.clear();
                myQuery = *query;
-               
-                               
+
                for (int i = 0; i < refSeqs.size(); i++) {
                
                        for (int j = i+1; j < refSeqs.size(); j++) {
@@ -29,6 +28,11 @@ string Slayer::getResults(Sequence* query, vector<Sequence*> refSeqs) {
                                Sequence* q = new Sequence(query->getName(), query->getAligned());
                                Sequence* leftParent = new Sequence(refSeqs[i]->getName(), refSeqs[i]->getAligned());
                                Sequence* rightParent = new Sequence(refSeqs[j]->getName(), refSeqs[j]->getAligned());
+                               
+                               //cout << q->getName() << endl << q->getAligned() << endl << endl;      
+                               //cout << leftParent->getName() << endl << leftParent->getAligned() << endl << endl;            
+                               //cout << rightParent->getName() << endl << rightParent->getAligned() << endl << endl;  
+                               //cout << " length = " << rightParent->getAligned().length() << endl;
        
                                map<int, int> spots;  //map from spot in original sequence to spot in filtered sequence for query and both parents
                                vector<data_struct> divs = runBellerophon(q, leftParent, rightParent, spots);
@@ -149,13 +153,13 @@ vector<data_struct> Slayer::runBellerophon(Sequence* q, Sequence* pA, Sequence*
                        int rightLength = length - leftLength;
                                
                        float QLA = computePercentID(query, parentA, 0, breakpoint);
-                       float QRB = computePercentID(query, parentB, breakpoint+1, length);
+                       float QRB = computePercentID(query, parentB, breakpoint+1, length-1);
                
                        float QLB = computePercentID(query, parentB, 0, breakpoint);
-                       float QRA = computePercentID(query, parentA, breakpoint+1, length);
+                       float QRA = computePercentID(query, parentA, breakpoint+1, length-1);
                
                        float LAB = computePercentID(parentA, parentB, 0, breakpoint);
-                       float RAB = computePercentID(parentA, parentB, breakpoint+1, length);   
+                       float RAB = computePercentID(parentA, parentB, breakpoint+1, length-1); 
                        
                        float AB = ((LAB*leftLength) + (RAB*rightLength)) / (float) length;
                        float QA = ((QLA*leftLength) + (QRA*rightLength)) / (float) length;
@@ -174,7 +178,7 @@ vector<data_struct> Slayer::runBellerophon(Sequence* q, Sequence* pA, Sequence*
                        //cout << q->getName() << '\t';
                        //cout << pA->getName() << '\t';
                        //cout << pB->getName() << '\t';
-                  // cout << "bp: " << breakpoint << " CHIM_TYPE_A\t" << divR_QLA_QRB << "\tQLA: " << QLA << "\tQRB: " << QRB << "\tQLA_QRB: " << QLA_QRB;
+                   //cout << "bp: " << breakpoint << " CHIM_TYPE_A\t" << divR_QLA_QRB << "\tQLA: " << QLA << "\tQRB: " << QRB << "\tQLA_QRB: " << QLA_QRB;
                        //cout << "\tCHIM_TYPE_B\t" << divR_QLB_QRA << "\tQLB: " << QLB << "\tQRA: " << QRA << "\tQLB_QRA: " << QLB_QRA << endl;
 //cout << leftLength << '\t' << rightLength << '\t' << QLA << '\t' << QRB << '\t' << QLB << '\t' << QRA  << '\t' << LAB << '\t' << RAB << '\t' << AB << '\t' << QA << '\t' << QB << '\t' << QLA_QRB << '\t' <<  QLB_QRA <<    endl;                    
 
index a9979e7fa831b30cb5301c3d06d39ad0f202c37f..f685a427d4dfc87d92e45b4aa82342bfd6ff3d16 100644 (file)
@@ -583,7 +583,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                        
                                        if(barcodes.size() != 0){
                                                string thisGroup = barcodeNameVector[barcodeIndex];
-                                               if (primers.size() != 0) { thisGroup += "." + primerNameVector[primerIndex]; }
+                                               if (primers.size() != 0) { if (primerNameVector[primerIndex] != "") { thisGroup += "." + primerNameVector[primerIndex]; } }
                                                
                                                outGroupsFile << currSeq.getName() << '\t' << thisGroup << endl;