//**********************************************************************************************************************
GetLineageCommand::GetLineageCommand(){
try {
- abort = true;
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
outputTypes["taxonomy"] = tempOutNames;
//**********************************************************************************************************************
GetLineageCommand::GetLineageCommand(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 GetLineageCommand::execute(){
try {
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
if (m->control_pressed) { return 0; }
m->openInputFile(taxfile, in);
string name, tax;
- bool wroteSomething = false;
+ //bool wroteSomething = false;
bool taxonsHasConfidence = false;
vector< map<string, int> > searchTaxons;
int openParen = taxon.find_first_of('(');
int closeParen = taxon.find_last_of(')');
- string newtaxon = taxon.substr(0, openParen); //rip off confidence
- string confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ string newtaxon, confidence;
+ if ((openParen != string::npos) && (closeParen != string::npos)) {
+ newtaxon = taxon.substr(0, openParen); //rip off confidence
+ confidence = taxon.substr((openParen+1), (closeParen-openParen-1));
+ }else{
+ newtaxon = taxon;
+ confidence = "0";
+ }
int con = 0;
convert(confidence, con);