m->mothurOut("You have no valid accnos file and accnos is required."); m->mothurOutEndLine();
abort = true;
}
- }
+ }else { m->setAccnosFile(accnosfile); }
if (accnosfile2 == "not found") { accnosfile2 = ""; }
fastafile = validParameter.validFile(parameters, "fasta", true);
- if (fastafile == "not open") { abort = true; }
- else if (fastafile == "not found") { fastafile = ""; }
+ 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); }
groupfile = validParameter.validFile(parameters, "group", true);
if (groupfile == "not open") { abort = true; }
else if (groupfile == "not found") { groupfile = ""; }
+ else { m->setGroupFile(groupfile); }
alignfile = validParameter.validFile(parameters, "alignreport", true);
if (alignfile == "not open") { abort = true; }
listfile = validParameter.validFile(parameters, "list", true);
if (listfile == "not open") { abort = true; }
else if (listfile == "not found") { listfile = ""; }
+ 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 = ""; }
+ else { m->setTaxonomyFile(taxfile); }
qualfile = validParameter.validFile(parameters, "qfile", true);
if (qualfile == "not open") { abort = true; }
else if (qualfile == "not found") { qualfile = ""; }
+ else { m->setQualFile(qualfile); }
accnosfile2 = validParameter.validFile(parameters, "accnos2", true);
if (accnosfile2 == "not open") { abort = true; }
dups = m->isTrue(temp);
if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "") && (taxfile == "") && (qualfile == "") && (accnosfile2 == "")) { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport, taxonomy, quality or listfile."); m->mothurOutEndLine(); abort = true; }
+
+ if ((namefile == "") && ((fastafile != "") || (taxfile != ""))){
+ vector<string> files; files.push_back(fastafile); files.push_back(taxfile);
+ parser.getNameFile(files);
+ }
}
}
if (qualfile != "") { readQual(); }
if (accnosfile2 != "") { compareAccnos(); }
- 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; }
- m->mothurOut("Selected " + toString(names.size()) + " sequences."); m->mothurOutEndLine();
if (outputNames.size() != 0) {
m->mothurOutEndLine();
string name;
bool wroteSomething = false;
+ int selectedCount = 0;
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();
wroteSomething = true;
currSeq.printSequence(out);
+ selectedCount++;
}
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your fasta file."); m->mothurOutEndLine();
+
return 0;
}
string name;
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
wroteSomething = true;
out << name << endl << scores;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["qfile"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your quality file."); m->mothurOutEndLine();
+
+
return 0;
}
m->openInputFile(listfile, in);
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ selectedCount = 0;
+
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//read in list vector
ListVector list(in);
binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
//if that name is in the .accnos file, add it
- if (names.count(name) != 0) { newNames += name + ","; }
+ if (names.count(name) != 0) { newNames += name + ","; selectedCount++; }
}
//get last name
- if (names.count(binnames) != 0) { newNames += binnames + ","; }
+ if (names.count(binnames) != 0) { newNames += binnames + ","; selectedCount++; }
//if there are names in this bin add to new list
if (newNames != "") {
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your list file."); m->mothurOutEndLine();
+
return 0;
}
string name, firstCol, secondCol;
bool wroteSomething = false;
-
+ int selectedCount = 0;
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;
for (int i = 0; i < parsedNames.size(); i++) { names.insert(parsedNames[i]); }
out << firstCol << '\t' << hold << endl;
wroteSomething = true;
+ selectedCount += parsedNames.size();
}else {
+ selectedCount += validSecond.size();
+
//if the name in the first column is in the set then print it and any other names in second column also in set
if (names.count(firstCol) != 0) {
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your name file."); m->mothurOutEndLine();
+
return 0;
}
string name, group;
bool wroteSomething = false;
+ int selectedCount = 0;
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
wroteSomething = true;
out << name << '\t' << group << endl;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your group file."); m->mothurOutEndLine();
+
+
return 0;
}
string name, tax;
bool wroteSomething = false;
+ int selectedCount = 0;
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
wroteSomething = true;
out << name << '\t' << tax << endl;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName);
+
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your taxonomy file."); m->mothurOutEndLine();
return 0;
string name, junk;
bool wroteSomething = false;
+ int selectedCount = 0;
//read column headers
for (int i = 0; i < 16; 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
//if this name is in the accnos file
if (names.count(name) != 0) {
wroteSomething = true;
+ selectedCount++;
out << name << '\t';
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your alignreport file."); m->mothurOutEndLine();
+
return 0;
}