From: westcott Date: Wed, 8 Sep 2010 15:36:06 +0000 (+0000) Subject: testing 1.13.0 X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=a76d81690125ca57d7f602ac93abad75cf9796c2 testing 1.13.0 --- diff --git a/chimerapintailcommand.cpp b/chimerapintailcommand.cpp index a8a85eb..398d37a 100644 --- a/chimerapintailcommand.cpp +++ b/chimerapintailcommand.cpp @@ -131,9 +131,21 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option) { } 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; + } } @@ -159,6 +171,15 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option) { 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(); + } + } } } @@ -242,14 +263,34 @@ int ChimeraPintailCommand::execute(){ 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"; diff --git a/chimeraslayer.cpp b/chimeraslayer.cpp index 1bfdafe..3497579 100644 --- a/chimeraslayer.cpp +++ b/chimeraslayer.cpp @@ -67,10 +67,11 @@ int ChimeraSlayer::doPrep() { //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++) { diff --git a/clearcutcommand.cpp b/clearcutcommand.cpp index eabcc73..5903946 100644 --- a/clearcutcommand.cpp +++ b/clearcutcommand.cpp @@ -231,7 +231,7 @@ int ClearcutCommand::execute() { 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); @@ -262,7 +262,7 @@ int ClearcutCommand::execute() { 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(); } diff --git a/cmdargs.cpp b/cmdargs.cpp index 416ced8..4812442 100644 --- a/cmdargs.cpp +++ b/cmdargs.cpp @@ -70,6 +70,8 @@ NJ_handle_args(int argc, 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[] = { @@ -139,7 +141,8 @@ NJ_handle_args(int argc, 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: diff --git a/getopt_long.cpp b/getopt_long.cpp index c113881..3baa3ce 100644 --- a/getopt_long.cpp +++ b/getopt_long.cpp @@ -101,14 +101,15 @@ insert_argv(char **argv, int src, int dest) 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; } @@ -122,10 +123,13 @@ search_longopt(char *arg, struct option *longopts) ; 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; diff --git a/hcluster.cpp b/hcluster.cpp index e1830cd..597aac8 100644 --- a/hcluster.cpp +++ b/hcluster.cpp @@ -517,7 +517,7 @@ int HCluster::combineFile() { //in = fopen(distfile.c_str(), "rb"); ifstream in; - m->openInputFile(distfile, in); + m->openInputFile(distfile, in, "no error"); int first, second; float dist; @@ -741,7 +741,7 @@ int HCluster::processFile() { float distance; ifstream in; - m->openInputFile(distfile, in); + m->openInputFile(distfile, in, "no error"); ofstream out; string outTemp = distfile + ".temp"; diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 61e2939..7e77980 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -264,11 +264,11 @@ int HeatMapSimCommand::runCommandShared() { //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. @@ -315,7 +315,8 @@ int HeatMapSimCommand::runCommandShared() { //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } - lookup = input->getSharedRAbundVectors(); + lookup = input->getSharedRAbundVectors(); + } @@ -352,10 +353,10 @@ int HeatMapSimCommand::runCommandShared() { //reset groups parameter globaldata->Groups.clear(); - + delete input; globaldata->ginput = NULL; delete read; - + return 0; } catch(exception& e) { diff --git a/inputdata.cpp b/inputdata.cpp index a4d6692..5d71450 100644 --- a/inputdata.cpp +++ b/inputdata.cpp @@ -26,6 +26,8 @@ InputData::InputData(string fName, string f) : format(f){ InputData::~InputData(){ fileHandle.close(); + globaldata = GlobalData::getInstance(); + globaldata->saveNextLabel = ""; // delete output; } diff --git a/inputdata.h b/inputdata.h index 658b21d..ccf3551 100644 --- a/inputdata.h +++ b/inputdata.h @@ -46,6 +46,7 @@ private: map orderMap; string filename; MothurOut* m; + GlobalData* globaldata; }; diff --git a/splitabundcommand.cpp b/splitabundcommand.cpp index 9679642..1780963 100644 --- a/splitabundcommand.cpp +++ b/splitabundcommand.cpp @@ -366,11 +366,11 @@ int SplitAbundCommand::writeList(ListVector* thisList) { 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'; } diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index e47e71d..320bc41 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -428,10 +428,10 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string vector fastaFileNames; vector 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 != ""){ @@ -445,17 +445,17 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string #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) {