//**********************************************************************************************************************
ParseFastaQCommand::ParseFastaQCommand(){
try {
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
outputTypes["qual"] = tempOutNames;
//**********************************************************************************************************************
ParseFastaQCommand::ParseFastaQCommand(string option){
try {
- abort = false;
+ abort = false; calledHelp = false;
- if(option == "help") { help(); abort = true; }
+ if(option == "help") { help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
void ParseFastaQCommand::help(){
try {
- m->mothurOut("The fastq.info command reads a fastaQ file and creates a fasta and quality file.\n");
+ m->mothurOut("The fastq.info command reads a fastq file and creates a fasta and quality file.\n");
m->mothurOut("The fastq.info command parameter is fastq, and it is required.\n");
m->mothurOut("The fastq.info command should be in the following format: fastq.info(fastaq=yourFastaQFile).\n");
m->mothurOut("Example fastq.info(fastaq=test.fastaq).\n");
int ParseFastaQCommand::execute(){
try {
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
//open Output Files
string fastaFile = outputDir + m->getRootName(m->getSimpleName(fastaQFile)) + "fasta";
if (qual == "") { m->mothurOut("[ERROR]: missing quality for " + name2); m->mothurOutEndLine(); m->control_pressed = true; break; }
//sanity check sequence length and number of quality scores match
- if (name != name2) { m->mothurOut("[ERROR]: names do not match. read " + name + " for fasta and " + name2 + " for quality."); m->mothurOutEndLine(); m->control_pressed = true; break; }
+ if (name2 != "") { if (name != name2) { m->mothurOut("[ERROR]: names do not match. read " + name + " for fasta and " + name2 + " for quality."); m->mothurOutEndLine(); m->control_pressed = true; break; } }
if (qual.length() != sequence.length()) { m->mothurOut("[ERROR]: lengths do not match. read " + toString(sequence.length()) + " characters for fasta and " + toString(qual.length()) + " characters for quality scores."); m->mothurOutEndLine(); m->control_pressed = true; break; }
//convert quality scores