]> git.donarmstrong.com Git - mothur.git/commitdiff
random chagnes from pat
authorpschloss <pschloss>
Mon, 21 Mar 2011 11:28:49 +0000 (11:28 +0000)
committerpschloss <pschloss>
Mon, 21 Mar 2011 11:28:49 +0000 (11:28 +0000)
chimeraslayer.cpp
commandfactory.hpp
nast.cpp
pairwiseseqscommand.cpp
seqerrorcommand.cpp
shhhercommand.cpp

index b334f909a7411d6dd00b3eda311740b7e93a80b8..61ad0e0ce7626512e3d9e1cd4e70288acaee1049 100644 (file)
@@ -259,6 +259,7 @@ int ChimeraSlayer::doPrep() {
                
                        //generate blastdb
                        databaseLeft = new BlastDB(-1.0, -1.0, 1, -3);
+
                        for (int i = 0; i < templateSeqs.size(); i++) {         databaseLeft->addSequence(*templateSeqs[i]);    }
                        databaseLeft->generateDB();
                        databaseLeft->setNumSeqs(templateSeqs.size());
@@ -385,6 +386,7 @@ vector<Sequence*> ChimeraSlayer::getTemplate(Sequence* q) {
                        
                        //generate blastdb
                        databaseLeft = new BlastDB(-1.0, -1.0, 1, -3);
+
                        for (int i = 0; i < thisTemplate.size(); i++) { if (m->control_pressed) { return thisTemplate; }  databaseLeft->addSequence(*thisTemplate[i]);  }
                        databaseLeft->generateDB();
                        databaseLeft->setNumSeqs(thisTemplate.size());
index a6dc5b72e0b403df37dd77b7ee593ca5ff19de73..8b08c006312240676e1e1466a0470c7f3aa11eae 100644 (file)
@@ -12,6 +12,7 @@
 \r
 #include "mothur.h"\r
 #include "mothurout.h"\r
+#include "currentfile.h"\r
 \r
 class Command;\r
 \r
@@ -37,7 +38,10 @@ private:
        Command* command;\r
        Command* shellcommand;\r
        Command* pipecommand;\r
+       \r
        MothurOut* m;\r
+       CurrentFile* currentFile;\r
+       \r
        map<string, string> commands;\r
        map<string, string>::iterator it;\r
        string outputDir, inputDir, logFileName;\r
index 28cc659e9c5a6090bcd6cb5edecdc7cf9d6c9ec0..bf65fa2b46ea319bf54ab74a9696bb9e7b22fafe 100644 (file)
--- a/nast.cpp
+++ b/nast.cpp
@@ -45,7 +45,7 @@ void Nast::pairwiseAlignSeqs(){       //      Here we call one of the pairwise alignment me
 
                string candAln = alignment->getSeqAAln();
                string tempAln = alignment->getSeqBAln();
-
+       
                if(candAln == ""){
 
                        candidateSeq->setPairwise("");
@@ -78,6 +78,7 @@ void Nast::pairwiseAlignSeqs(){       //      Here we call one of the pairwise alignment me
 
                candidateSeq->setPairwise(candAln);                                     //      set the pairwise sequences in the Sequence objects for
                templateSeq->setPairwise(tempAln);                                      //      the candidate and template sequences
+
        }
        catch(exception& e) {
                m->errorOut(e, "Nast", "pairwiseAlignSeqs");
@@ -91,11 +92,6 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl
 
 //     here we do steps C-F of Fig. 2 from DeSantis et al.
        try {
-       
-               //cout << candAln << endl;
-               //cout << tempAln << endl;
-               //cout << newTemplateAlign << endl;
-               //cout << endl;
                
                int longAlignmentLength = newTemplateAlign.length();    
        
index 1e7a3388ce4780d369142385cc0b7bf15e96fae9..5c890404dea8ed4c5e9c6dae0cef4f41a1ef5f70 100644 (file)
@@ -610,6 +610,7 @@ int PairwiseSeqsCommand::driver(int startLine, int endLine, string dFileName, fl
                                alignment->align(seqI.getUnaligned(), seqJ.getUnaligned());
                                seqI.setAligned(alignment->getSeqAAln());
                                seqJ.setAligned(alignment->getSeqBAln());
+
                                
                                distCalculator->calcDist(seqI, seqJ);
                                double dist = distCalculator->getDist();
index 9a2851e343c2a151811770d32c1a71f75092c231..5a0cc02fab59de9960e6626b4cbcc87e8ce82d1f 100644 (file)
@@ -264,8 +264,8 @@ int SeqErrorCommand::execute(){
                        qualForwardMap.resize(maxLength);
                        qualReverseMap.resize(maxLength);
                        for(int i=0;i<maxLength;i++){
-                               qualForwardMap[i].assign(maxLength,0);
-                               qualReverseMap[i].assign(maxLength,0);
+                               qualForwardMap[i].assign(41,0);
+                               qualReverseMap[i].assign(41,0);
                        }                               
                }
                
@@ -780,17 +780,15 @@ void SeqErrorCommand::printErrorQuality(map<char, vector<int> > qScoreErrorMap){
 //***************************************************************************************************************
 
 void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector<vector<int> > qualReverseMap){
-       try{
-
 
-               int lastRow = 0;
-               int lastColumn = 0;
+       try{
+               int numRows = 0;
+               int numColumns = qualForwardMap[0].size();
 
                for(int i=0;i<qualForwardMap.size();i++){
-                       for(int j=0;j<qualForwardMap[i].size();j++){
+                       for(int j=0;j<numColumns;j++){
                                if(qualForwardMap[i][j] != 0){
-                                       if(lastRow < i)         {       lastRow = i+2;          }
-                                       if(lastColumn < j)      {       lastColumn = j+2;       }
+                                       if(numRows < i)         {       numRows = i+20;         }
                                }
                        }
                }
@@ -800,11 +798,11 @@ void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector
                m->openOutputFile(qualityForwardFileName, qualityForwardFile);
                outputNames.push_back(qualityForwardFileName);  outputTypes["error.qual.forward"].push_back(qualityForwardFileName);
 
-               for(int i=0;i<lastColumn;i++){  qualityForwardFile << '\t' << i;        }       qualityForwardFile << endl;
+               for(int i=0;i<numColumns;i++){  qualityForwardFile << '\t' << i;        }       qualityForwardFile << endl;
 
-               for(int i=0;i<lastRow;i++){
+               for(int i=0;i<numRows;i++){
                        qualityForwardFile << i+1;
-                       for(int j=0;j<lastColumn;j++){
+                       for(int j=0;j<numColumns;j++){
                                qualityForwardFile << '\t' << qualForwardMap[i][j];
                        }
 
@@ -818,11 +816,11 @@ void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector
                m->openOutputFile(qualityReverseFileName, qualityReverseFile);
                outputNames.push_back(qualityReverseFileName);  outputTypes["error.qual.reverse"].push_back(qualityReverseFileName);
                
-               for(int i=0;i<lastColumn;i++){  qualityReverseFile << '\t' << i;        }       qualityReverseFile << endl;
-               for(int i=0;i<lastRow;i++){
+               for(int i=0;i<numColumns;i++){  qualityReverseFile << '\t' << i;        }       qualityReverseFile << endl;
+               for(int i=0;i<numRows;i++){
                        
                        qualityReverseFile << i+1;
-                       for(int j=0;j<lastColumn;j++){
+                       for(int j=0;j<numColumns;j++){
                                qualityReverseFile << '\t' << qualReverseMap[i][j];
                        }
                        qualityReverseFile << endl;
@@ -833,7 +831,7 @@ void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector
                m->errorOut(e, "SeqErrorCommand", "printErrorFRFile");
                exit(1);
        }
+       
 }
 
-
 //***************************************************************************************************************
index b21d4140b84280251cb208705bf0fca70919d0e0..024fbab7221c328a02958d34084e4704da55b150 100644 (file)
@@ -2016,7 +2016,6 @@ void ShhherCommand::writeQualities(vector<int> otuCounts){
 
 void ShhherCommand::writeSequences(vector<int> otuCounts){
        try {
-               flowOrder = "TACG";
                
                string fastaFileName = flowFileName.substr(0,flowFileName.find_last_of('.')) + ".pn.fasta";
                ofstream fastaFile;
@@ -2030,14 +2029,17 @@ void ShhherCommand::writeSequences(vector<int> otuCounts){
                        if(otuCounts[i] > 0){
                                fastaFile << '>' << seqNameVector[aaI[i][0]] << endl;
                                
-                               for(int j=8;j<numFlowCells;j++){
+                               string newSeq = "";
+                               
+                               for(int j=0;j<numFlowCells;j++){
                                        
                                        char base = flowOrder[j % 4];
                                        for(int k=0;k<uniqueFlowgrams[index * numFlowCells + j];k++){
-                                               fastaFile << base;
+                                               newSeq += base;
                                        }
                                }
-                               fastaFile << endl;
+                               
+                               fastaFile << newSeq.substr(4) << endl;
                        }
                }
                fastaFile.close();
@@ -2107,7 +2109,7 @@ void ShhherCommand::writeClusters(vector<int> otuCounts){
                ofstream otuCountsFile;
                m->openOutputFile(otuCountsFileName, otuCountsFile);
                
-               string bases = "TACG";
+               string bases = flowOrder;
                
                for(int i=0;i<numOTUs;i++){
                        //output the translated version of the centroid sequence for the otu
@@ -2127,15 +2129,18 @@ void ShhherCommand::writeClusters(vector<int> otuCounts){
                                        int sequence = aaI[i][j];
                                        otuCountsFile << seqNameVector[sequence] << '\t';
                                        
-                                       for(int k=8;k<lengths[sequence];k++){
+                                       string newSeq = "";
+                                       
+                                       for(int k=0;k<lengths[sequence];k++){
                                                char base = bases[k % 4];
                                                int freq = int(0.01 * (double)flowDataIntI[sequence * numFlowCells + k] + 0.5);
-                                               
+                                                       
                                                for(int s=0;s<freq;s++){
-                                                       otuCountsFile << base;
+                                                       newSeq += base;
+                                                       //otuCountsFile << base;
                                                }
                                        }
-                                       otuCountsFile << endl;
+                                       otuCountsFile << newSeq.substr(4) << endl;
                                }
                                otuCountsFile << endl;
                        }