]> git.donarmstrong.com Git - mothur.git/commitdiff
chimera.slayer
authorwestcott <westcott>
Wed, 4 May 2011 20:07:48 +0000 (20:07 +0000)
committerwestcott <westcott>
Wed, 4 May 2011 20:07:48 +0000 (20:07 +0000)
Mothur.xcodeproj/project.pbxproj
blastdb.cpp
chimeraslayer.cpp
decalc.cpp
listseqscommand.cpp
maligner.cpp

index 217151be7313e5ec60611c20d104af1d7b57d617..2e6f5a8244aead5d33354fd4d765e183ee2092c2 100644 (file)
                                A7E9B68112D37EC400DA6239 /* chimeracheckrdp.h */,
                                A7E9B68412D37EC400DA6239 /* chimerarealigner.cpp */,
                                A7E9B68512D37EC400DA6239 /* chimerarealigner.h */,
-                               A7E9B68812D37EC400DA6239 /* chimeraslayer.cpp */,
-                               A7E9B68912D37EC400DA6239 /* chimeraslayer.h */,
                                A7E9B6C212D37EC400DA6239 /* decalc.h */,
                                A7E9B6C112D37EC400DA6239 /* decalc.cpp */,
+                               A7E9B68812D37EC400DA6239 /* chimeraslayer.cpp */,
+                               A7E9B68912D37EC400DA6239 /* chimeraslayer.h */,
                                A7E9B74612D37EC400DA6239 /* maligner.h */,
                                A7E9B74512D37EC400DA6239 /* maligner.cpp */,
                                A7E9B79312D37EC400DA6239 /* pintail.cpp */,
