X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getlineagecommand.cpp;h=c2be580bb73313c91322e903c87027dc5da405d9;hb=2bb9267aa4b4ecdf8488b06605cc9f3f36fa4332;hp=0d836130d31124298a13c3a388267144cf5538ff;hpb=7bf9a81bba76538ecaf351ae208de3da4bf1b6dd;p=mothur.git diff --git a/getlineagecommand.cpp b/getlineagecommand.cpp index 0d83613..c2be580 100644 --- a/getlineagecommand.cpp +++ b/getlineagecommand.cpp @@ -168,12 +168,12 @@ GetLineageCommand::GetLineageCommand(string option) { //check for required parameters fastafile = validParameter.validFile(parameters, "fasta", true); - if (fastafile == "not open") { abort = true; } + if (fastafile == "not open") { fastafile = ""; abort = true; } else if (fastafile == "not found") { fastafile = ""; } else { m->setFastaFile(fastafile); } namefile = validParameter.validFile(parameters, "name", true); - if (namefile == "not open") { abort = true; } + if (namefile == "not open") { namefile = ""; abort = true; } else if (namefile == "not found") { namefile = ""; } else { m->setNameFile(namefile); } @@ -192,7 +192,7 @@ GetLineageCommand::GetLineageCommand(string option) { else { m->setListFile(listfile); } taxfile = validParameter.validFile(parameters, "taxonomy", true); - if (taxfile == "not open") { abort = true; } + if (taxfile == "not open") { taxfile = ""; abort = true; } else if (taxfile == "not found") { taxfile = m->getTaxonomyFile(); if (taxfile != "") { m->mothurOut("Using " + taxfile + " as input file for the taxonomy parameter."); m->mothurOutEndLine(); } @@ -217,6 +217,11 @@ GetLineageCommand::GetLineageCommand(string option) { m->splitAtChar(taxons, listOfTaxons, '-'); if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "") && (taxfile == "")) { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport, taxonomy or listfile."); m->mothurOutEndLine(); abort = true; } + + if ((namefile == "") && ((fastafile != "") || (taxfile != ""))){ + vector files; files.push_back(fastafile); files.push_back(taxfile); + parser.getNameFile(files); + } } } @@ -243,7 +248,7 @@ int GetLineageCommand::execute(){ if (listfile != "") { readList(); } - if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } + if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } if (outputNames.size() != 0) { m->mothurOutEndLine(); @@ -306,7 +311,7 @@ int GetLineageCommand::readFasta(){ while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } Sequence currSeq(in); name = currSeq.getName(); @@ -351,7 +356,7 @@ int GetLineageCommand::readList(){ while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } //read in list vector ListVector list(in); @@ -426,7 +431,7 @@ int GetLineageCommand::readName(){ while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } in >> firstCol; in >> secondCol; @@ -511,7 +516,7 @@ int GetLineageCommand::readGroup(){ while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } in >> name; //read from first column @@ -564,14 +569,15 @@ int GetLineageCommand::readTax(){ if (hasConPos != string::npos) { taxonsHasConfidence[i] = true; searchTaxons[i] = getTaxons(listOfTaxons[i]); - noConfidenceTaxons[i] = removeConfidences(listOfTaxons[i]); + noConfidenceTaxons[i] = listOfTaxons[i]; + m->removeConfidences(noConfidenceTaxons[i]); } } while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } in >> name; //read from first column in >> tax; //read from second column @@ -584,7 +590,8 @@ int GetLineageCommand::readTax(){ if (!taxonsHasConfidence[j]) { int hasConfidences = tax.find_first_of('('); if (hasConfidences != string::npos) { - newtax = removeConfidences(tax); + newtax = tax; + m->removeConfidences(newtax); } int pos = newtax.find(noConfidenceTaxons[j]); @@ -613,7 +620,8 @@ int GetLineageCommand::readTax(){ string noNewTax = tax; int hasConfidences = tax.find_first_of('('); if (hasConfidences != string::npos) { - noNewTax = removeConfidences(tax); + noNewTax = tax; + m->removeConfidences(noNewTax); } int pos = noNewTax.find(noConfidenceTaxons[j]); @@ -725,29 +733,6 @@ vector< map > GetLineageCommand::getTaxons(string tax) { exit(1); } } -/**************************************************************************************************/ -string GetLineageCommand::removeConfidences(string tax) { - try { - - string taxon = ""; - int taxLength = tax.length(); - for(int i=0;ierrorOut(e, "GetLineageCommand", "removeConfidences"); - exit(1); - } -} //********************************************************************************************************************** //alignreport file has a column header line then all other lines contain 16 columns. we just want the first column since that contains the name int GetLineageCommand::readAlign(){ @@ -774,7 +759,7 @@ int GetLineageCommand::readAlign(){ while(!in.eof()){ - if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; } in >> name; //read from first column