X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getseqscommand.cpp;h=71a2db9723c32a39ea8e158074fbfac8a29de1ca;hb=7bf9a81bba76538ecaf351ae208de3da4bf1b6dd;hp=04c3bd325edf89638503cdcb49c2842c75ed1d17;hpb=1d898dc6edaf9e9f287fab53bf1f21fb29757a17;p=mothur.git diff --git a/getseqscommand.cpp b/getseqscommand.cpp index 04c3bd3..71a2db9 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -25,7 +25,8 @@ vector GetSeqsCommand::setParameters(){ 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 myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } return myArray; @@ -81,6 +82,7 @@ GetSeqsCommand::GetSeqsCommand(string option) { //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { vector myArray = setParameters(); @@ -199,21 +201,24 @@ GetSeqsCommand::GetSeqsCommand(string option) { 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; } @@ -222,14 +227,22 @@ GetSeqsCommand::GetSeqsCommand(string option) { 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 = ""; } @@ -823,7 +836,15 @@ int GetSeqsCommand::compareAccnos(){ 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);