index 7f02a8db6880f43faa4f6c89b2ca7aa4fa5b2697..8bf79c552c97e905f77011f2791a8f7f92a82172 100644 (file)
@@ -147,7 +147,7 @@ vector<int> BlastDB::findClosestMegaBlast(Sequence* seq, int n, int minPerID) {
                        //while (!m8FileHandle.eof())   {       char c = m8FileHandle.get(); if (c == 10 || c == 13){   break;  }else{ cout << c; }     } //
                                //cout << endl;
                        m->gobble(m8FileHandle);
-                       if (score >= minPerID) {
+                       if (score >= minPerID) { //this follows broads CS, but probably should be searchScore...
                                topMatches.push_back(templateAccession);
                                Scores.push_back(searchScore);
                        }
index 5b1075902d6a038a4e863913bee7969c0ae52154..ffba9f5ff734bbaa5d5a6d80767897c34757e4b1 100644 (file)
@@ -72,10 +72,18 @@ ChimeraSlayer::ChimeraSlayer(string file, string temp, bool trim, map<string, in
                
                createFilter(templateSeqs, 0.0); //just removed columns where all seqs have a gap
                
-               //run filter on template
-               for (int i = 0; i < templateSeqs.size(); i++) {  if (m->control_pressed) {  break; }  runFilter(templateSeqs[i]);  }
-
-               
+               if (searchMethod == "distance") { 
+                       createFilter(templateSeqs, 0.0); //just removed columns where all seqs have a gap
+                       
+                       //run filter on template copying templateSeqs into filteredTemplateSeqs
+                       for (int i = 0; i < templateSeqs.size(); i++) {  
+                               if (m->control_pressed) {  break; }
+                               
+                               Sequence* newSeq = new Sequence(templateSeqs[i]->getName(), templateSeqs[i]->getAligned());
+                               runFilter(newSeq);  
+                               filteredTemplateSeqs.push_back(newSeq);
+                       }
+               }
        }
        catch(exception& e) {
                m->errorOut(e, "ChimeraSlayer", "ChimeraSlayer");
@@ -835,7 +843,7 @@ int ChimeraSlayer::getChimeras(Sequence* query) {
                        //free memory
                        for (int k = 0; k < seqs.size(); k++) {  delete seqs[k].seq;   }
                }
-               
+               //cout << endl << endl;
                return 0;
        }
        catch(exception& e) {
@@ -1024,7 +1032,7 @@ vector<Sequence*> ChimeraSlayer::getBlastSeqs(Sequence* q, vector<Sequence*>& db
                string queryUnAligned = q->getUnaligned();
                string leftQuery = queryUnAligned.substr(0, int(queryUnAligned.length() * 0.33)); //first 1/3 of the sequence
                string rightQuery = queryUnAligned.substr(int(queryUnAligned.length() * 0.66)); //last 1/3 of the sequence
-               
+//cout << "whole length = " << queryUnAligned.length() << '\t' << "left length = " << leftQuery.length() << '\t' << "right length = "<< rightQuery.length() << endl;   
                Sequence* queryLeft = new Sequence(q->getName(), leftQuery);
                Sequence* queryRight = new Sequence(q->getName(), rightQuery);
                
index 3b3740bcea6682e14b21300a48e07fdb9f7079a3..c600a7f56633c270ec83810a306ad71ca3cd65c8 100644 (file)
@@ -838,9 +838,9 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
                for (int i = 0; i < dists.size(); i++) {
 //                     cout << db[dists[i].index]->getName() << '\t' << dists[i].dist << endl;
 
-                       if ((thisTemplate[dists[i].index]->getName() != querySeq->getName()) && (dists[i].dist >= minSim)) {
+                       if ((thisTemplate[dists[i].index]->getName() != querySeq->getName()) && (((1.0-dists[i].dist)*100) >= minSim)) {
                                Sequence* temp = new Sequence(thisTemplate[dists[i].index]->getName(), thisTemplate[dists[i].index]->getAligned()); //have to make a copy so you can trim and filter without stepping on eachother.
-                       
+                               //cout << querySeq->getName() << '\t' << thisTemplate[dists[i].index]->getName()  << '\t' << dists[i].dist << endl;
                                seqsMatches.push_back(temp);
                        }
 
index ebfd07565bcca4458d7ce51b4911d5cc659e711e..21cb4c7f622e95bc4a44689ce8ef605703444ec2 100644 (file)
@@ -257,18 +257,32 @@ int ListSeqsCommand::readFasta(){
                m->openInputFile(fastafile, in);
                string name;
                
+               ofstream out;
+               string newFastaName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "numsAdded.fasta";
+               m->openOutputFile(newFastaName, out);
+               int count = 1;
+               string lastName = "";
+               
                while(!in.eof()){
                        
                        if (m->control_pressed) { in.close(); return 0; }
                        
                        Sequence currSeq(in);
                        name = currSeq.getName();
+                       if (lastName == "") { lastName = name; }
+                       if (name != lastName) { count = 1; }
+                       lastName = name;
+                       
+                       Sequence newSeq(name+"_"+toString(count), currSeq.getAligned());
+                       newSeq.printSequence(out);
                        
                        if (name != "") {  names.push_back(name);  }
                        
                        m->gobble(in);
+                       count++;
                }
                in.close();     
+               out.close();
                
                return 0;
 
index f834db1db319badab0ddb70cde9e54c7dbb3193f..5ffba329d31fb3e684feef6f664957ef55ec0a68 100644 (file)
@@ -77,7 +77,7 @@ string Maligner::chimeraMaligner(int chimeraPenalty, DeCalculator* decalc) {
                        
                verticalFilter(temp);
                
-               //for (int i = 0; i < refSeqs.size(); i++) { cout << refSeqs[i]->getName() << endl << refSeqs[i]->getAligned() << endl; }
+               //for (int i = 0; i < refSeqs.size(); i++) { cout << refSeqs[i]->getName() << endl ; }//<< refSeqs[i]->getAligned() << endl
 
                vector< vector<score_struct> > matrix = buildScoreMatrix(query->getAligned().length(), refSeqs.size()); //builds and initializes
                
@@ -150,7 +150,7 @@ string Maligner::chimeraMaligner(int chimeraPenalty, DeCalculator* decalc) {
                        
                        temp.queryToParentLocal = computePercentID(queryInRegion, parentInRegion);
                        
-//                     cout << temp.parent << '\t' << "NAST:" << temp.nastRegionStart << '-' << temp.nastRegionEnd << " G:" << temp.queryToParent << " L:" << temp.queryToParentLocal << 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);
                }