]> git.donarmstrong.com Git - mothur.git/blobdiff - parsefastaqcommand.cpp
added root parameter to the unifrac commands so you can choose to include the entire...
[mothur.git] / parsefastaqcommand.cpp
index 1e6643162b5962eadaf1cd36cc0ead26700240ec..7f4fbbab1096101aa8f09931e4c9ac40e04052b1 100644 (file)
@@ -25,8 +25,7 @@ vector<string> ParseFastaQCommand::getValidParameters(){
 //**********************************************************************************************************************
 ParseFastaQCommand::ParseFastaQCommand(){      
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
                outputTypes["qual"] = tempOutNames;
@@ -62,9 +61,9 @@ vector<string> ParseFastaQCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 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
@@ -120,7 +119,7 @@ ParseFastaQCommand::ParseFastaQCommand(string option){
 
 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");
@@ -140,7 +139,7 @@ ParseFastaQCommand::~ParseFastaQCommand()   {       /*      do nothing      */      }
 
 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";
@@ -175,7 +174,7 @@ int ParseFastaQCommand::execute(){
                        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