]> git.donarmstrong.com Git - mothur.git/blobdiff - chimeraslayercommand.cpp
another pds fix to sffinfo
[mothur.git] / chimeraslayercommand.cpp
index ae98ff3075e691e0db5c5fcedd288f10da14cb9f..321883be75a2a165bfc61e3e34a97c7de95e37cb 100644 (file)
@@ -29,7 +29,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                        OptionParser parser(option);
                        map<string,string> parameters = parser.getParameters();
                        
-                       ValidParameters validParameter;
+                       ValidParameters validParameter("chimera.slayer");
                        map<string,string>::iterator it;
                        
                        //check to make sure all parameters are valid for command
@@ -77,7 +77,17 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                                                if (pid == 0) {
                                        #endif
 
-                                       ableToOpen = openInputFile(fastaFileNames[i], in);
+                                       ableToOpen = openInputFile(fastaFileNames[i], in, "noerror");
+                               
+                                       //if you can't open it, try default location
+                                       if (ableToOpen == 1) {
+                                               if (m->getDefaultPath() != "") { //default path is set
+                                                       string tryPath = m->getDefaultPath() + getSimpleName(fastaFileNames[i]);
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                       ableToOpen = openInputFile(tryPath, in, "noerror");
+                                                       fastaFileNames[i] = tryPath;
+                                               }
+                                       }
                                        in.close();
                                        
                                        #ifdef USE_MPI  
@@ -92,7 +102,7 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                                        #endif
 
                                        if (ableToOpen == 1) { 
-                                               m->mothurOut(fastaFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); 
+                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
                                                //erase from file list
                                                fastaFileNames.erase(fastaFileNames.begin()+i);
                                                i--;
@@ -243,7 +253,7 @@ int ChimeraSlayerCommand::execute(){
                #ifdef USE_MPI  
                        int pid, end, numSeqsPerProcessor; 
                                int tag = 2001;
-                               vector<long> MPIPos;
+                               vector<unsigned long int> MPIPos;
                                
                                MPI_Status status; 
                                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
@@ -357,7 +367,7 @@ int ChimeraSlayerCommand::execute(){
                                        }
                                        
                                }else{
-                                       vector<int> positions;
+                                       vector<unsigned long int> positions;
                                        processIDS.resize(0);
                                        
                                        ifstream inFASTA;
@@ -367,7 +377,7 @@ int ChimeraSlayerCommand::execute(){
                                        while(!inFASTA.eof()){
                                                input = getline(inFASTA);
                                                if (input.length() != 0) {
-                                                       if(input[0] == '>'){    long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1);  }
+                                                       if(input[0] == '>'){    unsigned long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); }
                                                }
                                        }
                                        inFASTA.close();
@@ -377,7 +387,7 @@ int ChimeraSlayerCommand::execute(){
                                        int numSeqsPerProcessor = numSeqs / processors;
                                        
                                        for (int i = 0; i < processors; i++) {
-                                               long int startPos = positions[ i * numSeqsPerProcessor ];
+                                               unsigned long int startPos = positions[ i * numSeqsPerProcessor ];
                                                if(i == processors - 1){
                                                        numSeqsPerProcessor = numSeqs - i * numSeqsPerProcessor;
                                                }
@@ -519,7 +529,7 @@ int ChimeraSlayerCommand::driver(linePair* line, string outputFName, string file
 }
 //**********************************************************************************************************************
 #ifdef USE_MPI
-int ChimeraSlayerCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& outMPI, MPI_File& outAccMPI, vector<long>& MPIPos){
+int ChimeraSlayerCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& outMPI, MPI_File& outAccMPI, vector<unsigned long int>& MPIPos){
        try {                           
                MPI_Status status; 
                int pid;