int ableToOpen;
ifstream in;
-
ableToOpen = m->openInputFile(candidateFileNames[i], in, "noerror");
-
+ in.close();
+
//if you can't open it, try default location
if (ableToOpen == 1) {
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(candidateFileNames[i]);
m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
candidateFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(candidateFileNames[i]);
m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
candidateFileNames[i] = tryPath;
}
}
- in.close();
+
if (ableToOpen == 1) {
m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
nameFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
nameFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(maskfile);
m->mothurOut("Unable to open " + maskfile + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
maskfile = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(maskfile);
m->mothurOut("Unable to open " + maskfile + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
maskfile = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(namefileNames[i]);
m->mothurOut("Unable to open " + namefileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
namefileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(namefileNames[i]);
m->mothurOut("Unable to open " + namefileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
namefileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(groupfileNames[i]);
m->mothurOut("Unable to open " + groupfileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
groupfileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(groupfileNames[i]);
m->mothurOut("Unable to open " + groupfileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
groupfileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastafileNames[i]);
m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastafileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastafileNames[i]);
m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastafileNames[i] = tryPath;
}
}
//**********************************************************************************************************************
vector<string> GetLineageCommand::getRequiredParameters(){
try {
- string Array[] = {"taxonomy"};
+ string Array[] = {"taxonomy","taxon"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
return myArray;
}
MOTHUR_FILES = "\"../Release\""
-RELEASE_DATE = "\"9/17/2010\""
-VERSION = "\"1.13.0\""
+RELEASE_DATE = "\"10/22/2010\""
+VERSION = "\"1.14.0\""
CXXFLAGS += -DRELEASE_DATE=${RELEASE_DATE} -DVERSION=${VERSION}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (! seeded) {
seeded = 1;
- srandom(time(NULL));
+ srand(time(NULL));
}
for (i = 0; i < n; i++) {
- int selection = random() % (n - i);
+ int selection = rand() % (n - i);
int tmp = array[i + selection];
array[i + selection] = array[i];
array[i] = tmp;
//make sure the user has already run the read.otu command
if ((globaldata->getSharedFile() == "")) {
- m->mothurOut("You must read a list and a group, or a shared file before you can use the normalize.shared command."); m->mothurOutEndLine(); abort = true;
+ m->mothurOut("You must read a list and a group, or a shared file before you can use the metastats command."); m->mothurOutEndLine(); abort = true;
}
//check for optional parameter and set defaults
m->mothurOut("The method parameter allows you to select what method you would like to use to normalize. The only choice is totalgroup. We hope to add more ways to normalize in the future, suggestions are welcome!\n");
m->mothurOut("The norm parameter allows you to number you would like to normalize to. By default this is set to the number of sequences in your smallest group.\n");
m->mothurOut("The normalize.shared command should be in the following format: normalize.shared(groups=yourGroups, label=yourLabels).\n");
- m->mothurOut("Example normalize.shared(groups=A-B-C, scale=averagegroup).\n");
+ m->mothurOut("Example normalize.shared(groups=A-B-C, scale=totalgroup).\n");
m->mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n");
m->mothurOut("The normalize.shared command outputs a .norm.shared file.\n");
m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
//fill in mothurmade filenames
for (it = parameters.begin(); it != parameters.end(); it++) {
+ string paraType = it->first;
+
if (it->second == "mothurmade") {
- itMade = mothurMadeFiles.find(it->first);
+
+ if (it->first == "candidate") { paraType = "fasta"; }
+
+ itMade = mothurMadeFiles.find(paraType);
if (itMade == mothurMadeFiles.end()) {
- m->mothurOut("Looking for a mothurmade " + it->first + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine();
+ m->mothurOut("Looking for a mothurmade " + paraType + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine();
return true;
}else{
vector<string> temp = itMade->second;
if (temp.size() > 1) {
//ask user which file to use
- m->mothurOut("More than one file has been created for the " + it->first + " parameter. "); m->mothurOutEndLine();
+ m->mothurOut("More than one file has been created for the " + paraType + " parameter. "); m->mothurOutEndLine();
for (int i = 0; i < temp.size(); i++) {
m->mothurOut(toString(i) + " - " + temp[i]); m->mothurOutEndLine();
}
if ((num < 0) || (num > (temp.size()-1))) { m->mothurOut("Not a valid response, quitting."); m->mothurOutEndLine(); return true; }
else {
- parameters[it->first] = temp[num];
+ parameters[paraType] = temp[num];
}
//clears buffer so next command doesn't have error
getline(cin, s);
}else if (temp.size() == 0){
- m->mothurOut("Sorry, we seem to think you created a " + it->first + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine();
+ m->mothurOut("Sorry, we seem to think you created a " + paraType + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine();
return true;
}else{
- parameters[it->first] = temp[0];
+ parameters[paraType] = temp[0];
}
}
}
- options += it->first + "=" + parameters[it->first] + ", ";
+ options += it->first + "=" + parameters[paraType] + ", ";
}
//rip off extra comma
//sff.info command
string thisCommand = "sffinfo(sff=" + sffFile + ")";
- //commands.push_back(thisCommand);
+ commands.push_back(thisCommand);
//trim.seqs command
string fastaFile = m->getRootName(m->getSimpleName(sffFile)) + "fasta";
string qualFile = m->getRootName(m->getSimpleName(sffFile)) + "qual";
- //thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=" + qualFile + ")";
- //commands.push_back(thisCommand);
+ thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=" + qualFile + ")";
+ commands.push_back(thisCommand);
//unique.seqs
string groupFile = m->getRootName(m->getSimpleName(fastaFile)) + "groups";
out.close();
if (wroteSomething == false) { m->mothurOut("Your fasta file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["fasta"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
return 0;
out.close();
if (wroteSomething == false) { m->mothurOut("Your list file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["list"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
return 0;
out.close();
if (wroteSomething == false) { m->mothurOut("Your name file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["name"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
return 0;
}
out.close();
if (wroteSomething == false) { m->mothurOut("Your group file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["group"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName);
return 0;
}
out.close();
if (!wroteSomething) { m->mothurOut("Your taxonomy file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["taxonomy"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName);
return 0;
out.close();
if (wroteSomething == false) { m->mothurOut("Your align file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); }
- outputTypes["alignreport"].push_back(outputFileName);
+ outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName);
return 0;
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(filenames[i]);
m->mothurOut("Unable to open " + filenames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
filenames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(filenames[i]);
m->mothurOut("Unable to open " + filenames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
filenames[i] = tryPath;
}
}
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(accnosFileNames[i]);
m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
accnosFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(accnosFileNames[i]);
m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
accnosFileNames[i] = tryPath;
}
}
string ValidParameters::validFile(map<string, string>& container, string parameter, bool isFile) {
try {
int ableToOpen;
- ifstream in;
+
map<string, string>::iterator it;
it = container.find(parameter);
if (pid == 0) {
#endif
-
+ ifstream in;
ableToOpen = m->openInputFile(it->second, in, "noerror");
+ in.close();
//if you can't open it, try default location
if (ableToOpen == 1) {
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(it->second);
m->mothurOut("Unable to open " + it->second + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
container[parameter] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(it->second);
m->mothurOut("Unable to open " + it->second + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
container[parameter] = tryPath;
+ in2.close();
}
}
- in.close();
+
#ifdef USE_MPI
for(int i = 1; i < processors; i++) {