From 48335c6b6ecee614c30d22751c2880953c20e2f4 Mon Sep 17 00:00:00 2001 From: pschloss Date: Mon, 21 Mar 2011 11:28:49 +0000 Subject: [PATCH] random chagnes from pat --- chimeraslayer.cpp | 2 ++ commandfactory.hpp | 4 ++++ nast.cpp | 8 ++------ pairwiseseqscommand.cpp | 1 + seqerrorcommand.cpp | 30 ++++++++++++++---------------- shhhercommand.cpp | 23 ++++++++++++++--------- 6 files changed, 37 insertions(+), 31 deletions(-) diff --git a/chimeraslayer.cpp b/chimeraslayer.cpp index b334f90..61ad0e0 100644 --- a/chimeraslayer.cpp +++ b/chimeraslayer.cpp @@ -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 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()); diff --git a/commandfactory.hpp b/commandfactory.hpp index a6dc5b7..8b08c00 100644 --- a/commandfactory.hpp +++ b/commandfactory.hpp @@ -12,6 +12,7 @@ #include "mothur.h" #include "mothurout.h" +#include "currentfile.h" class Command; @@ -37,7 +38,10 @@ private: Command* command; Command* shellcommand; Command* pipecommand; + MothurOut* m; + CurrentFile* currentFile; + map commands; map::iterator it; string outputDir, inputDir, logFileName; diff --git a/nast.cpp b/nast.cpp index 28cc659..bf65fa2 100644 --- 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(); diff --git a/pairwiseseqscommand.cpp b/pairwiseseqscommand.cpp index 1e7a338..5c89040 100644 --- a/pairwiseseqscommand.cpp +++ b/pairwiseseqscommand.cpp @@ -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(); diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp index 9a2851e..5a0cc02 100644 --- a/seqerrorcommand.cpp +++ b/seqerrorcommand.cpp @@ -264,8 +264,8 @@ int SeqErrorCommand::execute(){ qualForwardMap.resize(maxLength); qualReverseMap.resize(maxLength); for(int i=0;i > qScoreErrorMap){ //*************************************************************************************************************** void SeqErrorCommand::printQualityFR(vector > qualForwardMap, vector > qualReverseMap){ - try{ - - int lastRow = 0; - int lastColumn = 0; + try{ + int numRows = 0; + int numColumns = qualForwardMap[0].size(); for(int i=0;i > qualForwardMap, vector m->openOutputFile(qualityForwardFileName, qualityForwardFile); outputNames.push_back(qualityForwardFileName); outputTypes["error.qual.forward"].push_back(qualityForwardFileName); - for(int i=0;i > qualForwardMap, vector m->openOutputFile(qualityReverseFileName, qualityReverseFile); outputNames.push_back(qualityReverseFileName); outputTypes["error.qual.reverse"].push_back(qualityReverseFileName); - for(int i=0;i > qualForwardMap, vector m->errorOut(e, "SeqErrorCommand", "printErrorFRFile"); exit(1); } + } - //*************************************************************************************************************** diff --git a/shhhercommand.cpp b/shhhercommand.cpp index b21d414..024fbab 100644 --- a/shhhercommand.cpp +++ b/shhhercommand.cpp @@ -2016,7 +2016,6 @@ void ShhherCommand::writeQualities(vector otuCounts){ void ShhherCommand::writeSequences(vector 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 otuCounts){ if(otuCounts[i] > 0){ fastaFile << '>' << seqNameVector[aaI[i][0]] << endl; - for(int j=8;j otuCounts){ ofstream otuCountsFile; m->openOutputFile(otuCountsFileName, otuCountsFile); - string bases = "TACG"; + string bases = flowOrder; for(int i=0;i otuCounts){ int sequence = aaI[i][j]; otuCountsFile << seqNameVector[sequence] << '\t'; - for(int k=8;k