]> git.donarmstrong.com Git - mothur.git/blobdiff - aligncommand.cpp
another pds fix to sffinfo
[mothur.git] / aligncommand.cpp
index 8d1b40f37cd7eb9edfc708e3b9e856092de5eb5a..f19810e131b687ea372ae1914ecf3a02d03ef8d8 100644 (file)
@@ -45,7 +45,7 @@ AlignCommand::AlignCommand(string option)  {
                        OptionParser parser(option);
                        map<string, string> parameters = parser.getParameters(); 
                        
-                       ValidParameters validParameter;
+                       ValidParameters validParameter("align.seqs");
                        map<string, string>::iterator it;
                        
                        //check to make sure all parameters are valid for command
@@ -107,9 +107,18 @@ AlignCommand::AlignCommand(string option)  {
                                                if (pid == 0) {
                                        #endif
 
-                                       ableToOpen = openInputFile(candidateFileNames[i], in);
-                                       in.close();
-                                       
+                                       ableToOpen = openInputFile(candidateFileNames[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(candidateFileNames[i]);
+                                                       m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                       ableToOpen = openInputFile(tryPath, in, "noerror");
+                                                       candidateFileNames[i] = tryPath;
+                                               }
+                                       }
+                                       in.close();                                     
                                        #ifdef USE_MPI  
                                                        for (int j = 1; j < processors; j++) {
                                                                MPI_Send(&ableToOpen, 1, MPI_INT, j, 2001, MPI_COMM_WORLD); 
@@ -122,7 +131,7 @@ AlignCommand::AlignCommand(string option)  {
                                        #endif
 
                                        if (ableToOpen == 1) { 
-                                               m->mothurOut(candidateFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); 
+                                               m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
                                                //erase from file list
                                                candidateFileNames.erase(candidateFileNames.begin()+i);
                                                i--;
@@ -252,7 +261,7 @@ int AlignCommand::execute(){
 #ifdef USE_MPI 
                                int pid, end, numSeqsPerProcessor; 
                                int tag = 2001;
-                               vector<long> MPIPos;
+                               vector<unsigned long int> MPIPos;
                                MPIWroteAccnos = false;
                                
                                MPI_Status status; 
@@ -637,7 +646,7 @@ int AlignCommand::driver(linePair* line, string alignFName, string reportFName,
 }
 //**********************************************************************************************************************
 #ifdef USE_MPI
-int AlignCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& alignFile, MPI_File& reportFile, MPI_File& accnosFile, vector<long>& MPIPos){
+int AlignCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& alignFile, MPI_File& reportFile, MPI_File& accnosFile, vector<unsigned long int>& MPIPos){
        try {
                string outputString = "";
                MPI_Status statusReport;