]> git.donarmstrong.com Git - mothur.git/blobdiff - blastalign.cpp
changed random forest output filename
[mothur.git] / blastalign.cpp
index a4773138bd6f8102acaea659291fa675ea25a6fc..bb7192ad498c405fc476ae722db2478fa1b407ab 100644 (file)
@@ -11,7 +11,6 @@
  *
  */
 
-using namespace std;
 
 #include "alignment.hpp"
 #include "blastalign.hpp"
@@ -19,12 +18,11 @@ using namespace std;
 
 //**************************************************************************************************/
 
-BlastAlignment::BlastAlignment(float go, float ge, float m, float mm) : 
-                       match(m),                               //      This is the score to award for two nucleotides matching (match >= 0)
+BlastAlignment::BlastAlignment(float go, float ge, float ma, float mm) : 
+                       match(ma),                              //      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 = m->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)
@@ -39,9 +37,9 @@ BlastAlignment::BlastAlignment(float go, float ge, float m, float mm) :
 //**************************************************************************************************/
 
 BlastAlignment::~BlastAlignment(){             //      The desctructor should clean up by removing the temporary 
-       remove(candidateFileName.c_str());      //      files used to run bl2seq
-       remove(templateFileName.c_str());
-       remove(blastFileName.c_str());
+       m->mothurRemove(candidateFileName);     //      files used to run bl2seq
+       m->mothurRemove(templateFileName);
+       m->mothurRemove(blastFileName);
 }
 
 //**************************************************************************************************/
@@ -73,7 +71,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 = "";
@@ -83,13 +81,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;
@@ -103,9 +101,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<seqBend;i++){
 //                             seqAaln += 'Z';
 //                             seqBaln += 'X';
@@ -115,10 +113,10 @@ void BlastAlignment::setPairwiseSeqs(){   //      This method call assigns the blast ge
                }
        }
        
-       while(d=blastFile.get() != '='){};
+       while((d=blastFile.get()) != '='){}
        blastFile >> 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;
 
@@ -128,7 +126,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;
                
@@ -155,6 +153,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();
 }
 
 //**************************************************************************************************/