Skip to content

Commit

Permalink
Minor modifications to output filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
mothur-westcott committed Nov 30, 2021
1 parent 10849d6 commit 9c9987e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion source/commands/aligncommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ string AlignCommand::getOutputPattern(string type) {
string pattern = "";

if (type == "fasta") { pattern = "[filename],align"; } //makes file like: amazon.align
else if (type == "alignreport") { pattern = "[filename],align.report"; }
else if (type == "alignreport") { pattern = "[filename],align_report"; }
else if (type == "accnos") { pattern = "[filename],flip.accnos"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->setControl_pressed(true); }

Expand Down
38 changes: 21 additions & 17 deletions source/commands/getseqscommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "command.hpp"
#include "sequencedb.h"

//**********************************************************************************************************************


class GetSeqsCommand : public Command {

public:
Expand All @@ -26,7 +29,8 @@ class GetSeqsCommand : public Command {
string getCommandCategory() { return "Sequence Processing"; }

string getHelpString();
string getOutputPattern(string);
string getOutputPattern(string);
string getCommonQuestions();
string getCitation() { return "http://www.mothur.org/wiki/Get.seqs"; }
string getDescription() { return "gets sequences from a list, fasta, count, name, group, alignreport, quality, fastq, contigsreport or taxonomy file"; }

Expand All @@ -36,29 +40,29 @@ class GetSeqsCommand : public Command {

private:
set<string> names;
vector<string> outputNames;
string accnosfile, accnosfile2, fastafile, fastqfile, namefile, countfile, groupfile, alignfile, listfile, taxfile, qualfile, format, contigsreportfile;
vector<string> fastafiles, namefiles, groupfiles, countfiles, alignfiles, listfiles, taxfiles, fastqfiles, contigsreportfiles, qualityfiles, outputNames;
string accnosfile, accnosfile2, format, inputFileName;
bool abort, dups;
map<string, string> uniqueMap;
//for debug
map<string, set<string> > sanity; //maps file type to names chosen for file. something like "fasta" -> vector<string>. If running in debug mode this is filled and we check to make sure all the files have the same names. If they don't we output the differences for the user.
map<string, set<string> > sanity; //for debug //maps file type to names chosen for file. something like "fasta" -> vector<string>. If running in debug mode this is filled and we check to make sure all the files have the same names. If they don't we output the differences for the user.

void readFasta();
void readFastq();
void readName();
void readGroup();
void readCount();
void readAlign();
void readList();
void readTax();
void readQual();
void readContigs();
int compareAccnos();
int runSanityCheck();
void readFasta(string);
void readFastq(string);
void readName(string);
void readGroup(string);
void readCount(string);
void readAlign(string);
void readList(string);
void readTax(string);
void readQual(string);
void readContigs(string);
int compareAccnos(string);
int runSanityCheck(string, string, string, string, string, string);
int createMisMatchFile(ofstream&, string, string, set<string>, set<string>);


};
//**********************************************************************************************************************

#endif

3 changes: 0 additions & 3 deletions source/commands/listseqscommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ ListSeqsCommand::ListSeqsCommand(string option) : Command() {
map<string,string> parameters = parser.getParameters();

ValidParameters validParameter;


//check for required parameters
fastafiles = validParameter.validFiles(parameters, "fasta");
if (fastafiles.size() != 0) {
if (fastafiles[0] == "not open") { abort = true; }
Expand Down
2 changes: 1 addition & 1 deletion source/commands/makecontigscommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ string MakeContigsCommand::getOutputPattern(string type) {
if (type == "fasta") { pattern = "[filename],[tag],contigs.fasta"; }
else if (type == "qfile") { pattern = "[filename],[tag],contigs.qual"; }
else if (type == "count") { pattern = "[filename],[tag],contigs.count_table"; }
else if (type == "report") { pattern = "[filename],[tag],contigs.report"; }
else if (type == "report") { pattern = "[filename],[tag],contigs_report"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->setControl_pressed(true); }

return pattern;
Expand Down
2 changes: 1 addition & 1 deletion source/commands/removelineagecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ string RemoveLineageCommand::getOutputPattern(string type) {
else if (type == "count") { pattern = "[filename],pick,[extension]"; }
else if (type == "list") { pattern = "[filename],[distance],pick,[extension]"; }
else if (type == "shared") { pattern = "[filename],[distance],pick,[extension]"; }
else if (type == "alignreport") { pattern = "[filename],pick.align.report"; }
else if (type == "alignreport") { pattern = "[filename],pick.[extension]"; }
else if (type == "accnos") { pattern = "[filename],accnos"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->setControl_pressed(true); }

Expand Down
6 changes: 4 additions & 2 deletions source/commands/removeseqscommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ string RemoveSeqsCommand::getOutputPattern(string type) {
else if (type == "count") { pattern = "[filename],pick,[extension]"; }
else if (type == "list") { pattern = "[filename],[distance],pick,[extension]"; }
else if (type == "qfile") { pattern = "[filename],pick,[extension]"; }
else if (type == "alignreport") { pattern = "[filename],pick.align.report"; }
else if (type == "contigsreport") { pattern = "[filename],pick.contigs.report"; }
else if (type == "alignreport") { pattern = "[filename],pick.[extension]"; }
else if (type == "contigsreport") { pattern = "[filename],pick.[extension]"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->setControl_pressed(true); }

return pattern;
Expand Down Expand Up @@ -845,6 +845,7 @@ void RemoveSeqsCommand::readAlign(){
if (outputdir == "") { thisOutputDir += util.hasPath(alignfile); }
map<string, string> variables;
variables["[filename]"] = thisOutputDir + util.getRootName(util.getSimpleName(alignfile));
variables["[extension]"] = util.getExtension(alignfile);
string outputFileName = getOutputFileName("alignreport", variables);

ofstream out; util.openOutputFile(outputFileName, out);
Expand Down Expand Up @@ -904,6 +905,7 @@ void RemoveSeqsCommand::readContigs(){
if (outputdir == "") { thisOutputDir += util.hasPath(contigsreportfile); }
map<string, string> variables;
variables["[filename]"] = thisOutputDir + util.getRootName(util.getSimpleName(contigsreportfile));
variables["[extension]"] = util.getExtension(contigsreportfile);
string outputFileName = getOutputFileName("contigsreport", variables);
ofstream out; util.openOutputFile(outputFileName, out);

Expand Down
6 changes: 4 additions & 2 deletions source/commands/screenseqscommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ string ScreenSeqsCommand::getOutputPattern(string type) {
else if (type == "count") { pattern = "[filename],good,[extension]"; }
else if (type == "accnos") { pattern = "[filename],bad.accnos"; }
else if (type == "qfile") { pattern = "[filename],good,[extension]"; }
else if (type == "alignreport") { pattern = "[filename],good.align.report"; }
else if (type == "contigsreport") { pattern = "[filename],good.contigs.report"; }
else if (type == "alignreport") { pattern = "[filename],good.[extension]"; }
else if (type == "contigsreport") { pattern = "[filename],good.[extension]"; }
else if (type == "summary") { pattern = "[filename],good.summary"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->setControl_pressed(true); }

Expand Down Expand Up @@ -575,6 +575,7 @@ int ScreenSeqsCommand::screenAlignReport(map<string, string>& badSeqNames){

map<string, string> variables;
variables["[filename]"] = outputdir + util.getRootName(util.getSimpleName(alignreport));
variables["[extension]"] = util.getExtension(alignreport);
string outSummary = getOutputFileName("alignreport",variables);
outputNames.push_back(outSummary); outputTypes["alignreport"].push_back(outSummary);

Expand Down Expand Up @@ -657,6 +658,7 @@ int ScreenSeqsCommand::screenContigs(map<string, string>& badSeqNames){
try{
map<string, string> variables;
variables["[filename]"] = outputdir + util.getRootName(util.getSimpleName(contigsreport));
variables["[extension]"] = util.getExtension(contigsreport);
string outSummary = getOutputFileName("contigsreport",variables);
outputNames.push_back(outSummary); outputTypes["contigsreport"].push_back(outSummary);

Expand Down

0 comments on commit 9c9987e

Please sign in to comment.