//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); }
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(); }
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 ((usedDups != "") && (namefile == "")) { m->mothurOut("You may only use dups with the name option."); m->mothurOutEndLine(); abort = true; }
-
+
+ if ((namefile == "") && ((fastafile != "") || (taxfile != ""))){
+ vector<string> files; files.push_back(fastafile); files.push_back(taxfile);
+ parser.getNameFile(files);
+ }
+
}
}
if (listfile != "") { readList(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
bool wroteSomething = false;
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();
//for each bin
for (int i = 0; i < list.getNumBins(); i++) {
- 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; }
//parse out names that are in accnos file
string binnames = list.get(i);
bool wroteSomething = false;
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;
bool wroteSomething = false;
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 >> group; //read from second column
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
int hasConfidences = tax.find_first_of('(');
if (hasConfidences != string::npos) {
- newtax = removeConfidences(tax);
+ newtax = tax;
+ m->removeConfidences(newtax);
}
int pos = newtax.find(noConfidenceTaxons[j]);
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]);
exit(1);
}
}
-/**************************************************************************************************/
-string RemoveLineageCommand::removeConfidences(string tax) {
- try {
-
- string taxon = "";
- int taxLength = tax.length();
- for(int i=0;i<taxLength;i++){
- if(tax[i] == ';'){
- taxon = taxon.substr(0, taxon.find_first_of('(')); //rip off confidence
- taxon += ";";
- }
- else{
- taxon += tax[i];
- }
- }
-
- return taxon;
- }
- catch(exception& e) {
- m->errorOut(e, "RemoveLineageCommand", "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 RemoveLineageCommand::readAlign(){
out << endl;
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