X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=blastalign.cpp;h=5e7fb61aa77e7c34ca7367393766b1a5455c9213;hb=a5af3313f0221a8b41aa362d72eadb60a4dd6e27;hp=0a1350fac0c7fa655d5d04585156c28445c4d0d5;hpb=526a868606faa50caf86e7399f7554c0335b39e5;p=mothur.git diff --git a/blastalign.cpp b/blastalign.cpp index 0a1350f..5e7fb61 100644 --- a/blastalign.cpp +++ b/blastalign.cpp @@ -11,7 +11,6 @@ * */ -using namespace std; #include "alignment.hpp" #include "blastalign.hpp" @@ -23,6 +22,10 @@ BlastAlignment::BlastAlignment(float go, float ge, float m, float mm) : match(m), // This is the score to award for two nucleotides matching (match >= 0) mismatch(mm) // This is the penalty to assess for a mismatch (mismatch <= 0) { + globaldata = GlobalData::getInstance(); + path = globaldata->argv; + path = path.substr(0, (path.find_last_of('m'))); + gapOpen = abs(go); // This is the penalty to assess for opening a gap (gapOpen >= 0) gapExtend = abs(ge); // This is the penalty to assess for extending a gap (gapExtend >= 0) @@ -54,7 +57,7 @@ void BlastAlignment::align(string seqA, string seqB){ //Use blastn to align the // The blastCommand assumes that we have DNA sequences (blastn) and that they are fairly similar (-e 0.001) and // that we don't want to apply any kind of complexity filtering (-F F) - string blastCommand = "~/Pipeline/src/cpp/production/blast/bin/bl2seq -p blastn -i " + candidateFileName + " -j " + templateFileName + " -e 0.0001 -F F -o " + blastFileName + " -W 11"; + string blastCommand = path + "blast/bin/bl2seq -p blastn -i " + candidateFileName + " -j " + templateFileName + " -e 0.0001 -F F -o " + blastFileName + " -W 11"; blastCommand += " -r " + toString(match) + " -q " + toString(mismatch); blastCommand += " -G " + toString(gapOpen) + " -E " + toString(gapExtend); @@ -69,7 +72,7 @@ void BlastAlignment::setPairwiseSeqs(){ // This method call assigns the blast ge // to the pairwise entry in the Sequence class for the // candidate and template Sequence objects ifstream blastFile; - openInputFile(blastFileName, blastFile); + m->openInputFile(blastFileName, blastFile); seqAaln = ""; seqBaln = ""; @@ -79,13 +82,13 @@ void BlastAlignment::setPairwiseSeqs(){ // This method call assigns the blast ge string candidateName, templateName; - while(d=blastFile.get() != '='){}; + while((d=blastFile.get()) != '='){} blastFile >> candidateName; // Get the candidate sequence name from flatfile - while(d=blastFile.get() != '('){}; + while((d=blastFile.get()) != '('){} blastFile >> candidateLength; // Get the candidate sequence length from flatfile - while(d=blastFile.get()){ + while((d=blastFile.get())){ if(d == '>'){ blastFile >> templateName; // Get the template sequence name from flatfile break; @@ -99,9 +102,9 @@ void BlastAlignment::setPairwiseSeqs(){ // This method call assigns the blast ge pairwiseLength = 0; // string dummy; -// while(dummy != "query:"){ cout << dummy << endl;blastFile >> dummy; } +// while(dummy != "query:"){ m->mothurOut(dummy, ""); m->mothurOutEndLine(); blastFile >> dummy; } // blastFile >> seqBend; -// cout << seqBend << endl; +// m->mothurOut(toString(seqBend), ""); m->mothurOutEndLine(); // for(int i=0;i> templateLength; // Get the template sequence length from flatfile - while(d=blastFile.get() != 'Q'){}; // Suck up everything else until we get to the start of the alignment + while((d=blastFile.get()) != 'Q'){} // Suck up everything else until we get to the start of the alignment int queryStart, sbjctStart, queryEnd, sbjctEnd; string queryLabel, sbjctLabel, query, sbjct; @@ -124,7 +127,7 @@ void BlastAlignment::setPairwiseSeqs(){ // This method call assigns the blast ge while(queryLabel == "Query:"){ blastFile >> queryStart >> query >> queryEnd; - while(d=blastFile.get() != 'S'){}; + while((d=blastFile.get()) != 'S'){}; blastFile >> sbjctLabel >> sbjctStart >> sbjct >> sbjctEnd; @@ -151,6 +154,7 @@ void BlastAlignment::setPairwiseSeqs(){ // This method call assigns the blast ge seqAaln += 'Z'; // again need ot pad the sequences so that they extend to the length seqBaln += 'X'; // of the template sequence } + blastFile.close(); } //**************************************************************************************************/