]> git.donarmstrong.com Git - mothur.git/commitdiff
changed defaults in allign.seqs command
authorwestcott <westcott>
Fri, 22 May 2009 18:48:55 +0000 (18:48 +0000)
committerwestcott <westcott>
Fri, 22 May 2009 18:48:55 +0000 (18:48 +0000)
aligncommand.cpp
errorchecking.cpp
errorchecking.h
globaldata.cpp
globaldata.hpp
helpcommand.cpp
sharedrabundvector.cpp
validparameter.cpp
venn.cpp
venncommand.cpp

index f5eb48cacfc300f6bd46673088319aa8111af8cb..242e9a8fe0e3ba7a7f199846ae0e80cba10f0edb 100644 (file)
@@ -41,8 +41,8 @@
 AlignCommand::AlignCommand(){
        try {
                globaldata = GlobalData::getInstance();
-               candidateFileName = globaldata->inputFileName;
-               templateFileName = globaldata->getTemplateFile();
+               candidateFileName = globaldata->getCandidateFile();
+               templateFileName = globaldata->getFastaFile();
                openInputFile(candidateFileName, in);
                convert(globaldata->getKSize(), kmerSize);
                convert(globaldata->getMatch(), match);
index f8b34bba53ef6260d0c0756dfeec109cc946c9e8..c5396cfa37c314ca220d6b2cbf12692a477890eb 100644 (file)
@@ -119,7 +119,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "ends" )                       { ends = value; }
                                if (parameter == "processors" )         { processors = value;   }
                                if (parameter == "size" )                       { size = value; }
-                               if (parameter == "template")            { templatefile = value; }
+                               if (parameter == "candidate")           { candidatefile = value;        }
                                if (parameter == "search")                      { search = value;               }
                                if (parameter == "ksize")                       { ksize = value;                }
                                if (parameter == "align")                   { align = value;            }
@@ -169,7 +169,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "ends" )                       { ends = value; }
                                if (parameter == "processors" )         { processors = value;   }
                                if (parameter == "size" )                       { size = value; }
-                               if (parameter == "template")            { templatefile = value; }
+                               if (parameter == "candidate")           { candidatefile = value;        }
                                if (parameter == "search")                      { search = value;               }
                                if (parameter == "ksize")                       { ksize = value;                }
                                if (parameter == "align")                   { align = value;            }
@@ -263,11 +263,16 @@ bool ErrorCheck::checkInput(string input) {
                        }
                }
                
-               if ((commandName == "filter.seqs") || (commandName == "dist.seqs") || (commandName == "align.seqs")) { 
+               if ((commandName == "filter.seqs") || (commandName == "dist.seqs")) { 
                        if ((fastafile == "") && (nexusfile == "") && (clustalfile == "") && (phylipfile == "")) {
-                                cout << "You must enter either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs, dist.seqs or align.seqs command." << endl; return false; 
-                       }else if ((commandName == "align.seqs") && (templatefile == "")) {
-                               cout << "You must enter a template to use the align.seqs command." << endl; return false; 
+                                cout << "You must enter either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs or dist.seqs command." << endl; return false; 
+                       }
+                       validateSeqsFiles();
+               }
+               
+               if (commandName == "align.seqs") {
+                       if ((fastafile == "") || (candidatefile == "")) {
+                               cout << "You must enter fasta and a candidate file to use the align.seqs command." << endl; return false; 
                        }
                        validateSeqsFiles();
                }
@@ -578,8 +583,8 @@ void ErrorCheck::validateSeqsFiles() {
                                        errorFree = false;
                                }
                        }
