From 15bc21bb4281af0f3ea7b29d9b9363f4635ef939 Mon Sep 17 00:00:00 2001 From: westcott Date: Sat, 4 Sep 2010 00:24:30 +0000 Subject: [PATCH] working on testing for 1.13 --- chopseqscommand.cpp | 6 +++--- degapseqscommand.cpp | 4 +++- makegroupcommand.cpp | 11 +++++++---- treegroupscommand.cpp | 6 ++---- trimseqscommand.cpp | 3 +-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/chopseqscommand.cpp b/chopseqscommand.cpp index 12e48f4..b281074 100644 --- a/chopseqscommand.cpp +++ b/chopseqscommand.cpp @@ -35,9 +35,6 @@ ChopSeqsCommand::ChopSeqsCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } - //if the user changes the output directory command factory will send this info to us in the output parameter - outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } - //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); if (inputDir == "not found"){ inputDir = ""; } @@ -57,6 +54,9 @@ ChopSeqsCommand::ChopSeqsCommand(string option) { if (fastafile == "not open") { abort = true; } else if (fastafile == "not found") { m->mothurOut("You must provide a fasta file."); m->mothurOutEndLine(); abort = true; } + //if the user changes the output directory command factory will send this info to us in the output parameter + outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = m->hasPath(fastafile); } + string temp = validParameter.validFile(parameters, "numbases", false); if (temp == "not found") { temp = "0"; } convert(temp, numbases); diff --git a/degapseqscommand.cpp b/degapseqscommand.cpp index 6a9c25e..e475727 100644 --- a/degapseqscommand.cpp +++ b/degapseqscommand.cpp @@ -131,7 +131,9 @@ int DegapSeqsCommand::execute(){ m->openInputFile(fastaFileNames[s], inFASTA); ofstream outFASTA; - string degapFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "ng.fasta"; + string tempOutputDir = outputDir; + if (outputDir == "") { tempOutputDir = m->hasPath(fastaFileNames[s]); } + string degapFile = tempOutputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "ng.fasta"; m->openOutputFile(degapFile, outFASTA); while(!inFASTA.eof()){ diff --git a/makegroupcommand.cpp b/makegroupcommand.cpp index 1a2ffe6..41762ab 100644 --- a/makegroupcommand.cpp +++ b/makegroupcommand.cpp @@ -37,10 +37,6 @@ MakeGroupCommand::MakeGroupCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } - //if the user changes the output directory command factory will send this info to us in the output parameter - outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } - - //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); if (inputDir == "not found"){ inputDir = ""; } @@ -88,6 +84,9 @@ MakeGroupCommand::MakeGroupCommand(string option) { if (fastaFileNames.size() == 0) { m->mothurOut("no valid files."); m->mothurOutEndLine(); abort = true; } } + //if the user changes the output directory command factory will send this info to us in the output parameter + outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } + groups = validParameter.validFile(parameters, "groups", false); if (groups == "not found") { m->mothurOut("groups is a required parameter for the make.group command."); m->mothurOutEndLine(); abort = true; } else { m->splitAtDash(groups, groupsNames); } @@ -130,6 +129,10 @@ int MakeGroupCommand::execute(){ try { if (abort == true) { return 0; } + if (outputDir == "") { outputDir = m->hasPath(fastaFileNames[0]); } + + filename = outputDir + filename; + ofstream out; m->openOutputFile(filename, out); diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 637ecce..3403b99 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -50,8 +50,6 @@ TreeGroupCommand::TreeGroupCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } - globaldata->newRead(); - //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); if (inputDir == "not found"){ inputDir = ""; } @@ -88,12 +86,12 @@ TreeGroupCommand::TreeGroupCommand(string option) { phylipfile = validParameter.validFile(parameters, "phylip", true); if (phylipfile == "not open") { abort = true; } else if (phylipfile == "not found") { phylipfile = ""; } - else { format = "phylip"; globaldata->setPhylipFile(phylipfile); } + else { globaldata->newRead(); format = "phylip"; globaldata->setPhylipFile(phylipfile); } columnfile = validParameter.validFile(parameters, "column", true); if (columnfile == "not open") { abort = true; } else if (columnfile == "not found") { columnfile = ""; } - else { format = "column"; globaldata->setColumnFile(columnfile); } + else { globaldata->newRead(); format = "column"; globaldata->setColumnFile(columnfile); } namefile = validParameter.validFile(parameters, "name", true); if (namefile == "not open") { abort = true; } diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index acdf475..e47e71d 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -224,9 +224,8 @@ int TrimSeqsCommand::execute(){ string scrapSeqFile = outputDir + m->getRootName(m->getSimpleName(fastaFile)) + "scrap.fasta"; outputNames.push_back(scrapSeqFile); string trimQualFile = outputDir + m->getRootName(m->getSimpleName(fastaFile)) + "trim.qual"; - outputNames.push_back(trimQualFile); string scrapQualFile = outputDir + m->getRootName(m->getSimpleName(fastaFile)) + "scrap.qual"; - outputNames.push_back(scrapQualFile); + if (qFileName != "") { outputNames.push_back(trimQualFile); outputNames.push_back(scrapQualFile); } string groupFile = outputDir + m->getRootName(m->getSimpleName(fastaFile)) + "groups"; vector fastaFileNames; -- 2.39.2