X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=listseqscommand.cpp;h=a8a9d2b5a6cff6da2ab8e86e22af19782f5ce0bf;hb=348de0f8b17d84ede77081dcf67bd6ef43496677;hp=1488cdadac766b243252e87053a0132975961884;hpb=4ad32478c7b1bbb464c839a6e133f5b517a3efec;p=mothur.git diff --git a/listseqscommand.cpp b/listseqscommand.cpp index 1488cda..a8a9d2b 100644 --- a/listseqscommand.cpp +++ b/listseqscommand.cpp @@ -26,8 +26,7 @@ vector ListSeqsCommand::getValidParameters(){ //********************************************************************************************************************** ListSeqsCommand::ListSeqsCommand(){ try { - abort = true; - //initialize outputTypes + abort = true; calledHelp = true; vector tempOutNames; outputTypes["accnos"] = tempOutNames; } @@ -63,10 +62,10 @@ vector ListSeqsCommand::getRequiredFiles(){ ListSeqsCommand::ListSeqsCommand(string option) { try { - abort = false; + abort = false; calledHelp = false; //allow user to run help - if(option == "help") { help(); abort = true; } + if(option == "help") { help(); abort = true; calledHelp = true; } else { //valid paramters for this command @@ -206,7 +205,7 @@ void ListSeqsCommand::help(){ int ListSeqsCommand::execute(){ try { - if (abort == true) { return 0; } + if (abort == true) { if (calledHelp) { return 0; } return 2; } //read functions fill names vector if (fastafile != "") { inputFileName = fastafile; readFasta(); } @@ -227,6 +226,7 @@ int ListSeqsCommand::execute(){ ofstream out; m->openOutputFile(outputFileName, out); + outputNames.push_back(outputFileName); outputTypes["accnos"].push_back(outputFileName); //output to .accnos file for (int i = 0; i < names.size(); i++) { @@ -238,12 +238,21 @@ int ListSeqsCommand::execute(){ out.close(); if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; } - + + m->setAccnosFile(outputFileName); + m->mothurOutEndLine(); m->mothurOut("Output File Name: "); m->mothurOutEndLine(); - m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["accnos"].push_back(outputFileName); + m->mothurOut(outputFileName); m->mothurOutEndLine(); m->mothurOutEndLine(); + //set accnos file as new current accnosfile + string current = ""; + itTypes = outputTypes.find("accnos"); + if (itTypes != outputTypes.end()) { + if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); } + } + return 0; } @@ -260,7 +269,7 @@ int ListSeqsCommand::readFasta(){ ifstream in; m->openInputFile(fastafile, in); string name; - + while(!in.eof()){ if (m->control_pressed) { in.close(); return 0; } @@ -445,6 +454,7 @@ int ListSeqsCommand::readTax(){ names.push_back(firstCol); m->gobble(in); + } in.close();