-               }else if (templatefile != "") {
-                       ableToOpen = openInputFile(templatefile, filehandle);
+               }else if (candidatefile != "") {
+                       ableToOpen = openInputFile(candidatefile, filehandle);
                        filehandle.close();
                        if (ableToOpen == 1) { //unable to open
                                errorFree = false;
@@ -676,7 +681,7 @@ void ErrorCheck::clear() {
        fastafile       =   "";
        nexusfile       =   "";
        clustalfile     =   "";
-       templatefile    =       "";
+       candidatefile   =       "";
        line                    =       "";
        label                   =       "";
        method                  =   "furthest";
index 5057ab02b2962d92ea3814fdfabf5e039eda2dd7..c6671677ff40b0b398cdd4361781c7b9ad0ec1a2 100644 (file)
@@ -36,7 +36,7 @@ class ErrorCheck {
                void refresh();
                string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, nexusfile, clustalfile, treefile, sharedfile, cutoff, format; 
                string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund, sorted, trump, soft, filter, scale, ends, processors, size;
-               string templatefile, search, ksize, align, match, mismatch, gapopen, gapextend;
+               string candidatefile, search, ksize, align, match, mismatch, gapopen, gapextend;
                string commandName, optionText;
                bool errorFree;
 
index 0078d69997e8cd15f57e527a6db1cc3e0d430139..e9b3088d12ebdbb62b3e2acf4b309c948c86e079 100644 (file)
@@ -86,7 +86,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                if (key == "ends" )                     { ends = value;                 }
                                if (key == "processors" )       { processors = value;   }
                                if (key == "size" )         { size = value;         }
-                               if (key == "template")          { templatefile = value; }
+                               if (key == "candidate")         { candidatefile = value;        }
                                if (key == "search")            { search = value;               }
                                if (key == "ksize")                     { ksize = value;                }
                                if (key == "align")                 { align = value;            }
@@ -157,7 +157,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        if (key == "ends" )                     { ends = value;                 }
                        if (key == "processors" )       { processors = value;   }
                        if (key == "size" )         { size = value;         }
-                       if (key == "template")          { templatefile = value; }
+                       if (key == "candidate")         { candidatefile = value;        }
                        if (key == "search")            { search = value;               }
                        if (key == "ksize")                     { ksize = value;                }
                        if (key == "align")                 { align = value;            }
@@ -303,7 +303,7 @@ string GlobalData::getScale()                       {       return scale;           }
 string GlobalData::getEnds()                   {   return ends;                }
 string GlobalData::getProcessors()             {       return processors;      }
 string GlobalData::getSize()            {   return size;        }
-string GlobalData::getTemplateFile()   {       return templatefile;}
+string GlobalData::getCandidateFile()  {       return candidatefile;}
 string GlobalData::getSearch()                 {       return search;          }
 string GlobalData::getKSize()                  {       return ksize;           }
 string GlobalData::getAlign()                  {       return align;           }
@@ -357,7 +357,7 @@ void GlobalData::clear() {
        clustalfile             =   "";
        treefile                =       "";
        sharedfile              =       "";
-       templatefile    =       "";
+       candidatefile   =       "";
        cutoff                  =       "10.00";
        format                  =       "";
        precision               =       "100";
@@ -382,12 +382,12 @@ void GlobalData::clear() {
        ends                    =   "T";  //yes
        processors              =       "1";
        size            =   "1000";
-       search                  =       "suffix";
+       search                  =       "kmer";
        ksize                   =       "7";
-       align                   =       "blast";
+       align                   =       "needleman";
        match                   =       "1.0";
        mismatch                =       "-1.0";
-       gapopen                 =       "-5.0";
+       gapopen                 =       "-1.0";
        gapextend               =       "-2.0";
 }
 
@@ -411,12 +411,12 @@ void GlobalData::reset() {
        ends                    =   "T";
        processors              =       "1";
        size            =   "1000";
-       search                  =       "suffix";
+       search                  =       "kmer";
        ksize                   =       "7";
-       align                   =       "blast";
+       align                   =       "needleman";
        match                   =       "1.0";
        mismatch                =       "-1.0";
-       gapopen                 =       "-5.0";
+       gapopen                 =       "-1.0";
        gapextend               =       "-2.0";
 }
 /*******************************************************/
index 0c2548971555b599ea87eba61623fb2dfcf9a8ac..b3b0798cfd579c8c1b5e1a0cbbbca2eef0dc1473 100644 (file)
@@ -78,7 +78,7 @@ public:
        string getEnds();
        string getProcessors();
        string getSize();
-       string getTemplateFile();
+       string getCandidateFile();
        string getSearch();
        string getKSize();
        string getAlign();
@@ -122,7 +122,7 @@ public:
 private:
 
        string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, nexusfile, clustalfile, treefile, sharedfile, line, label, randomtree, groups;
-       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, filter, scale, ends, processors, templatefile, search, ksize, align, match, size;
+       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, filter, scale, ends, processors, candidatefile, search, ksize, align, match, size;
        string mismatch, gapopen, gapextend;
 
 
index 6abe7afbf7ed447a39dd0f0845f1f01af4fc33ce..b890c99e576e25815f2b8b27b7619c5908bece11 100644 (file)
@@ -84,19 +84,18 @@ int HelpCommand::execute(){
                cout << "Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "align.seqs") {
                cout << "The align.seqs command reads a file containing sequences and creates an alignment file and a report file." << "\n";
-               cout << "The align.seqs command parameters are fasta, phylip, clustal, nexus, template, search, ksize, align, match, mismatch, gapopen and gapextend.  " << "\n";
-               cout << "You must use one of the following parameters for your candidate filename: fasta, phylip, clustal or nexus. " << "\n";
+               cout << "The align.seqs command parameters are fasta, candidate, search, ksize, align, match, mismatch, gapopen and gapextend.  " << "\n";
                cout << "The template parameter is also required." << "\n";
-               cout << "The search parameter allows you to specify the method to find most similar template.  Your options are: suffix, kmer and blast. The default is suffix." << "\n";
-               cout << "The align parameter allows you to specify the alignment method to use.  Your options are: gotoh, needleman, blast and noalign. The default is blast." << "\n";
+               cout << "The search parameter allows you to specify the method to find most similar template.  Your options are: suffix, kmer and blast. The default is kmer." << "\n";
+               cout << "The align parameter allows you to specify the alignment method to use.  Your options are: gotoh, needleman, blast and noalign. The default is needleman." << "\n";
                cout << "The ksize parameter allows you to specify the kmer size for finding most similar template to candidate.  The default is 7." << "\n";
                cout << "The match parameter allows you to specify the bonus for having the same base. The default is 1.0." << "\n";
                cout << "The mistmatch parameter allows you to specify the penalty for having different bases.  The default is -1.0." << "\n";
-               cout << "The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -5.0." << "\n";
+               cout << "The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -1.0." << "\n";
                cout << "The gapextend parameter allows you to specify the penalty for extending a gap in an alignment.  The default is -2.0." << "\n";
                cout << "The align.seqs command should be in the following format: " << "\n";
-               cout << "align.seqs(fasta=yourFastaFile, template=yourTemplateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) " << "\n";
-               cout << "Example align.seqs(fasta=candidate.fasta, template=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)" << "\n";
+               cout << "align.seqs(fasta=yourTemplateFile, candidate=yourCandidateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) " << "\n";
+               cout << "Example align.seqs(candidate=candidate.fasta, fasta=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)" << "\n";
                cout << "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "collect.single") {
                cout << "The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. " << "\n";
index 1711012d4a0e06945492252d0c9bdaca4d9bac90..386017d9367f7eed2e5bfd984ffedb775a26a31a 100644 (file)
@@ -78,7 +78,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                holdLabel = label;
                
                //add new vector to lookup
-               lookup.push_back(new SharedRAbundVector());
+               SharedRAbundVector* temp = new SharedRAbundVector();
+               lookup.push_back(temp);
                lookup[0]->setLabel(label);
                lookup[0]->setGroup(groupN);
                
@@ -117,7 +118,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                        }
                        
                        //add new vector to lookup
-                       lookup.push_back(new SharedRAbundVector());
+                       temp = new SharedRAbundVector();
+                       lookup.push_back(temp);
                        lookup[count]->setLabel(label);
                        lookup[count]->setGroup(groupN);
 
index 6719e2c4eb706db4a99b6620eb861e3f41268971..ddec9d1ca4ef463972b4c43899364474114f422f 100644 (file)
@@ -294,7 +294,7 @@ void ValidParameters::initCommandParameters() {
                string distanceArray[] =  {"fasta","phylip","clustal","nexus", "calc", "ends", "cutoff", "processors"};
                commandParameters["dist.seqs"] = addParameters(distanceArray, sizeof(distanceArray)/sizeof(string));
                
-               string AlignArray[] =  {"fasta","phylip","clustal","nexus", "template", "search", "ksize", "align", "match", "mismatch", "gapopen", "gapextend"};
+               string AlignArray[] =  {"fasta", "candidate", "search", "ksize", "align", "match", "mismatch", "gapopen", "gapextend"};
                commandParameters["align.seqs"] = addParameters(AlignArray, sizeof(AlignArray)/sizeof(string));
                
                string quitArray[] = {};
index 2c579604ae7d57044ebe2a793f03ce2dce5f414c..27dc4acd8a81e9dcab8140cee4dc31129055ae4d 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -115,7 +115,6 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                delete singleCalc;
                                
                        }
-                       delete sabund;
                /******************* 2 Groups **************************/       
                
                }else if (lookup.size() == 2) {
@@ -185,8 +184,6 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                outsvg.close();
                                delete singleCalc;
                        }
-                       delete sabundA;
-                       delete sabundB;
                /******************* 3 Groups **************************/
                                                
                }else if (lookup.size() == 3) {
@@ -197,7 +194,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        sA = lookup[0]->getSAbundVector();  sabundA = &sA;
                        sB = lookup[1]->getSAbundVector();  sabundB = &sB;
                        sC = lookup[2]->getSAbundVector();  sabundC = &sC;
-                       
+               
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                        
@@ -282,9 +279,9 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        sharedABC3 = sharedAC[0] + sharedBC[0] - sharedCwithAB[0];
  
                                        //if any of the possible m's are - throw them out
-                                       if (sharedABC1 < 0.0) { sharedABC1 = 0; }
-                                       if (sharedABC2 < 0.0) { sharedABC2 = 0; }
-                                       if (sharedABC3 < 0.0) { sharedABC3 = 0; }
+                                       if (sharedABC1 < 0.00001) { sharedABC1 = 0; }
+                                       if (sharedABC2 < 0.00001) { sharedABC2 = 0; }
+                                       if (sharedABC3 < 0.00001) { sharedABC3 = 0; }
                
                                        //sharedABC is the minimum of the 3 possibilities
                                        if ((sharedABC1 < sharedABC2) && (sharedABC1 < sharedABC3)) { sharedABC = sharedABC1; }
@@ -297,7 +294,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC);
                                        sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC);
                                }
-                       
+               
                                //image window
                                outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 800 800\" >\n";
                                outsvg << "<g>\n";
@@ -350,10 +347,9 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
                                delete singleCalc;
+
                        }
-                       delete sabundA;
-                       delete sabundB;
-                       delete sabundC;
+                       
                /******************* 4 Groups **************************/
                
                }else if (lookup.size() == 4) {
@@ -517,10 +513,6 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        delete singleCalc;
                                }
                        }
-                       delete sabundA;
-                       delete sabundB;
-                       delete sabundC;
-                       delete sabundD;
                }
                
        }
index a934126a944513a427f1c202a9a81bec93053a21..ced4c4851180c05d03399feb780010b7a3d9e697 100644 (file)
@@ -121,7 +121,7 @@ int VennCommand::execute(){
                                                cout << "Error: Too many groups chosen.  You may use up to 4 groups with the venn command.  I will use the first four groups in your groupfile." << endl;
                                                for (int i = lookup.size(); i > 3; i--) { delete lookup[i]; lookup.pop_back(); }
                                        }
-                                       
+                               
                                        //util->getSharedVectors(globaldata->Groups, lookup, order);  //fills group vectors from order vector.
                                        venn->getPic(lookup, vennCalculators);
                                }