CommandParameter pdups("dups", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pdups);
CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
-
+ CommandParameter paccnos2("accnos2", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(paccnos2);
+
vector<string> myArray;
for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
return myArray;
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 = ""; }
+ else if (fastafile == "not found") { fastafile = ""; }
+ else { m->setFastaFile(fastafile); }
namefile = validParameter.validFile(parameters, "name", true);
if (namefile == "not open") { 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; }
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; }
+ else if (accnosfile2 == "not found") { accnosfile2 = ""; }
+
string usedDups = "true";
string temp = validParameter.validFile(parameters, "dups", false); if (temp == "not found") { temp = "true"; usedDups = ""; }
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;
}
in >> name;
if (namesAccnos.count(name) == 0){ //name unique to accnos2
- namesAccnos2.insert(name);
+ int pos = name.find_last_of('_');
+ string tempName = name;
+ if (pos != string::npos) { tempName = tempName.substr(pos+1); cout << tempName << endl; }
+ if (namesAccnos.count(tempName) == 0){
+ namesAccnos2.insert(name);
+ }else { //you are in both so erase
+ namesAccnos.erase(name);
+ namesDups.insert(name);
+ }
}else { //you are in both so erase
namesAccnos.erase(name);
namesDups.insert(name);