]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed blast code path problem
authorwestcott <westcott>
Thu, 21 May 2009 13:18:32 +0000 (13:18 +0000)
committerwestcott <westcott>
Thu, 21 May 2009 13:18:32 +0000 (13:18 +0000)
blastalign.cpp
blastalign.hpp
blastdb.cpp
blastdb.hpp
engine.cpp
engine.hpp
globaldata.hpp
mothur.cpp

index 0a1350fac0c7fa655d5d04585156c28445c4d0d5..a4773138bd6f8102acaea659291fa675ea25a6fc 100644 (file)
@@ -23,6 +23,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 +58,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);
        
index 0f755d852cb0fdb793c40e88613dd8b19076c991..696c134375785698c1c15649fef4adc2df783a4a 100644 (file)
@@ -12,6 +12,7 @@
  */
  
 #include "mothur.h"
+#include "globaldata.hpp"
 
 class BlastAlignment : public Alignment {
 
@@ -24,11 +25,13 @@ private:
        string candidateFileName;
        string templateFileName;
        string blastFileName;
+       string path;
 
        void setPairwiseSeqs();
        float match;
        float mismatch;
        float gapOpen;
        float gapExtend;
+       GlobalData* globaldata;
 };
 
index ef8f737ee8bc5507b5c7a24dd71c3a1bd27d80ce..82b104e0380b2f8794ebf9e0ce2693d835dd8cc0 100644 (file)
@@ -18,7 +18,9 @@ using namespace std;
 
 BlastDB::BlastDB(string fastaFileName, float gO, float gE, float m, float mM) : Database(fastaFileName), 
 gapOpen(gO), gapExtend(gE), match(m), misMatch(mM) {
-
+       
+       globaldata = GlobalData::getInstance();
+       
        cout << "Generating the temporary BLAST database...\t"; cout.flush();
 
        int randNumber = rand();
@@ -36,7 +38,10 @@ gapOpen(gO), gapExtend(gE), match(m), misMatch(mM) {
        }
        unalignedFastaFile.close();
        
-       string formatdbCommand = "~/Pipeline/src/cpp/production/blast/bin/formatdb -p F -o T -i " + dbFileName; //      format the database, -o option gives us the ability
+       path = globaldata->argv;
+       path = path.substr(0, (path.find_last_of('m')));
+       
+       string formatdbCommand = path + "blast/bin/formatdb -p F -o T -i " + dbFileName;        //      format the database, -o option gives us the ability
        system(formatdbCommand.c_str());                                                                //      to get the right sequence names, i think. -p F
                                                                                                                                        //      option tells formatdb that seqs are DNA, not prot
        cout << "DONE." << endl << endl;        cout.flush();
@@ -71,7 +76,7 @@ Sequence* BlastDB::findClosestSequence(Sequence* candidate){
 //     wordsize used in megablast.  I'm sure we're sacrificing accuracy for speed, but anyother way would take way too
 //     long.  With this setting, it seems comparable in speed to the suffix tree approach.
 
-       string blastCommand = "~/Pipeline/src/cpp/production/blast/bin/blastall -p blastn -d " + dbFileName + " -b 1 -m 8 -W 28";
+       string blastCommand = path + "blast/bin/blastall -p blastn -d " + dbFileName + " -b 1 -m 8 -W 28";
        blastCommand += (" -i " + queryFileName + " -o " + blastFileName);
        system(blastCommand.c_str());
        
index a952897f05e496e09a6faaacf7c4de97d49bd132..dfb2a2ced94ae71623856930ee0c348802530acd 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "mothur.h"
+#include "globaldata.hpp"
 
 class BlastDB : public Database {
 public:
@@ -23,12 +24,14 @@ private:
        string dbFileName;
        string queryFileName;
        string blastFileName;
+       string path;
        
        float gapOpen;
        float gapExtend;
        float match;
        float misMatch;
        Sequence* emptySequence;
+       GlobalData* globaldata;
 };
 
 #endif
index b9360a4468a9aedd553675d9d3a2110afa6feab7..23e3f6e119af2add01b95aa0d8c41f710b9b0a96 100644 (file)
@@ -16,10 +16,11 @@ using namespace std;
 
 /***********************************************************************/
 
-InteractEngine::InteractEngine(){
+InteractEngine::InteractEngine(string path){
 
        globaldata = GlobalData::getInstance();
-
+       globaldata->argv = path;
+       
        system("clear");
 //     char buffer = ' ';
 //     ifstream header("introtext.txt");
@@ -92,10 +93,11 @@ bool InteractEngine::getInput(){
 
 /***********************************************************************/
 //This function opens the batchfile to be used by BatchEngine::getInput.
-BatchEngine::BatchEngine(string batchFileName){
+BatchEngine::BatchEngine(string path, string batchFileName){
        try {
                globaldata = GlobalData::getInstance();
                openedBatch = openInputFile(batchFileName, inputBatchFile);
+               globaldata->argv = path;
 
                system("clear");
        
index a35b616e6cce63d541684e057a76248481af29ca..276d29267a298dd7c2f52c9b550b3d9b37c555a0 100644 (file)
@@ -39,7 +39,7 @@ protected:
 
 class BatchEngine : public Engine {
 public:
-       BatchEngine(string);
+       BatchEngine(string, string);
        ~BatchEngine();
        virtual bool getInput();
        int openedBatch;
@@ -53,7 +53,7 @@ private:
 
 class InteractEngine : public Engine {
 public:
-       InteractEngine();
+       InteractEngine(string);
        ~InteractEngine();
        virtual bool getInput();
 private:
index c4bfe0519c8fb23c25304e5cbf936041d75da19a..0c2548971555b599ea87eba61623fb2dfcf9a8ac 100644 (file)
@@ -41,7 +41,7 @@ public:
        FullMatrix* gMatrix;
        TreeMap* gTreemap;
        SequenceDB* gSequenceDB;
-       string inputFileName, helpRequest, commandName, vertical;
+       string inputFileName, helpRequest, commandName, vertical, argv;
        bool allLines;
        vector<string>  Estimators, Groups; //holds estimators to be used
        set<int> lines; //hold lines to be used
index c60644d027d7fee1f1e18ce90b5a4458c411ef3b..add60fa22f5c9a95137b651cf694dd6f27132ad7 100644 (file)
@@ -26,10 +26,10 @@ int main(int argc, char *argv[]){
                bool bail = 0;
 
                if(argc>1){
-                       mothur = new BatchEngine(argv[1]);
+                       mothur = new BatchEngine(argv[0], argv[1]);
                }
                else{
-                       mothur = new InteractEngine();          
+                       mothur = new InteractEngine(argv[0]);           
                }
 
                while(bail == 0)                {       bail = mothur->getInput();                      }