+ namefile = validParameter.validFile(parameters, "name", false);
+ if (namefile == "not found") { namefile = ""; }
+ else {
+ splitAtDash(namefile, nameFileNames);
+
+ //go through files and make sure they are good, if not, then disregard them
+ for (int i = 0; i < nameFileNames.size(); i++) {
+ if (inputDir != "") {
+ string path = hasPath(nameFileNames[i]);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { nameFileNames[i] = inputDir + nameFileNames[i]; }
+ }
+
+ int ableToOpen;
+ ifstream in;
+
+ #ifdef USE_MPI
+ int pid;
+ MPI_Comm_size(MPI_COMM_WORLD, &processors); //set processors to the number of mpi processes running
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
+
+ if (pid == 0) {
+ #endif
+
+ ableToOpen = openInputFile(nameFileNames[i], in);
+ in.close();
+
+ #ifdef USE_MPI
+ for (int j = 1; j < processors; j++) {
+ MPI_Send(&ableToOpen, 1, MPI_INT, j, 2001, MPI_COMM_WORLD);
+ }
+ }else{
+ MPI_Status status;
+ MPI_Recv(&ableToOpen, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status);
+ }
+
+ #endif
+
+ if (ableToOpen == 1) {
+ m->mothurOut(nameFileNames[i] + " will be disregarded."); m->mothurOutEndLine();
+ //erase from file list
+ nameFileNames.erase(nameFileNames.begin()+i);
+ i--;
+ }
+
+ }
+
+ //make sure there is at least one valid file left
+ if (nameFileNames.size() != 0) {
+ if (nameFileNames.size() != fastaFileNames.size()) {
+ m->mothurOut("Different number of valid name files and fasta files, aborting command."); m->mothurOutEndLine();
+ abort = true;
+ }
+ }
+ }