else {
//valid paramters for this command
- string Array[] = {"fasta","name", "group", "align", "accnos" };
+ string Array[] = {"fasta","name", "group", "alignreport", "accnos" };
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
if (groupfile == "not open") { abort = true; }
else if (groupfile == "not found") { groupfile = ""; }
- alignfile = validParameter.validFile(parameters, "align", true);
+ alignfile = validParameter.validFile(parameters, "alignreport", true);
if (alignfile == "not open") { abort = true; }
else if (alignfile == "not found") { alignfile = ""; }
- if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, align."); mothurOutEndLine(); abort = true; }
+ if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
- if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, align."); mothurOutEndLine(); abort = true; }
+ if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
}
}
try {
mothurOut("The remove.seqs command reads an .accnos file and one of the following file types: fasta, name, group or alignreport file.\n");
mothurOut("It outputs a file containing the sequences NOT in the .accnos file.\n");
- mothurOut("The remove.seqs command parameters are accnos, fasta, name, group and align. You must provide accnos and one of the other parameters.\n");
+ mothurOut("The remove.seqs command parameters are accnos, fasta, name, group and alignreport. You must provide accnos and one of the other parameters.\n");
mothurOut("The remove.seqs command should be in the following format: remove.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
mothurOut("Example remove.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
//**********************************************************************************************************************
void RemoveSeqsCommand::readFasta(){
try {
- string outputFileName = getRootName(fastafile) + "pick";
+ string outputFileName = getRootName(fastafile) + "pick" + getExtension(fastafile);
ofstream out;
openOutputFile(outputFileName, out);
void RemoveSeqsCommand::readName(){
try {
- string outputFileName = getRootName(namefile) + "pick";
+ string outputFileName = getRootName(namefile) + "pick" + getExtension(namefile);
+
ofstream out;
openOutputFile(outputFileName, out);
in >> firstCol;
in >> secondCol;
-
+
vector<string> parsedNames;
//parse second column saving each name
while (secondCol.find_first_of(',') != -1) {
name = secondCol.substr(0,secondCol.find_first_of(','));
secondCol = secondCol.substr(secondCol.find_first_of(',')+1, secondCol.length());
parsedNames.push_back(name);
+
}
//get name after last ,
parsedNames.push_back(secondCol);
-
- vector<string> validSecond;
+
+ vector<string> validSecond; validSecond.clear();
for (int i = 0; i < parsedNames.size(); i++) {
if (names.count(parsedNames[i]) == 0) {
validSecond.push_back(parsedNames[i]);
- }else { names.erase(parsedNames[i]); }
+ }
}
-
//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) {
-
+
wroteSomething = true;
out << firstCol << '\t';
//make first name in set you come to first column and then add the remaining names to second column
}else {
- names.erase(firstCol);
-
+
//you want part of this row
if (validSecond.size() != 0) {
void RemoveSeqsCommand::readGroup(){
try {
- string outputFileName = getRootName(groupfile) + "pick";
+ string outputFileName = getRootName(groupfile) + "pick" + getExtension(groupfile);
ofstream out;
openOutputFile(outputFileName, out);
//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
void RemoveSeqsCommand::readAlign(){
try {
- string outputFileName = getRootName(alignfile) + "pick";
+ string outputFileName = getRootName(getRootName(alignfile)) + "pick.align.report";
ofstream out;
openOutputFile(outputFileName, out);