}
ifstream in;
- int ableToOpen = m->openInputFile(maskfile, in);
- if (ableToOpen == 1) { abort = true; }
- in.close();
+ int ableToOpen = m->openInputFile(maskfile, in, "no error");
+ if (ableToOpen == 1) {
+ 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");
+ maskfile = tryPath;
+ }
+ }
+ in.close();
+
+ if (ableToOpen == 1) {
+ m->mothurOut("Unable to open " + maskfile + "."); m->mothurOutEndLine();
+ abort = true;
+ }
}
if (GoodFile) {
m->mothurOut("I found " + tempConsFile + " in your input file directory. I will use it to save time."); m->mothurOutEndLine(); consfile = tempConsFile; FileTest.close();
}
+ }else {
+ string tempConsFile = m->getDefaultPath() + m->getRootName(m->getSimpleName(templatefile)) + "freq";
+ ifstream FileTest2(tempConsFile.c_str());
+ if(FileTest2){
+ bool GoodFile = m->checkReleaseVersion(FileTest2, m->getVersion());
+ if (GoodFile) {
+ m->mothurOut("I found " + tempConsFile + " in your input file directory. I will use it to save time."); m->mothurOutEndLine(); consfile = tempConsFile; FileTest2.close();
+ }
+ }
}
}
if (GoodFile) {
m->mothurOut("I found " + tempQuan + " in your input file directory. I will use it to save time."); m->mothurOutEndLine(); quanfile = tempQuan; FileTest.close();
}
+ }else {
+ string tryPath = m->getDefaultPath();
+ string tempQuan = "";
+ if ((!filter) && (maskfile == "")) {
+ tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.quan";
+ }else if ((!filter) && (maskfile != "")) {
+ tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.masked.quan";
+ }else if ((filter) && (maskfile != "")) {
+ tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastaFileNames[s])) + "masked.quan";
+ }else if ((filter) && (maskfile == "")) {
+ tempQuan = tryPath + m->getRootName(m->getSimpleName(templatefile)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastaFileNames[s])) + "quan";
+ }
+
+ ifstream FileTest2(tempQuan.c_str());
+ if(FileTest2){
+ bool GoodFile = m->checkReleaseVersion(FileTest2, m->getVersion());
+ if (GoodFile) {
+ m->mothurOut("I found " + tempQuan + " in your input file directory. I will use it to save time."); m->mothurOutEndLine(); quanfile = tempQuan; FileTest2.close();
+ }
+ }
}
chimera = new Pintail(fastaFileNames[s], templatefile, filter, processors, maskfile, consfile, quanfile, window, increment, outputDir);
string outputFileName, accnosFileName;
if (maskfile != "") {
- outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + maskfile + ".pintail.chimeras";
- accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + maskfile + ".pintail.accnos";
+ outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.chimeras";
+ accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.accnos";
}else {
outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "pintail.chimeras";
accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "pintail.accnos";
//generate the kmerdb to pass to maligner
if (searchMethod == "kmer") {
- string rightTemplateFileName = "right." + templateFileName;
+ string templatePath = m->hasPath(templateFileName);
+ string rightTemplateFileName = templatePath + "right." + m->getRootName(m->getSimpleName(templateFileName));
databaseRight = new KmerDB(rightTemplateFileName, kmerSize);
- string leftTemplateFileName = "left." + templateFileName;
+ string leftTemplateFileName = templatePath + "left." + m->getRootName(m->getSimpleName(templateFileName));
databaseLeft = new KmerDB(leftTemplateFileName, kmerSize);
#ifdef USE_MPI
for (int i = 0; i < templateSeqs.size(); i++) {
if (jukes) { char* temp = new char[7]; strcpy(temp, "--jukes"); cPara.push_back(temp); }
if (kimura) { char* temp = new char[8]; strcpy(temp, "--kimura"); cPara.push_back(temp); }
if (matrixout != "") {
- string tempMatrix = "--matrixout=" + matrixout;
+ string tempMatrix = "--matrixout=" + outputDir + matrixout;
char* temp = new char[tempMatrix.length()];
strcpy(temp, tempMatrix.c_str());
cPara.push_back(temp);
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
m->mothurOut(outputName); m->mothurOutEndLine();
- if (matrixout != "") { m->mothurOut(matrixout); m->mothurOutEndLine(); }
+ if (matrixout != "") { m->mothurOut(outputDir+matrixout); m->mothurOutEndLine(); }
m->mothurOutEndLine();
}
static NJ_ARGS nj_args;
int option_index, c;
+
+ optind = 0; //neccasary to read in arguments if code is run more than once
struct option NJ_long_options[] = {
if(c == -1) {
break;
}
-
+//printf("%d\t%d\n", option_index, argc);
+//for (int red = 0; red < argc; red++) { printf("%s\n", argv[red]); }
switch(c) {
case 0:
if (src > dest) {
for (i = src; i > dest; i--)
- argv[i] = argv[i-1];
+ argv[i] = argv[i-1]; //printf("%s\n", argv[i]);
}
if (src < dest) {
for (i = src; i < dest; i++)
- argv[i] = argv[i+1];
+ argv[i] = argv[i+1]; //printf("%s\n", argv[i]);
}
argv[dest] = tmp;
+ //printf("%s\n", argv[dest]);
return 0;
}
;
for (i = 0; longopts[i].name; i++) {
+ //printf("%d\t%s\t", i, longopts[i].name);
+ //printf("%s\n", arg);
if (strncmp(arg, longopts[i].name, len) == 0) {
if (found != -1)
return -1; /* found some candidate */
found = i;
+ //printf("found = %d\n", found);
}
}
return found;
//in = fopen(distfile.c_str(), "rb");
ifstream in;
- m->openInputFile(distfile, in);
+ m->openInputFile(distfile, in, "no error");
int first, second;
float dist;
float distance;
ifstream in;
- m->openInputFile(distfile, in);
+ m->openInputFile(distfile, in, "no error");
ofstream out;
string outTemp = distfile + ".temp";
//you have groups
read = new ReadOTUFile(globaldata->inputFileName);
read->read(&*globaldata);
-
+
input = globaldata->ginput;
lookup = input->getSharedRAbundVectors();
string lastLabel = lookup[0]->getLabel();
-
+
if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups. I cannot run the command."); m->mothurOutEndLine(); return 0;}
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
//get next line to process
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
- lookup = input->getSharedRAbundVectors();
+ lookup = input->getSharedRAbundVectors();
+
}
//reset groups parameter
globaldata->Groups.clear();
-
+
delete input; globaldata->ginput = NULL;
delete read;
-
+
return 0;
}
catch(exception& e) {
InputData::~InputData(){
fileHandle.close();
+ globaldata = GlobalData::getInstance();
+ globaldata->saveNextLabel = "";
// delete output;
}
map<string,int> orderMap;
string filename;
MothurOut* m;
+ GlobalData* globaldata;
};
string rare = outputDir + m->getRootName(m->getSimpleName(listfile)) + "rare.list";
m->openOutputFileAppend(rare, rout);
- outputNames.push_back(rare);
+ //outputNames.push_back(rare);
string abund = outputDir + m->getRootName(m->getSimpleName(listfile)) + "abund.list";
m->openOutputFileAppend(abund, aout);
- outputNames.push_back(abund);
+ //outputNames.push_back(abund);
if (rareNames.size() != 0) { rout << thisList->getLabel() << '\t' << numRareBins << '\t'; }
if (abundNames.size() != 0) { aout << thisList->getLabel() << '\t' << numAbundBins << '\t'; }
vector<ofstream*> fastaFileNames;
vector<ofstream*> qualFileNames;
- cout << "here" << endl;
if (oligoFile != "") {
m->openOutputFile(groupFile, outGroups);
for (int i = 0; i < fastaNames.size(); i++) {
+
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(getpid()) + ".temp").c_str(), ios::ate));
if(qFileName != ""){
#endif
}
}
-cout << "here " << filename << endl;
+
ifstream inFASTA;
m->openInputFile(filename, inFASTA);
inFASTA.seekg(line->start);
- cout << "here " << qFileName << endl;
+
ifstream qFile;
if(qFileName != "") { m->openInputFile(qFileName, qFile); qFile.seekg(qline->start); }
bool done = false;
int count = 0;
- cout << "here" << endl;
+
while (!done) {
if (m->control_pressed) {