//**********************************************************************************************************************
ListSeqsCommand::ListSeqsCommand(){
try {
- abort = true;
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["accnos"] = tempOutNames;
}
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
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(); }
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++) {
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;
}
ifstream in;
m->openInputFile(fastafile, in);
string name;
-
+
while(!in.eof()){
if (m->control_pressed) { in.close(); return 0; }
if (m->control_pressed) { in.close(); return 0; }
- in >> name; //read from first column
+ in >> name; m->gobble(in); //read from first column
in >> group; //read from second column
names.push_back(name);
names.push_back(firstCol);
m->gobble(in);
+
}
in.close();