]> git.donarmstrong.com Git - mothur.git/commitdiff
created mothurOut class to handle logfiles
authorwestcott <westcott>
Fri, 26 Feb 2010 14:35:09 +0000 (14:35 +0000)
committerwestcott <westcott>
Fri, 26 Feb 2010 14:35:09 +0000 (14:35 +0000)
272 files changed:
Mothur.xcodeproj/project.pbxproj
ace.cpp
aligncommand.cpp
alignment.cpp
alignment.hpp
alignmentcell.hpp
alignmentdb.cpp
alignmentdb.h
averagelinkage.cpp
bayesian.cpp
bellerophon.cpp
bergerparker.cpp
binsequencecommand.cpp
binsequencecommand.h
blastalign.cpp
blastdb.cpp
boneh.cpp
boneh.h
bootstrap.cpp
bootstrapsharedcommand.cpp
bootstrapsharedcommand.h
bstick.cpp
calculator.cpp
calculator.h
ccode.cpp
chao1.cpp
chimera.cpp
chimera.h
chimeracheckrdp.cpp
chimerarealigner.cpp
chimerarealigner.h
chimeraseqscommand.cpp
chimeraslayer.cpp
classify.cpp
classify.h
classifyseqscommand.cpp
classifyseqscommand.h
cluster.cpp
cluster.hpp
clustercommand.cpp
clustercommand.h
collect.cpp
collect.h
collectcommand.cpp
collectsharedcommand.cpp
collectsharedcommand.h
command.hpp
commandfactory.cpp
commandfactory.hpp
commandoptionparser.cpp
commandoptionparser.hpp
completelinkage.cpp
consensuscommand.cpp
coverage.cpp
database.cpp
database.hpp
datavector.hpp
decalc.cpp
decalc.h
deconvolutecommand.cpp
deconvolutecommand.h
display.h
dist.h
distancecommand.cpp
distancecommand.h
distancedb.cpp
efron.cpp
efron.h
engine.cpp
engine.hpp
fastamap.cpp
fastamap.h
fileoutput.cpp
fileoutput.h
filterseqscommand.cpp
formatcolumn.cpp
formatmatrix.h
formatphylip.cpp
fullmatrix.cpp
fullmatrix.h
geom.cpp
getgroupcommand.cpp
getlabelcommand.cpp
getlistcountcommand.cpp
getlistcountcommand.h
getoturepcommand.cpp
getoturepcommand.h
getrabundcommand.cpp
getsabundcommand.cpp
getseqscommand.cpp
getseqscommand.h
getsharedotucommand.cpp
getsharedotucommand.h
globaldata.cpp
globaldata.hpp
goodscoverage.cpp
gotohoverlap.cpp
groupmap.cpp
groupmap.h
hcluster.cpp
hcluster.h
hclustercommand.cpp
hclustercommand.h
heatmap.cpp
heatmap.h
heatmapcommand.cpp
heatmapcommand.h
heatmapsim.cpp
heatmapsim.h
heatmapsimcommand.cpp
heatmapsimcommand.h
helpcommand.cpp
inputdata.cpp
inputdata.h
jackknife.cpp
kmerdb.cpp
knn.cpp
libshuff.cpp
libshuff.h
libshuffcommand.cpp
libshuffcommand.h
listseqscommand.cpp
listvector.cpp
logsd.cpp
maligner.cpp
maligner.h
matrixoutputcommand.cpp
matrixoutputcommand.h
mergefilecommand.cpp
mgclustercommand.cpp
mothur.cpp
mothur.h
nameassignment.cpp
nameassignment.hpp
nast.cpp
nast.hpp
needlemanoverlap.cpp
nocommands.cpp
npshannon.cpp
optionparser.cpp
optionparser.h
ordervector.cpp
otuhierarchycommand.cpp
parselistscommand.cpp
parsimony.cpp
parsimonycommand.cpp
parsimonycommand.h
pcacommand.cpp
pcacommand.h
phylotree.cpp
phylotree.h
phylotypecommand.cpp
pintail.cpp
preclustercommand.cpp
preclustercommand.h
progress.cpp
progress.hpp
qstat.cpp
quitcommand.cpp
rabundvector.cpp
rarecalc.cpp
rarecalc.h
raredisplay.cpp
rarefact.cpp
rarefact.h
rarefactcommand.cpp
rarefactsharedcommand.cpp
rarefactsharedcommand.h
readblast.cpp
readblast.h
readcluster.cpp
readcluster.h
readcolumn.cpp
readdistcommand.cpp
readmatrix.hpp
readotu.cpp
readotu.h
readotucommand.cpp
readphylip.cpp
readtree.cpp
readtree.h
readtreecommand.cpp
removeseqscommand.cpp
removeseqscommand.h
reversecommand.cpp
sabundvector.cpp
screenseqscommand.cpp
secondarystructurecommand.cpp
seqsummarycommand.cpp
sequence.cpp
sequence.hpp
sequencedb.cpp
sequencedb.h
setdircommand.cpp
shannon.cpp
sharedace.cpp
sharedanderbergs.cpp
sharedbraycurtis.cpp
sharedchao1.cpp
sharedcommand.cpp
sharedjabund.cpp
sharedjackknife.cpp
sharedjclass.cpp
sharedjest.cpp
sharedkstest.cpp
sharedkulczynski.cpp
sharedkulczynskicody.cpp
sharedlennon.cpp
sharedlistvector.cpp
sharedmarczewski.cpp
sharedmorisitahorn.cpp
sharedochiai.cpp
sharedordervector.cpp
sharedrabundvector.cpp
sharedsabundvector.cpp
sharedsobs.cpp
sharedsobscollectsummary.cpp
sharedsorabund.cpp
sharedsorclass.cpp
sharedsorest.cpp
sharedthetan.cpp
sharedthetayc.cpp
sharedutilities.cpp
sharedutilities.h
shen.cpp
shen.h
simpson.cpp
singlelinkage.cpp
slayer.cpp
slayer.h
slibshuff.cpp
solow.cpp
solow.h
sparsematrix.cpp
sparsematrix.hpp
suffixdb.cpp
suffixnodes.cpp
suffixnodes.hpp
suffixtree.cpp
suffixtree.hpp
summarycommand.cpp
summarysharedcommand.cpp
summarysharedcommand.h
systemcommand.cpp
taxonomyequalizer.cpp
taxonomyequalizer.h
tree.cpp
tree.h
treecalculator.h
treegroupscommand.cpp
treegroupscommand.h
treemap.cpp
treemap.h
treenode.cpp
treenode.h
trimseqscommand.cpp
unifracunweightedcommand.cpp
unifracunweightedcommand.h
unifracweightedcommand.cpp
unifracweightedcommand.h
unweighted.cpp
uvest.cpp
uvest.h
validcalculator.cpp
validcalculator.h
validparameter.cpp
validparameter.h
venn.cpp
venn.h
venncommand.cpp
weighted.cpp
whittaker.cpp

index 5900f0a512a2998eedfc3a5d0302a52cdf13d67e..f5a67006f3b4d23058e6a60c5a0788861ba2b60b 100644 (file)
                A70B53AA0F4CD7AD0064797E /* getgroupcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70B53A40F4CD7AD0064797E /* getgroupcommand.cpp */; };
                A70B53AB0F4CD7AD0064797E /* getlabelcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70B53A60F4CD7AD0064797E /* getlabelcommand.cpp */; };
                A70DECD91063D8B40057C03C /* secondarystructurecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70DECD81063D8B40057C03C /* secondarystructurecommand.cpp */; };
+               A70F3FD01136E391004FDC52 /* mothurout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70F3FCF1136E391004FDC52 /* mothurout.cpp */; };
                A71CB8A311354B9F00848EF7 /* parselistscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71CB8A211354B9F00848EF7 /* parselistscommand.cpp */; };
                A727E84A10D14568001A8432 /* readblast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727E84910D14568001A8432 /* readblast.cpp */; };
                A7283FF81056CAE100D0CC69 /* chimeracheckrdp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7283FF71056CAE100D0CC69 /* chimeracheckrdp.cpp */; };
                A70B53A70F4CD7AD0064797E /* getlabelcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getlabelcommand.h; sourceTree = SOURCE_ROOT; };
                A70DECD71063D8B40057C03C /* secondarystructurecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = secondarystructurecommand.h; sourceTree = SOURCE_ROOT; };
                A70DECD81063D8B40057C03C /* secondarystructurecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = secondarystructurecommand.cpp; sourceTree = SOURCE_ROOT; };
+               A70F3FCE1136E391004FDC52 /* mothurout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mothurout.h; sourceTree = SOURCE_ROOT; };
+               A70F3FCF1136E391004FDC52 /* mothurout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mothurout.cpp; sourceTree = SOURCE_ROOT; };
                A71CB8A111354B9F00848EF7 /* parselistscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parselistscommand.h; sourceTree = SOURCE_ROOT; };
                A71CB8A211354B9F00848EF7 /* parselistscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parselistscommand.cpp; sourceTree = SOURCE_ROOT; };
                A727E84810D14568001A8432 /* readblast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readblast.h; sourceTree = SOURCE_ROOT; };
                                7E412FE90F8D3E2C00381DD0 /* libshuff.cpp */,
                                37E3ED800F4D9D0D00B5DF02 /* mothur.h */,
                                37D927EF0F21331F001D4494 /* mothur.cpp */,
+                               A70F3FCE1136E391004FDC52 /* mothurout.h */,
+                               A70F3FCF1136E391004FDC52 /* mothurout.cpp */,
                                373C691E0FC1C98600137ACD /* nast.hpp */,
                                373C691D0FC1C98600137ACD /* nast.cpp */,
                                373C692A0FC1C9EB00137ACD /* nastreport.hpp */,
                                A794201111107897003AECCD /* distancedb.cpp in Sources */,
                                A7E8A22F1125939F0011D39C /* chimerarealigner.cpp in Sources */,
                                A71CB8A311354B9F00848EF7 /* parselistscommand.cpp in Sources */,
+                               A70F3FD01136E391004FDC52 /* mothurout.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/ace.cpp b/ace.cpp
index 639a48f6e45ac2503bbfbea4d2ba368cfadcd293..1fde5118d2bbda9db313c83d5a87a2fec9d3a1ff 100644 (file)
--- a/ace.cpp
+++ b/ace.cpp
@@ -140,7 +140,7 @@ EstOutput Ace::getValues(SAbundVector* rank) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Ace", "getValues");
+               m->errorOut(e, "Ace", "getValues");
                exit(1);
        }
 }
index 708a85472dc53fecec1f022ce86512a82d620c30..3b4b6c93e232a25bab87a855c6955d177926e823 100644 (file)
@@ -28,9 +28,9 @@
 
 //**********************************************************************************************************************
 
-AlignCommand::AlignCommand(string option){
+AlignCommand::AlignCommand(string option)  {
        try {
-               //              globaldata = GlobalData::getInstance();
+               
                abort = false;
                
                //allow user to run help
@@ -78,13 +78,13 @@ AlignCommand::AlignCommand(string option){
                        templateFileName = validParameter.validFile(parameters, "template", true);
                        
                        if (templateFileName == "not found") { 
-                               mothurOut("template is a required parameter for the align.seqs command."); 
-                               mothurOutEndLine();
+                               m->mothurOut("template is a required parameter for the align.seqs command."); 
+                               m->mothurOutEndLine();
                                abort = true; 
                        }else if (templateFileName == "not open") { abort = true; }     
                        
                        candidateFileName = validParameter.validFile(parameters, "candidate", false);
-                       if (candidateFileName == "not found") { mothurOut("candidate is a required parameter for the align.seqs command."); mothurOutEndLine(); abort = true;  }
+                       if (candidateFileName == "not found") { m->mothurOut("candidate is a required parameter for the align.seqs command."); m->mothurOutEndLine(); abort = true;  }
                        else { 
                                splitAtDash(candidateFileName, candidateFileNames);
                                
@@ -100,7 +100,7 @@ AlignCommand::AlignCommand(string option){
                                        ifstream in;
                                        ableToOpen = openInputFile(candidateFileNames[i], in);
                                        if (ableToOpen == 1) { 
-                                               mothurOut(candidateFileNames[i] + " will be disregarded."); mothurOutEndLine(); 
+                                               m->mothurOut(candidateFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); 
                                                //erase from file list
                                                candidateFileNames.erase(candidateFileNames.begin()+i);
                                                i--;
@@ -109,7 +109,7 @@ AlignCommand::AlignCommand(string option){
                                }
                                
                                //make sure there is at least one valid file left
-                               if (candidateFileNames.size() == 0) { mothurOut("no valid files."); mothurOutEndLine(); abort = true; }
+                               if (candidateFileNames.size() == 0) { m->mothurOut("no valid files."); m->mothurOutEndLine(); abort = true; }
                        }
                        
                        //check for optional parameter and set defaults
@@ -146,7 +146,7 @@ AlignCommand::AlignCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "AlignCommand");
+               m->errorOut(e, "AlignCommand", "AlignCommand");
                exit(1);
        }
 }
@@ -166,27 +166,27 @@ AlignCommand::~AlignCommand(){
 
 void AlignCommand::help(){
        try {
-               mothurOut("The align.seqs command reads a file containing sequences and creates an alignment file and a report file.\n");
-               mothurOut("The align.seqs command parameters are template, candidate, search, ksize, align, match, mismatch, gapopen and gapextend.\n");
-               mothurOut("The template and candidate parameters are required. You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n");
-               mothurOut("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");
-               mothurOut("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");
-               mothurOut("The ksize parameter allows you to specify the kmer size for finding most similar template to candidate.  The default is 8.\n");
-               mothurOut("The match parameter allows you to specify the bonus for having the same base. The default is 1.0.\n");
-               mothurOut("The mistmatch parameter allows you to specify the penalty for having different bases.  The default is -1.0.\n");
-               mothurOut("The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -2.0.\n");
-               mothurOut("The gapextend parameter allows you to specify the penalty for extending a gap in an alignment.  The default is -1.0.\n");
-               mothurOut("The flip parameter is used to specify whether or not you want mothur to try the reverse complement if a sequence falls below the threshold.  The default is false.\n");
-               mothurOut("The threshold is used to specify a cutoff at which an alignment is deemed 'bad' and the reverse complement may be tried. The default threshold is 0.50, meaning 50% of the bases are removed in the alignment.\n");
-               mothurOut("If the flip parameter is set to true the reverse complement of the sequence is aligned and the better alignment is reported.\n");
-               mothurOut("The default for the threshold parameter is 0.50, meaning at least 50% of the bases must remain or the sequence is reported as potentially reversed.\n");
-               mothurOut("The align.seqs command should be in the following format: \n");
-               mothurOut("align.seqs(template=yourTemplateFile, candidate=yourCandidateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) \n");
-               mothurOut("Example align.seqs(candidate=candidate.fasta, template=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. candidate), '=' and parameters (i.e.yourFastaFile).\n\n");
+               m->mothurOut("The align.seqs command reads a file containing sequences and creates an alignment file and a report file.\n");
+               m->mothurOut("The align.seqs command parameters are template, candidate, search, ksize, align, match, mismatch, gapopen and gapextend.\n");
+               m->mothurOut("The template and candidate parameters are required. You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n");
+               m->mothurOut("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");
+               m->mothurOut("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");
+               m->mothurOut("The ksize parameter allows you to specify the kmer size for finding most similar template to candidate.  The default is 8.\n");
+               m->mothurOut("The match parameter allows you to specify the bonus for having the same base. The default is 1.0.\n");
+               m->mothurOut("The mistmatch parameter allows you to specify the penalty for having different bases.  The default is -1.0.\n");
+               m->mothurOut("The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -2.0.\n");
+               m->mothurOut("The gapextend parameter allows you to specify the penalty for extending a gap in an alignment.  The default is -1.0.\n");
+               m->mothurOut("The flip parameter is used to specify whether or not you want mothur to try the reverse complement if a sequence falls below the threshold.  The default is false.\n");
+               m->mothurOut("The threshold is used to specify a cutoff at which an alignment is deemed 'bad' and the reverse complement may be tried. The default threshold is 0.50, meaning 50% of the bases are removed in the alignment.\n");
+               m->mothurOut("If the flip parameter is set to true the reverse complement of the sequence is aligned and the better alignment is reported.\n");
+               m->mothurOut("The default for the threshold parameter is 0.50, meaning at least 50% of the bases must remain or the sequence is reported as potentially reversed.\n");
+               m->mothurOut("The align.seqs command should be in the following format: \n");
+               m->mothurOut("align.seqs(template=yourTemplateFile, candidate=yourCandidateFile, align=yourAlignmentMethod, search=yourSearchmethod, ksize=yourKmerSize, match=yourMatchBonus, mismatch=yourMismatchpenalty, gapopen=yourGapopenPenalty, gapextend=yourGapExtendPenalty) \n");
+               m->mothurOut("Example align.seqs(candidate=candidate.fasta, template=core.filtered, align=kmer, search=gotoh, ksize=8, match=2.0, mismatch=3.0, gapopen=-2.0, gapextend=-1.0)\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. candidate), '=' and parameters (i.e.yourFastaFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "help");
+               m->errorOut(e, "AlignCommand", "help");
                exit(1);
        }
 }
@@ -206,13 +206,14 @@ int AlignCommand::execute(){
                else if(align == "blast")               {       alignment = new BlastAlignment(gapOpen, gapExtend, match, misMatch);            }
                else if(align == "noalign")             {       alignment = new NoAlign();                                                                                                      }
                else {
-                       mothurOut(align + " is not a valid alignment option. I will run the command using needleman.");
-                       mothurOutEndLine();
+                       m->mothurOut(align + " is not a valid alignment option. I will run the command using needleman.");
+                       m->mothurOutEndLine();
                        alignment = new NeedlemanOverlap(gapOpen, match, misMatch, longestBase);
                }
+               vector<string> outputNames;
                
                for (int s = 0; s < candidateFileNames.size(); s++) {
-                       mothurOut("Aligning sequences from " + candidateFileNames[s] + " ..." ); mothurOutEndLine();
+                       m->mothurOut("Aligning sequences from " + candidateFileNames[s] + " ..." ); m->mothurOutEndLine();
                        
                        if (outputDir == "") {  outputDir += hasPath(candidateFileNames[s]); }
                        string alignFileName = outputDir + getRootName(getSimpleName(candidateFileNames[s])) + "align";
@@ -236,13 +237,13 @@ int AlignCommand::execute(){
                                driver(lines[0], alignFileName, reportFileName, accnosFileName, candidateFileNames[s]);
                                
                                //delete accnos file if its blank else report to user
-                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  }
+                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                                else { 
-                                       mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
+                                       m->mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
                                        if (!flip) {
-                                               mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
-                                       }else{  mothurOut(" If the reverse compliment proved to be better it was reported.");  }
-                                       mothurOutEndLine();
+                                               m->mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
+                                       }else{  m->mothurOut(" If the reverse compliment proved to be better it was reported.");  }
+                                       m->mothurOutEndLine();
                                }
                        }
                        else{
@@ -303,11 +304,11 @@ int AlignCommand::execute(){
                                                appendAlignFiles(nonBlankAccnosFiles[h], accnosFileName);
                                                remove(nonBlankAccnosFiles[h].c_str());
                                        }
-                                       mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
+                                       m->mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
                                        if (!flip) {
-                                               mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
-                                       }else{  mothurOut(" If the reverse compliment proved to be better it was reported.");  }
-                                       mothurOutEndLine();
+                                               m->mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
+                                       }else{  m->mothurOut(" If the reverse compliment proved to be better it was reported.");  }
+                                       m->mothurOutEndLine();
                                }else{ hasAccnos = false;  }
                        }
 #else
@@ -323,29 +324,34 @@ int AlignCommand::execute(){
                        //delete accnos file if its blank else report to user
                        if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                        else { 
-                               mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
+                               m->mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
                                if (!flip) {
-                                       mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
-                               }else{  mothurOut(" If the reverse compliment proved to be better it was reported.");  }
-                               mothurOutEndLine();
+                                       m->mothurOut(" If you set the flip parameter to true mothur will try aligning the reverse compliment as well."); 
+                               }else{  m->mothurOut(" If the reverse compliment proved to be better it was reported.");  }
+                               m->mothurOutEndLine();
                        }
                        
 #endif
                        
-                       mothurOut("Output File Names: " + alignFileName + ", " + reportFileName);
-                       if (hasAccnos)  {       mothurOut(", " + accnosFileName + ".");         }
-                       else                    {       mothurOut(".");                                                         }
-                       mothurOutEndLine();
-                       
-                       mothurOut("It took " + toString(time(NULL) - start) + " secs to align " + toString(numFastaSeqs) + " sequences.");
-                       mothurOutEndLine();
-                       mothurOutEndLine();
+                       outputNames.push_back(alignFileName);
+                       outputNames.push_back(reportFileName);
+                       if (hasAccnos)  {       outputNames.push_back(accnosFileName);          }
+                                               
+                       m->mothurOut("It took " + toString(time(NULL) - start) + " secs to align " + toString(numFastaSeqs) + " sequences.");
+                       m->mothurOutEndLine();
+                       m->mothurOutEndLine();
                }
                
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "execute");
+               m->errorOut(e, "AlignCommand", "execute");
                exit(1);
        }
 }
@@ -444,10 +450,10 @@ int AlignCommand::driver(linePair* line, string alignFName, string reportFName,
                        delete candidateSeq;
                        
                        //report progress
-                       if((i+1) % 100 == 0){   mothurOut(toString(i+1)); mothurOutEndLine();           }
+                       if((i+1) % 100 == 0){   m->mothurOut(toString(i+1)); m->mothurOutEndLine();             }
                }
                //report progress
-               if((line->numSeqs) % 100 != 0){ mothurOut(toString(line->numSeqs)); mothurOutEndLine();         }
+               if((line->numSeqs) % 100 != 0){ m->mothurOut(toString(line->numSeqs)); m->mothurOutEndLine();           }
                
                alignmentFile.close();
                inFASTA.close();
@@ -456,7 +462,7 @@ int AlignCommand::driver(linePair* line, string alignFName, string reportFName,
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "driver");
+               m->errorOut(e, "AlignCommand", "driver");
                exit(1);
        }
 }
@@ -479,7 +485,7 @@ void AlignCommand::createProcesses(string alignFileName, string reportFileName,
                        }else if (pid == 0){
                                driver(lines[process], alignFileName + toString(getpid()) + ".temp", reportFileName + toString(getpid()) + ".temp", accnosFName + toString(getpid()) + ".temp", filename);
                                exit(0);
-                       }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
+                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
                
                //force parent to wait until all the processes are done
@@ -490,7 +496,7 @@ void AlignCommand::createProcesses(string alignFileName, string reportFileName,
 #endif         
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "createProcesses");
+               m->errorOut(e, "AlignCommand", "createProcesses");
                exit(1);
        }
 }
@@ -514,7 +520,7 @@ void AlignCommand::appendAlignFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "appendAlignFiles");
+               m->errorOut(e, "AlignCommand", "appendAlignFiles");
                exit(1);
        }
 }
@@ -539,7 +545,7 @@ void AlignCommand::appendReportFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "AlignCommand", "appendReportFiles");
+               m->errorOut(e, "AlignCommand", "appendReportFiles");
                exit(1);
        }
 }
index 2734c389cd0122add50ee1b3cc23cd879788ca0b..d543dbd38c2ef048aa1d536049e91d046a347685 100644 (file)
@@ -21,13 +21,14 @@ Alignment::Alignment() {    /*      do nothing      */      }
 
 Alignment::Alignment(int A) : nCols(A), nRows(A) {
        try {
+               m = MothurOut::getInstance();
                alignment.resize(nRows);                        //      For the Gotoh and Needleman-Wunsch we initialize the dynamic programming
                for(int i=0;i<nRows;i++){                       //      matrix by initializing a matrix that is A x A.  By default we will set A
                        alignment[i].resize(nCols);             //      at 2000 for 16S rRNA gene sequences
                }       
        }
        catch(exception& e) {
-               errorOut(e, "Alignment", "Alignment");
+               m->errorOut(e, "Alignment", "Alignment");
                exit(1);
        }
 }
@@ -43,7 +44,7 @@ void Alignment::resize(int A) {
                }       
        }
        catch(exception& e) {
-               errorOut(e, "Alignment", "resize");
+               m->errorOut(e, "Alignment", "resize");
                exit(1);
        }
 }
@@ -107,7 +108,7 @@ void Alignment::traceBack(){                        //      This traceback routine is used by the dynamic
                seqBend = seqB.length() - seqBend - 1;
        }
        catch(exception& e) {
-               errorOut(e, "Alignment", "traceBack");
+               m->errorOut(e, "Alignment", "traceBack");
                exit(1);
        }
 }
@@ -120,7 +121,7 @@ Alignment::~Alignment(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "Alignment", "~Alignment");
+               m->errorOut(e, "Alignment", "~Alignment");
                exit(1);
        }
 }
index 6dd7f0aed42938bd94a50bc6d4ebf88eda1c2b40..7a943fd0037430991a7baab418474e78a496d403 100644 (file)
@@ -49,6 +49,7 @@ protected:
        int pairwiseLength;
        int nRows, nCols, lA, lB;
        vector<vector<AlignmentCell> > alignment;
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index c3090486d58514af7c78311bf406aaff043a1e3d..569198fe004cf8c882f86327aa335b882735570b 100644 (file)
@@ -12,7 +12,7 @@
  *     used to calcualte the alignment.  Initially everything is set to zero and all pointers are set to 'x'
  *  
  */
-
+#include "mothurout.h"
 //********************************************************************************************************************
 
 class AlignmentCell {
index 5c758ecebb249710be141813a734eb571b88da32..59405efe05963c8d153828d7f8f56976c440f197 100644 (file)
 /**************************************************************************************************/
 AlignmentDB::AlignmentDB(string fastaFileName, string method, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch){              //      This assumes that the template database is in fasta format, may 
        try {                                                                                   //      need to alter this in the future?
+               m = MothurOut::getInstance();
                longest = 0;
 
                ifstream fastaFile;
                openInputFile(fastaFileName, fastaFile);
                
-               mothurOutEndLine();
-               mothurOut("Reading in the " + fastaFileName + " template sequences...\t");      cout.flush();
+               m->mothurOutEndLine();
+               m->mothurOut("Reading in the " + fastaFileName + " template sequences...\t");   cout.flush();
                
                while (!fastaFile.eof()) {
                        Sequence temp(fastaFile);  gobble(fastaFile);
@@ -39,8 +40,8 @@ AlignmentDB::AlignmentDB(string fastaFileName, string method, int kmerSize, floa
                fastaFile.close();
                //all of this is elsewhere already!
                
-               mothurOut("DONE.");
-               mothurOutEndLine();     cout.flush();
+               m->mothurOut("DONE.");
+               m->mothurOutEndLine();  cout.flush();
                
                //in case you delete the seqs and then ask for them
                emptySequence = Sequence();
@@ -61,8 +62,8 @@ AlignmentDB::AlignmentDB(string fastaFileName, string method, int kmerSize, floa
                else if(method == "suffix")             {       search = new SuffixDB(numSeqs);                                                         }
                else if(method == "blast")              {       search = new BlastDB(gapOpen, gapExtend, match, misMatch);      }
                else {
-                       mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8.");
-                       mothurOutEndLine();
+                       m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8.");
+                       m->mothurOutEndLine();
                        search = new KmerDB(fastaFileName, 8);
                }
                
@@ -82,7 +83,7 @@ AlignmentDB::AlignmentDB(string fastaFileName, string method, int kmerSize, floa
                search->setNumSeqs(numSeqs);
        }
        catch(exception& e) {
-               errorOut(e, "AlignmentDB", "AlignmentDB");
+               m->errorOut(e, "AlignmentDB", "AlignmentDB");
                exit(1);
        }
 }
@@ -99,7 +100,7 @@ Sequence AlignmentDB::findClosestSequence(Sequence* seq) {
                
        }
        catch(exception& e) {
-               errorOut(e, "AlignmentDB", "findClosestSequence");
+               m->errorOut(e, "AlignmentDB", "findClosestSequence");
                exit(1);
        }
 }
index fe4e52628d477546703f44624d6854a0f6699ea1..d665f788764f6ea228ad70bb99867602820a16c5 100644 (file)
@@ -34,6 +34,7 @@ private:
        Database* search;
        vector<Sequence> templateSequences;
        Sequence emptySequence;
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index 2acbacc91e53bf25b5c992edad8c970755409dd0..b98c8e294c09c6b75e9acb06bda9cbca63b7f85e 100644 (file)
@@ -43,7 +43,7 @@ bool AverageLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
                return(true);
        }
        catch(exception& e) {
-               errorOut(e, "AverageLinkage", "updateDistance");
+               m->errorOut(e, "AverageLinkage", "updateDistance");
                exit(1);
        }
 }
index a83f1edd04c3f8ddfad13887c1dbb78c9341d4f1..42fb0232ad758fed402d6a2db2fe1ca10752b85a 100644 (file)
@@ -43,10 +43,10 @@ Classify(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0), kmerSize(ksize), c
                int start = time(NULL);
                
                if(probFileTest && probFileTest2){      
-                       mothurOut("Reading template probabilities...     "); cout.flush();
+                       m->mothurOut("Reading template probabilities...     "); cout.flush();
                        readProbFile(probFileTest, probFileTest2);      
                }else{
-                       mothurOut("Calculating template probabilities...     "); cout.flush();
+                       m->mothurOut("Calculating template probabilities...     "); cout.flush();
 
                        ofstream out;
                        openOutputFile(probFileName, out);
@@ -88,11 +88,11 @@ Classify(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0), kmerSize(ksize), c
                }
                
                
-               mothurOut("DONE."); mothurOutEndLine();
-               mothurOut("It took " + toString(time(NULL) - start) + " seconds get probabilities. "); mothurOutEndLine();
+               m->mothurOut("DONE."); m->mothurOutEndLine();
+               m->mothurOut("It took " + toString(time(NULL) - start) + " seconds get probabilities. "); m->mothurOutEndLine();
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "Bayesian");
+               m->errorOut(e, "Bayesian", "Bayesian");
                exit(1);
        }
 }
@@ -122,7 +122,7 @@ string Bayesian::getTaxonomy(Sequence* seq) {
                return tax;     
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "getTaxonomy");
+               m->errorOut(e, "Bayesian", "getTaxonomy");
                exit(1);
        }
 }
@@ -196,7 +196,7 @@ string Bayesian::bootstrapResults(vector<int> kmers, int tax, int numToSelect) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "bootstrapResults");
+               m->errorOut(e, "Bayesian", "bootstrapResults");
                exit(1);
        }
 }
@@ -225,7 +225,7 @@ int Bayesian::getMostProbableTaxonomy(vector<int> queryKmer) {
                return indexofGenus;
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "getMostProbableTaxonomy");
+               m->errorOut(e, "Bayesian", "getMostProbableTaxonomy");
                exit(1);
        }
 }
@@ -252,7 +252,7 @@ map<string, int> Bayesian::parseTaxMap(string newTax) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "parseTax");
+               m->errorOut(e, "Bayesian", "parseTax");
                exit(1);
        }
 }
@@ -291,7 +291,7 @@ void Bayesian::readProbFile(ifstream& in, ifstream& inNum) {
                in.close();
        }
        catch(exception& e) {
-               errorOut(e, "Bayesian", "readProbFile");
+               m->errorOut(e, "Bayesian", "readProbFile");
                exit(1);
        }
 }
index 17859dc710309b7535e234aec56791bc7a8ee1b2..02b282926bbb2dbe1eae2ed61997c2cbe4bccb8b 100644 (file)
@@ -21,7 +21,7 @@ Bellerophon::Bellerophon(string name, string o)  {
                outputDir = o;
        }
        catch(exception& e) {
-               errorOut(e, "Bellerophon", "Bellerophon");
+               m->errorOut(e, "Bellerophon", "Bellerophon");
                exit(1);
        }
 }
@@ -39,33 +39,33 @@ void Bellerophon::print(ostream& out, ostream& outAcc) {
                        if (pref[i].score[0] > 1.0) { 
                                above1++; 
                                outAcc << pref[i].name << endl;
-                               mothurOut(pref[i].name + " is a suspected chimera at breakpoint " + toString(pref[i].midpoint)); mothurOutEndLine();
-                               mothurOut("It's score is " + toString(pref[i].score[0]) + " with suspected left parent " + pref[i].leftParent[0] + " and right parent " + pref[i].rightParent[0]); mothurOutEndLine();
+                               m->mothurOut(pref[i].name + " is a suspected chimera at breakpoint " + toString(pref[i].midpoint)); m->mothurOutEndLine();
+                               m->mothurOut("It's score is " + toString(pref[i].score[0]) + " with suspected left parent " + pref[i].leftParent[0] + " and right parent " + pref[i].rightParent[0]); m->mothurOutEndLine();
                        }
                }
                
                //output results to screen
-               mothurOutEndLine();
-               mothurOut("Sequence with preference score above 1.0: " + toString(above1)); mothurOutEndLine();
+               m->mothurOutEndLine();
+               m->mothurOut("Sequence with preference score above 1.0: " + toString(above1)); m->mothurOutEndLine();
                int spot;
                spot = pref.size()-1;
-               mothurOut("Minimum:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("Minimum:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = pref.size() * 0.975;
-               mothurOut("2.5%-tile:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("2.5%-tile:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = pref.size() * 0.75;
-               mothurOut("25%-tile:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("25%-tile:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = pref.size() * 0.50;
-               mothurOut("Median: \t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("Median: \t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = pref.size() * 0.25;
-               mothurOut("75%-tile:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("75%-tile:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = pref.size() * 0.025;
-               mothurOut("97.5%-tile:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("97.5%-tile:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
                spot = 0;
-               mothurOut("Maximum:\t" + toString(pref[spot].score[0])); mothurOutEndLine();
+               m->mothurOut("Maximum:\t" + toString(pref[spot].score[0])); m->mothurOutEndLine();
 
        }
        catch(exception& e) {
-               errorOut(e, "Bellerophon", "print");
+               m->errorOut(e, "Bellerophon", "print");
                exit(1);
        }
 }
@@ -96,28 +96,28 @@ int Bellerophon::getChimeras() {
                }
                
                distCalculator = new eachGapDist();
-               
+cout << "fastafile = " << fastafile << endl;           
                //read in sequences
                seqs = readSeqs(fastafile);
-               
-               if (unaligned) { mothurOut("Your sequences need to be aligned when you use the bellerophon method."); mothurOutEndLine(); return 1;  }
+       cout << "here:"<< endl; 
+               if (unaligned) { m->mothurOut("Your sequences need to be aligned when you use the bellerophon method."); m->mothurOutEndLine(); return 1;  }
                
                int numSeqs = seqs.size();
                
-               if (numSeqs == 0) { mothurOut("Error in reading you sequences."); mothurOutEndLine(); exit(1); }
+               if (numSeqs == 0) { m->mothurOut("Error in reading you sequences."); m->mothurOutEndLine(); exit(1); }
                
                //set default window to 25% of sequence length
                string seq0 = seqs[0]->getAligned();
                if (window == 0) { window = seq0.length() / 4;  }
                else if (window > (seq0.length() / 2)) {  
-                       mothurOut("Your sequence length is = " + toString(seq0.length()) + ". You have selected a window size greater than the length of half your aligned sequence. I will run it with a window size of " + toString((seq0.length() / 2))); mothurOutEndLine();
+                       m->mothurOut("Your sequence length is = " + toString(seq0.length()) + ". You have selected a window size greater than the length of half your aligned sequence. I will run it with a window size of " + toString((seq0.length() / 2))); m->mothurOutEndLine();
                        window = (seq0.length() / 2);
                }
                
                if (increment > (seqs[0]->getAlignLength() - (2*window))) { 
                        if (increment != 10) {
                        
-                               mothurOut("You have selected a increment that is too large. I will use the default."); mothurOutEndLine();
+                               m->mothurOut("You have selected a increment that is too large. I will use the default."); m->mothurOutEndLine();
                                increment = 10;
                                if (increment > (seqs[0]->getAlignLength() - (2*window))) {  increment = 0;  }
                                
@@ -234,7 +234,7 @@ int Bellerophon::getChimeras() {
                
        }
        catch(exception& e) {
-               errorOut(e, "Bellerophon", "getChimeras");
+               m->errorOut(e, "Bellerophon", "getChimeras");
                exit(1);
        }
 }
@@ -259,7 +259,7 @@ int Bellerophon::createSparseMatrix(int startSeq, int endSeq, SparseMatrix* spar
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "Bellerophon", "createSparseMatrix");
+               m->errorOut(e, "Bellerophon", "createSparseMatrix");
                exit(1);
        }
 }
@@ -382,7 +382,7 @@ void Bellerophon::generatePreferences(vector<SeqMap> left, vector<SeqMap> right,
 
        }
        catch(exception& e) {
-               errorOut(e, "Bellerophon", "generatePreferences");
+               m->errorOut(e, "Bellerophon", "generatePreferences");
                exit(1);
        }
 }
index a1e4b060ccf961dc7aa6bd075173f1b91d4776ac..d00403c9edc8d236ef9cd1cf02dc179001573d75 100644 (file)
@@ -23,7 +23,7 @@ EstOutput BergerParker::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "BergerParker", "getValues");
+               m->errorOut(e, "BergerParker", "getValues");
                exit(1);
        }
 }
index 6618eb6e5aa60109cf908786f4b50f7a06b02293..274a8901db3c8f17ad7e70519916c009e5613193 100644 (file)
@@ -10,7 +10,7 @@
 #include "binsequencecommand.h"
 
 //**********************************************************************************************************************
-BinSeqCommand::BinSeqCommand(string option){
+BinSeqCommand::BinSeqCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -45,8 +45,8 @@ BinSeqCommand::BinSeqCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if (globaldata->getListFile() == "") { 
-                               mothurOut("You must read a listfile before running the bin.seqs command."); 
-                               mothurOutEndLine(); 
+                               m->mothurOut("You must read a listfile before running the bin.seqs command."); 
+                               m->mothurOutEndLine(); 
                                abort = true; 
                        }
                        
@@ -83,7 +83,7 @@ BinSeqCommand::BinSeqCommand(string option){
                        
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the bin.seqs command.");  mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the bin.seqs command.");  m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
                
                        //check for optional parameter and set defaults
@@ -124,7 +124,7 @@ BinSeqCommand::BinSeqCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "BinSeqCommand", "BinSeqCommand");
+               m->errorOut(e, "BinSeqCommand", "BinSeqCommand");
                exit(1);
        }
 }
@@ -132,18 +132,18 @@ BinSeqCommand::BinSeqCommand(string option){
 
 void BinSeqCommand::help(){
        try {
-               mothurOut("The bin.seqs command can only be executed after a successful read.otu command of a listfile.\n");
-               mothurOut("The bin.seqs command parameters are fasta, name, label and group.  The fasta parameter is required.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and are separated by dashes.\n");
-               mothurOut("The bin.seqs command should be in the following format: bin.seqs(fasta=yourFastaFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n");
-               mothurOut("Example bin.seqs(fasta=amazon.fasta, group=amazon.groups, name=amazon.names).\n");
-               mothurOut("The default value for label is all lines in your inputfile.\n");
-               mothurOut("The bin.seqs command outputs a .fasta file for each distance you specify appending the OTU number to each name.\n");
-               mothurOut("If you provide a groupfile, then it also appends the sequences group to the name.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
+               m->mothurOut("The bin.seqs command can only be executed after a successful read.otu command of a listfile.\n");
+               m->mothurOut("The bin.seqs command parameters are fasta, name, label and group.  The fasta parameter is required.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and are separated by dashes.\n");
+               m->mothurOut("The bin.seqs command should be in the following format: bin.seqs(fasta=yourFastaFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n");
+               m->mothurOut("Example bin.seqs(fasta=amazon.fasta, group=amazon.groups, name=amazon.names).\n");
+               m->mothurOut("The default value for label is all lines in your inputfile.\n");
+               m->mothurOut("The bin.seqs command outputs a .fasta file for each distance you specify appending the OTU number to each name.\n");
+               m->mothurOut("If you provide a groupfile, then it also appends the sequences group to the name.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "BinSeqCommand", "help");
+               m->errorOut(e, "BinSeqCommand", "help");
                exit(1);
        }
 }
@@ -232,12 +232,12 @@ int BinSeqCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + ".");  mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + ".");  m->mothurOutEndLine();
                        }
                }
                
@@ -252,10 +252,16 @@ int BinSeqCommand::execute(){
                        delete list;  
                }
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "BinSeqCommand", "execute");
+               m->errorOut(e, "BinSeqCommand", "execute");
                exit(1);
        }
 }
@@ -289,7 +295,7 @@ void BinSeqCommand::readNamesFile() {
 
        }
        catch(exception& e) {
-               errorOut(e, "BinSeqCommand", "readNamesFile");
+               m->errorOut(e, "BinSeqCommand", "readNamesFile");
                exit(1);
        }
 }
@@ -301,8 +307,11 @@ int BinSeqCommand::process(ListVector* list) {
                                
                                string outputFileName = outputDir + getRootName(getSimpleName(globaldata->getListFile())) + list->getLabel() + ".fasta";
                                openOutputFile(outputFileName, out);
+                               
+                               //save to output list of output file names
+                               outputNames.push_back(outputFileName);
 
-                               mothurOut(list->getLabel()); mothurOutEndLine();
+                               m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                                
                                //for each bin in the list vector
                                for (int i = 0; i < list->size(); i++) {
@@ -323,7 +332,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                        }else {//if you do have groups
                                                                string group = groupMap->getGroup(name);
                                                                if (group == "not found") {  
-                                                                       mothurOut(name + " is missing from your group file. Please correct. ");  mothurOutEndLine();
+                                                                       m->mothurOut(name + " is missing from your group file. Please correct. ");  m->mothurOutEndLine();
                                                                        remove(outputFileName.c_str());
                                                                        return 1;
                                                                }else{
@@ -333,7 +342,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                                }
                                                        }
                                                }else { 
-                                                       mothurOut(name + " is missing from your fasta or name file. Please correct. "); mothurOutEndLine();
+                                                       m->mothurOut(name + " is missing from your fasta or name file. Please correct. "); m->mothurOutEndLine();
                                                        remove(outputFileName.c_str());
                                                        return 1;
                                                }
@@ -351,7 +360,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                }else {//if you do have groups
                                                        string group = groupMap->getGroup(binnames);
                                                        if (group == "not found") {  
-                                                               mothurOut(binnames + " is missing from your group file. Please correct. "); mothurOutEndLine();
+                                                               m->mothurOut(binnames + " is missing from your group file. Please correct. "); m->mothurOutEndLine();
                                                                remove(outputFileName.c_str());
                                                                return 1;
                                                        }else{
@@ -361,7 +370,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                        }
                                                }
                                        }else { 
-                                               mothurOut(binnames + " is missing from your fasta or name file. Please correct. "); mothurOutEndLine();
+                                               m->mothurOut(binnames + " is missing from your fasta or name file. Please correct. "); m->mothurOutEndLine();
                                                remove(outputFileName.c_str());
                                                return 1;
                                        }
@@ -372,7 +381,7 @@ int BinSeqCommand::process(ListVector* list) {
 
        }
        catch(exception& e) {
-               errorOut(e, "BinSeqCommand", "process");
+               m->errorOut(e, "BinSeqCommand", "process");
                exit(1);
        }
 }
index 2804235aa67822bf016dcdeb696eca4fbd9d6464..6ea7305265a6725a6a6290f6de028b307c5e8a0b 100644 (file)
@@ -41,6 +41,7 @@ private:
        string filename, fastafile, namesfile, groupfile, label, outputDir;
        ofstream out;
        ifstream in, inNames;
+       vector<string> outputNames;
        
        void readNamesFile();
        int process(ListVector*);
index 624210f5f977ac505a32119e574561ec7e92dcc2..04c7716de2958ec69353a53c0d737f8ae9cfe9dd 100644 (file)
@@ -102,9 +102,9 @@ void BlastAlignment::setPairwiseSeqs(){     //      This method call assigns the blast ge
                        pairwiseLength = 0;
                        
 //                     string dummy;
-//                     while(dummy != "query:"){       mothurOut(dummy, ""); mothurOutEndLine(); blastFile >> dummy;   }
+//                     while(dummy != "query:"){       m->mothurOut(dummy, ""); m->mothurOutEndLine(); blastFile >> dummy;     }
 //                     blastFile >> seqBend;
-//                     mothurOut(toString(seqBend), ""); mothurOutEndLine();
+//                     m->mothurOut(toString(seqBend), ""); m->mothurOutEndLine();
 //                     for(int i=0;i<seqBend;i++){
 //                             seqAaln += 'Z';
 //                             seqBaln += 'X';
index 396a6b4b91c4496b80dfc3009cdda4a0f34b12e6..17db069cdedb8a019d980c32fc4b6e7767fab27b 100644 (file)
@@ -92,7 +92,7 @@ vector<int> BlastDB::findClosestSequences(Sequence* seq, int n) {
                return topMatches;
        }
        catch(exception& e) {
-               errorOut(e, "BlastDB", "findClosestSequences");
+               m->errorOut(e, "BlastDB", "findClosestSequences");
                exit(1);
        }
 
@@ -139,7 +139,7 @@ vector<int> BlastDB::findClosestMegaBlast(Sequence* seq, int n) {
                return topMatches;
        }
        catch(exception& e) {
-               errorOut(e, "BlastDB", "findClosest");
+               m->errorOut(e, "BlastDB", "findClosest");
                exit(1);
        }
 }
@@ -158,7 +158,7 @@ void BlastDB::addSequence(Sequence seq) {
                count++;
        }
        catch(exception& e) {
-               errorOut(e, "BlastDB", "addSequence");
+               m->errorOut(e, "BlastDB", "addSequence");
                exit(1);
        }
 }
@@ -166,7 +166,7 @@ void BlastDB::addSequence(Sequence seq) {
 void BlastDB::generateDB() {
        try {
        
-               //mothurOut("Generating the temporary BLAST database...\t");    cout.flush();
+               //m->mothurOut("Generating the temporary BLAST database...\t"); cout.flush();
                
                path = globaldata->argv;
                path = path.substr(0, (path.find_last_of('m')));
@@ -174,10 +174,10 @@ void BlastDB::generateDB() {
                string formatdbCommand = path + "blast/bin/formatdb -p F -o T -i " + dbFileName;        //      format the database, -o option gives us the ability
                system(formatdbCommand.c_str());                                                                //      to get the right sequence names, i think. -p F
                                                                                                                                        //      option tells formatdb that seqs are DNA, not prot
-               //mothurOut("DONE."); mothurOutEndLine();       mothurOutEndLine(); cout.flush();
+               //m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); cout.flush();
        }
        catch(exception& e) {
-               errorOut(e, "BlastDB", "generateDB");
+               m->errorOut(e, "BlastDB", "generateDB");
                exit(1);
        }
 }
index dc1475a4f2f9d0639d2aa234403bee0b3d3e1021..b4ce2baf81a4371a2f59959f0658f11e50a13fe3 100644 (file)
--- a/boneh.cpp
+++ b/boneh.cpp
@@ -44,7 +44,7 @@ EstOutput Boneh::getValues(SAbundVector* sabund){
                bool valid = false;
                double sum = 0;
                double n = (double)sabund->getNumSeqs();
-               if(m==0){       m=n;    }
+               if(f==0){       f=n;    }
                
                double f1 = (double)sabund->get(1);
                
@@ -66,10 +66,10 @@ EstOutput Boneh::getValues(SAbundVector* sabund){
                        sum = 0;
                        for(int j = 1; j < sabund->size(); j++) {
                                for (int i = 0; i < sabund->get(j); i++) {
-                                       sum += pow(1 - j / n, n) * (1 - pow(1 - j / n, m));
+                                       sum += pow(1 - j / n, n) * (1 - pow(1 - j / n, f));
                                }
                        }
-                       sum +=  v * pow(1 - f1/(n*v), n) * (1 - pow(1 - f1/(n*v), m));
+                       sum +=  v * pow(1 - f1/(n*v), n) * (1 - pow(1 - f1/(n*v), f));
                }
 
                data[0] = sum;
@@ -77,7 +77,7 @@ EstOutput Boneh::getValues(SAbundVector* sabund){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Boneh", "getValues");
+               m->errorOut(e, "Boneh", "getValues");
                exit(1);
        }
 }
diff --git a/boneh.h b/boneh.h
index 7e328b1188c3d1d0109f627b4c8ca596793d5d4e..d2d06c0fb0128b8870b5216b0d4ab779d2542155 100644 (file)
--- a/boneh.h
+++ b/boneh.h
 class Boneh : public Calculator  {
        
 public: 
-       Boneh(int size) : m(size), Calculator("boneh", 1, false) {};
+       Boneh(int size) : f(size), Calculator("boneh", 1, false) {};
        EstOutput getValues(SAbundVector*);     
        EstOutput getValues(vector<SharedRAbundVector*>) {return data;};
 private:
        double getV(double, double, double);
-       int m;
+       int f;
 };
 
 
index 649a6028e84fb338ceba0d86bca8d75a138a0be7..833f8f49449490987653e95e50ecbb9d6cb2aa74 100644 (file)
@@ -32,7 +32,7 @@ EstOutput Bootstrap::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Bootstrap", "getValues");
+               m->errorOut(e, "Bootstrap", "getValues");
                exit(1);
        }
 }
index bfd3e984f28208d37e49f22403ad59647af38e7f..b44ce4b15d8f4121db33d12285616da1c8fde8f7 100644 (file)
@@ -22,7 +22,7 @@
 
 //**********************************************************************************************************************
 
-BootSharedCommand::BootSharedCommand(string option){
+BootSharedCommand::BootSharedCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -58,8 +58,8 @@ BootSharedCommand::BootSharedCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
-                               if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the bootstrap.shared command."); mothurOutEndLine(); abort = true; }
-                               else if (globaldata->getGroupFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the bootstrap.shared command."); mothurOutEndLine(); abort = true; }
+                               if (globaldata->getListFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the bootstrap.shared command."); m->mothurOutEndLine(); abort = true; }
+                               else if (globaldata->getGroupFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the bootstrap.shared command."); m->mothurOutEndLine(); abort = true; }
                        }
                        
                        //check for optional parameter and set defaults
@@ -144,7 +144,7 @@ BootSharedCommand::BootSharedCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "BootSharedCommand");
+               m->errorOut(e, "BootSharedCommand", "BootSharedCommand");
                exit(1);
        }
 }
@@ -153,17 +153,17 @@ BootSharedCommand::BootSharedCommand(string option){
 
 void BootSharedCommand::help(){
        try {
-               mothurOut("The bootstrap.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The bootstrap.shared command parameters are groups, calc, iters and label.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
-               mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like trees created for, and is also separated by dashes.\n");
-               mothurOut("The bootstrap.shared command should be in the following format: bootstrap.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels, iters=yourIters).\n");
-               mothurOut("Example bootstrap.shared(groups=A-B-C, calc=jabund-sorabund, iters=100).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile.\n");
-               mothurOut("The default value for calc is jclass-thetayc. The default for iters is 1000.\n");
+               m->mothurOut("The bootstrap.shared command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The bootstrap.shared command parameters are groups, calc, iters and label.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
+               m->mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like trees created for, and is also separated by dashes.\n");
+               m->mothurOut("The bootstrap.shared command should be in the following format: bootstrap.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels, iters=yourIters).\n");
+               m->mothurOut("Example bootstrap.shared(groups=A-B-C, calc=jabund-sorabund, iters=100).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The default value for calc is jclass-thetayc. The default for iters is 1000.\n");
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "help");
+               m->errorOut(e, "BootSharedCommand", "help");
                exit(1);
        }
 }
@@ -222,7 +222,7 @@ int BootSharedCommand::execute(){
                
                        if(allLines == 1 || labels.count(order->getLabel()) == 1){                      
                                
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                process(order);
                                
                                processedLabels.insert(order->getLabel());
@@ -235,7 +235,7 @@ int BootSharedCommand::execute(){
                                
                                delete order;
                                order = input->getSharedOrderVector(lastLabel);                                                                                                 
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                process(order);
 
                                processedLabels.insert(order->getLabel());
@@ -257,12 +257,12 @@ int BootSharedCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + ".");  mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + ".");  m->mothurOutEndLine();
                        }
                }
                
@@ -270,7 +270,7 @@ int BootSharedCommand::execute(){
                if (needToRun == true)  {
                                if (order != NULL) {    delete order;   }
                                order = input->getSharedOrderVector(lastLabel);                                                                                                 
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                process(order);
                                delete order;
 
@@ -278,11 +278,17 @@ int BootSharedCommand::execute(){
                
                //reset groups parameter
                globaldata->Groups.clear();  
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "execute");
+               m->errorOut(e, "BootSharedCommand", "execute");
                exit(1);
        }
 }
@@ -354,24 +360,24 @@ void BootSharedCommand::createTree(ostream* out, Tree* t){
        
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "createTree");
+               m->errorOut(e, "BootSharedCommand", "createTree");
                exit(1);
        }
 }
 /***********************************************************/
 void BootSharedCommand::printSims() {
        try {
-               mothurOut("simsMatrix"); mothurOutEndLine(); 
-               for (int m = 0; m < simMatrix.size(); m++)      {
+               m->mothurOut("simsMatrix"); m->mothurOutEndLine(); 
+               for (int k = 0; k < simMatrix.size(); k++)      {
                        for (int n = 0; n < simMatrix.size(); n++)      {
-                               mothurOut(simMatrix[m][n]);  mothurOut("\t"); 
+                               m->mothurOut(toString(simMatrix[k][n]));  m->mothurOut("\t"); 
                        }
-                       mothurOutEndLine(); 
+                       m->mothurOutEndLine(); 
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "printSims");
+               m->errorOut(e, "BootSharedCommand", "printSims");
                exit(1);
        }
 }
@@ -386,9 +392,10 @@ void BootSharedCommand::process(SharedOrderVector* order) {
                                        //create a new filename
                                        outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + treeCalculators[z]->getName() + ".boot" + order->getLabel() + ".tre";
                                        openOutputFile(outputFile, *(out[z]));
+                                       outputNames.push_back(outputFile);
                                }
                                
-                               mothurOut("Generating bootstrap trees..."); cout.flush();
+                               m->mothurOut("Generating bootstrap trees..."); cout.flush();
                                
                                //create a file for each calculator with the 1000 trees in it.
                                for (int p = 0; p < iters; p++) {
@@ -438,7 +445,7 @@ void BootSharedCommand::process(SharedOrderVector* order) {
                                        }
                                }
                                
-                               mothurOut("\tDone."); mothurOutEndLine();
+                               m->mothurOut("\tDone."); m->mothurOutEndLine();
                                //delete globaldata's tree
                                //for (int m = 0; m < globaldata->gTree.size(); m++) {  delete globaldata->gTree[m];  }
                                //globaldata->gTree.clear();
@@ -447,7 +454,7 @@ void BootSharedCommand::process(SharedOrderVector* order) {
                                //create consensus trees for each bootstrapped tree set
                                for (int k = 0; k < trees.size(); k++) {
                                        
-                                       mothurOut("Generating consensus tree for " + treeCalculators[k]->getName()); mothurOutEndLine();
+                                       m->mothurOut("Generating consensus tree for " + treeCalculators[k]->getName()); m->mothurOutEndLine();
                                        
                                        //set global data to calc trees
                                        globaldata->gTree = trees[k];
@@ -457,6 +464,9 @@ void BootSharedCommand::process(SharedOrderVector* order) {
                                        consensus->execute();
                                        delete consensus;
                                        
+                                       outputNames.push_back(filename + ".cons.pairs");
+                                       outputNames.push_back(filename + ".cons.tre");
+                                       
                                        //delete globaldata's tree
                                        //for (int m = 0; m < globaldata->gTree.size(); m++) {  delete globaldata->gTree[m];  }
                                        //globaldata->gTree.clear();
@@ -470,7 +480,7 @@ void BootSharedCommand::process(SharedOrderVector* order) {
        
        }
        catch(exception& e) {
-               errorOut(e, "BootSharedCommand", "process");
+               m->errorOut(e, "BootSharedCommand", "process");
                exit(1);
        }
 }
index 6b63233862a661634ab03f47951d683104b125c7..aa0c3250aa07ac1d1b7b81e406a821a2f788c08b 100644 (file)
@@ -58,7 +58,7 @@ private:
        set<string> labels; //holds labels to be used
        string outputFile, calc, groups, label, outputDir;
        int numGroups, iters;
-       vector<string>  Estimators, Groups; //holds estimators to be used
+       vector<string>  Estimators, Groups, outputNames; //holds estimators to be used
 
 };
        
index 566099772e8cecc3d230dbb033aa1bebed1ab885..d064ebe107e5fbc90fa10015572e60c11f9e5f45 100644 (file)
@@ -67,8 +67,8 @@ EstOutput BStick::getValues(SAbundVector* rank){
                data[1] = 0.886/sqrt(rdata.size());
                data[2] = 1.031/sqrt(rdata.size());
 
-               /*mothurOut(critVal); mothurOutEndLine();
-               mothurOut("If D-Statistic is less than the critical value then the data fits the Broken Stick model w/ 95% confidence.\n\n");*/
+               /*m->mothurOut(critVal); m->mothurOutEndLine();
+               m->mothurOut("If D-Statistic is less than the critical value then the data fits the Broken Stick model w/ 95% confidence.\n\n");*/
                
 
                if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
@@ -78,7 +78,7 @@ EstOutput BStick::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "BStick", "getValues");
+               m->errorOut(e, "BStick", "getValues");
                exit(1);
        }
 }
index 7f7296b7362912843d85448bd625454de709aeae..3aa6a57a3d34f5e840b1a35d243b7c2903708358 100644 (file)
 
 #include "calculator.h"
 
-/***********************************************************************
-void VecCalc::printElements(vector<double> vec){
-       try {
-               for(int i = 0; i < vec.size(); i++)
-                       cout << vec.at(i) << " ";
-               cout << "\n\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function printElements. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function printElements. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-
-/***********************************************************************
-
-void VecCalc::printElements(vector<string> vec){
-       try {
-               for(int i = 0; i < vec.size(); i++)
-                       cout << vec.at(i) << " ";
-               cout << "\n\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function printElements. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function printElements. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-int VecCalc::findString(vector<string> vec, string str){
-       try {
-               for(int i = 0; i < vec.size(); i++)
-                       if(str.compare(vec.at(i)) == 0)
-                               return i;
-               return -1;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function findString. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function findString. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double VecCalc::mean(vector<double> vec){
-       return sumElements(vec)/vec.size();
-}
-/***********************************************************************
-double VecCalc::stError(vector<double> vec){
-       try {
-               double sum = 0;
-               double m = mean(vec);
-               for(int i = 0; i < vec.size(); i++)
-                       sum += pow(vec.at(i)-m,2);
-               return pow(sum/(vec.size()*(vec.size()-1)), .5);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function stError. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function stError. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
 /***********************************************************************/
 int VecCalc::sumElements(vector<int> vec){
-       try {
                return sumElements(vec,0);
-       }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "sumElements");
-               exit(1);
-       }
 }
 /***********************************************************************/
 int VecCalc::sumElements(vector<int> vec, int index){
-       try {
+       
                int sum = 0;
                for(int i = index; i < vec.size(); i++)
                        sum += vec.at(i);
                return sum;
-       }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "sumElements");
-               exit(1);
-       }
+       
 }
 
 /***********************************************************************/
 double VecCalc::sumElements(vector<double> vec){
-       try {
                double sum = 0;
                for(int i = 0; i < vec.size(); i++)
                        sum += vec.at(i);
                return sum;
-       }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "sumElements");
-               exit(1);
-       }
+       
 }
 /***********************************************************************/
 double VecCalc::sumElements(vector<double> vec, int index){
-       try {
+       
                double sum = 0;
                for(int i = index; i < vec.size(); i++)
                        sum += vec.at(i);
                return sum;
-       }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "sumElements");
-               exit(1);
-       }
-}
-/***********************************************************************
-double VecCalc::findMax(vector<double> vec){
-       try {
-               double max = -1000000.0;
-               for(int i = 0; i < vec.size(); i++)
-                       if(vec.at(i) > max)
-                               max = vec.at(i);
-               return max;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function findMax. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function findMax. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
+       
 }
 /***********************************************************************/
 int VecCalc::numNZ(vector<int> vec){
-       try {
+       
                int numNZ = 0;
                for(int i = 0; i < vec.size(); i++)
                        if(vec.at(i) != 0)
                                numNZ++;
                return numNZ;
-       }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "numNZ");
-               exit(1);
-       }
+       
 }
 /***********************************************************************/
 double VecCalc::numNZ(vector<double> vec){
-       try {
+       
                double numNZ = 0;
                for(int i = 0; i < vec.size(); i++)
                        if(vec.at(i) != 0)
                                numNZ++;
                return numNZ;
        }
-       catch(exception& e) {
-               errorOut(e, "VecCalc", "numNZ");
-               exit(1);
-       }
-}
-/***********************************************************************
-double VecCalc::numPos(vector<double> vec){
-       try {
-               double numPos = 0;
-               for(int i = 0 ; i < vec.size(); i++)
-                       if(vec.at(i) > 0)
-                               numPos++;
-               return numPos;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function numPos. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function numPos. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double VecCalc::findMaxDiff(vector<double> vec1, vector<double> vec2){
-       try {
-               double maxDiff = -10000000000.0;
-               for(int i = 0; i < vec1.size(); i++)
-                       if(fabs(vec1.at(i)-vec2.at(i)) > maxDiff)
-                               maxDiff = fabs(vec1.at(i)-vec2.at(i));
-               return maxDiff;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function findMaxDiff. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function findMaxDiff. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double VecCalc::findDStat(vector<double> vec1, vector<double> vec2, double num){
-       try {
-               double mDiff = findMaxDiff(vec1, vec2);
-               return (mDiff+.5)/num;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function findDStat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function findDStat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<int> VecCalc::findQuartiles(vector<double> vec){
-       try {
-               vector<int> quartiles;
-               double max = vec.at(vec.size()-1);
-               double r1 = max/4;
-               double r2 = max*3/4;
-               bool r1found = false;
-               bool r2found = false;
-               for(int i = 0; i < vec.size(); i++)
-               {
-                       if(vec.at(i) > r1 && !r1found)
-                       {
-                               quartiles.push_back(i);
-                               r1found = true;
-                       }
-                       if(vec.at(i) > r2 && !r2found)
-                       {
-                               quartiles.push_back(i);
-                               i = vec.size();
-                       }
-               }
-               return quartiles;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function findQuartiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function findQuartiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::add(vector<double> vec, double x){
-       try {
-               vector<double> newVec;
-               for(int i = 0; i < vec.size(); i++)
-                       newVec.push_back(vec.at(i)+x);
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function add. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function add. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::multiply(vector<double> vec, double x){
-       try {
-               vector<double> newVec;
-               for(int i = 0; i < vec.size(); i++)
-                       newVec.push_back(vec.at(i)*x);
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function multiply. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function multiply. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::power(vector<double> vec, double p){
-       try {
-               vector<double> newVec;
-               for(int i = 0; i < vec.size(); i++)
-                       newVec.push_back(pow(vec.at(i), p));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function power. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function power. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::addVecs(vector<double> vec1, vector<double> vec2) //Vectors must be the same size.
-{      try {
-               vector<double> newVec;
-               for(int i = 0; i < vec1.size(); i++)
-                       newVec.push_back(vec1.at(i)+vec2.at(i));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function addVecs. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function addVecs. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::multVecs(vector<double> vec1, vector<double> vec2) //Vectors must be the same size.
-{      try {
-               vector<double> newVec;
-               for(int i = 0; i < vec1.size(); i++)
-                       newVec.push_back(vec1.at(i)*vec2.at(i));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function multVecs. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function multVecs. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::remDup(vector<double> vec){
-       try {
-               vector<double> newVec;
-               newVec.push_back(vec.at(0));
-               for(int i = 1; i < vec.size(); i++)
-                       if(vec.at(i) != vec.at(i-1))
-                               newVec.push_back(vec.at(i));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function remDup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function remDup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}      
-/***********************************************************************       
-vector<double> VecCalc::genCVec(vector<double> vec1){
-       try {
-               vector<double> vec2;
-               double sum = 0;
-               for(int i = 0; i < vec1.size(); i++)
-               {
-                       sum += vec1.at(i);
-                       vec2.push_back(sum);
-               }
-               return vec2;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function genCVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function genCVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::genRelVec(vector<double> vec){ 
-       try {
-               vector<double> newVec;
-               double sum = sumElements(vec);
-               for(int i = 0; i < vec.size(); i++)
-                       newVec.push_back(vec.at(i)/sum);
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function genRelVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function genRelVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::genDiffVec(vector<double> vec1, vector<double> vec2){
-       try {
-               vector<double> newVec;
-               for(int i = 0; i < vec1.size(); i++)
-                       newVec.push_back(vec1.at(i)-vec2.at(i));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function genDiffVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function genDiffVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::genCSVec(vector<double> vec){
-       try {
-               vector<double> newVec;
-               double curInd = vec.at(vec.size()-1);
-               double sumSpec = 0;
-               double cSumSpec = 0;
-               for(int i = vec.size()-1; i >= 0; i--)
-               {
-                       if(vec.at(i) == curInd)
-                               sumSpec++;
-                       else
-                       {
-                               cSumSpec += sumSpec;
-                               newVec.push_back(cSumSpec);
-                               sumSpec = 1;
-                               curInd = vec.at(i);
-                       }
-                       if(i == 0)
-                               newVec.push_back(cSumSpec + sumSpec);
-               }
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function genCSVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function genCSVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************       
-vector<double> VecCalc::genTotVec(vector<vector<double> > vec){
-       try {
-               vector<double> newVec = vec.at(0);
-               for(int i = 1; i < vec.size(); i++)
-                       newVec = addVecs(newVec, vec.at(i));
-               return newVec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function genTotVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function genTotVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<double> VecCalc::quicksort(vector<double> vec){
-       try {
-               sort(vec.rbegin(), vec.rend());
-               return vec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function quicksort. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function quicksort. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<vector<double> > VecCalc::gen2DVec(vector<double> vec, int div, int type){
-       try {
-               vector<vector<double> > vec2D;
-               int gap = vec.size()/div;
-               for(int i = 0; i < div; i++)
-               {
-                       vector<double> inVec;
-                       for(int j = 0; j < gap; j++)
-                               if(type == 0)
-                                       inVec.push_back(vec.at(j + i*gap)); //Rows
-                               else
-                                       inVec.push_back(vec.at(i + j*div)); //Columns
-                       vec2D.push_back(inVec);
-               }
-               return vec2D;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function gen2DVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function gen2DVec. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-vector<string> VecCalc::getSData(char name[]){
-       try {
-               vector<string> vec;
-               string data;
-               ifstream file(name);
-               if(file.is_open())
-               {
-                       while(file >> data)             
-                               vec.push_back(data);
-                       file.close();
-               }
-               return vec;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the VecCalc class Function getSData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the VecCalc class function getSData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************/      
-
-/***********************************************************************
-void BrokenStick::doBStick(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               vec = vecCalc.quicksort(vec);
-               double numInd = vecCalc.sumElements(vec);
-               double numSpec = vecCalc.numNZ(vec);
-               vector<double> cObsVec = vecCalc.genCVec(vec);
-               vector<double> cExpVec;
-               vec = vecCalc.power(vec, -1);
-               double sumExp = 0;
-               for(int i = 0; i < numSpec; i++)
-               {
-                       double n = 0;
-                       for(int j = i; j < numSpec; j++)
-                               n += 1/(double)(j+1);
-       
-                       sumExp += numInd/numSpec*n;
-                       cExpVec.push_back(sumExp);
-               }
-       
-               //Statistical analysis
-               double maxDiff = vecCalc.findMaxDiff(cObsVec, cExpVec);
-               double DStatistic = maxDiff/numInd;
-       
-               cout << "D-Statistic = " << DStatistic << "\n";
-               if(vec.size() > 30)
-                       cout << "Critical value for 95% confidence interval = " << .886/sqrt(vec.size()) << "\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the BrokenStick class Function doBStick. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the BrokenStick class function doBStick. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-
-/***********************************************************************
-double kEq(double k, double spec)
-{
-       return k/(1-k)*pow(1-k, spec)/(1-pow(1-k, spec));
-}
-/***********************************************************************/
-/*void GeometricSeries::doGeomTest(vector<double> vec)//vec = the data vector
-{      try {
-               VecCalc vecCalc;
-               vec = vecCalc.quicksort(vec);//Sorts vec
-               double numInd = vecCalc.sumElements(vec);//numInd = The total number of individuals in the data set.
-               double numSpec = vecCalc.numNZ(vec);//numSpec = the number of nonzero elements in the data set.
-               double min = -1.0*vecCalc.findMax(vecCalc.multiply(vec, -1));
-               double k = .5;
-               double step = .49999;
-               while(fabs(min - numInd*kEq(k, numSpec)) > .0001)//This uses a binary search to find the value of k.
-               {
-                       if(numInd*kEq(k, numSpec) > min)
-                               k += step;
-                       else
-                               k -= step;
-                       step /= 2;
-               }
-               cout << "k = " << k << "\n";
-               double cK = 1/(1-pow(1-k, numSpec));
-       
-               vector<double> cObsVec = vecCalc.genCVec(vec);
-               vector<double> cExpVec;
-               double sumExp = 0;
-               for(int i = 0; i < vec.size(); i++)
-               {
-                       sumExp += numInd*cK*k*pow(1-k, i);
-                       cExpVec.push_back(sumExp);
-               }
-               double maxDiff = vecCalc.findMaxDiff(cObsVec, cExpVec);
-               double DStatistic = maxDiff/numInd;
-       
-               //Statistical Analysis
-               cout << "D-Statistic = " << DStatistic << "\n";
-               if(vec.size() > 30)
-                       cout << "Critical value for 95% confidence interval = " << .886/sqrt(vec.size()) << "\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the GeometricSeries class Function doGeomTest. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the GeometricSeries class function doGeomTest. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}*/
-
-/***********************************************************************
-void Jackknifing::doJK(vector<double> vec, double cols)//vec = the data vector if the data table was read left-to-right, top-to-bottom. cols = The number of columns in the data table.
-{      try {
-               VecCalc vecCalc;
-               SSBPDiversityIndices ssbp;
-               double rows = vec.size()/cols;
-               vector<vector<double> > species = vecCalc.gen2DVec(vec, rows, 0);//converts vec into a 2 dimensional vector
-               vector<double> sumRows;
-               vector<double> pVals;
-
-               for(int i = 0; i < rows; i++)
-                       sumRows.push_back(vecCalc.sumElements(species.at(i)));
-               double st = 1/ssbp.getSimp(sumRows);//The observed estimate using the Simpson Index. Can be changed to use other indexes of diversity.
-               for(int i = 0; i < cols; i++)
-               {
-                       vector<double> newVec;
-                       for(int j = 0; j < rows; j++)
-                               newVec.push_back(vecCalc.sumElements(species.at(j))-species.at(j).at(i));
-                       pVals.push_back(cols*st-((cols-1)/ssbp.getSimp(newVec)));
-               }
-
-               double mean = vecCalc.mean(pVals);
-               double stErr = vecCalc.stError(pVals);//stErr = standard error
-               TDTable table;
-               double confidence = .95;
-               double confLimit;
-               cout << "Confidence Level (.8, .9, .95, .98, .99, .998, .999): ";
-               cin >> confidence;
-               double confLevels[] = {.80,.90,.95,.98,.99,.998,.999};
-               for(int i = 0; i < 7; i++)
-                       if(confidence == confLevels[i])
-                       {
-                               confLimit = table.getConfLimit(cols-2,i);
-                               i = 7;
-                       }
-
-               //Statistical Analysis
-               cout << "Lower limit = " << mean - confLimit*stErr << "\n";
-               cout << "Upper limit = " << mean + confLimit*stErr << "\n";
-               cout << "Observed estimate = " << st << "\n\n";
-               cout << "Jackknifed estimate = " << mean << "\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Jackknifing class Function doJK. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Jackknifing class function doJK. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-void KS2SampleTest::doKSTest(vector<double> abun1, vector<double> abun2)//abun1 = 1st vector of abundances, abun2 = 2nd vector of abundances
-{      try {
-               VecCalc vecCalc;
-               double numNZ1 = vecCalc.numNZ(abun1);//Number of nonzero elements in abun1
-               double numNZ2 = vecCalc.numNZ(abun2);//Number of nonzero elements in abun2
-               abun1 = vecCalc.quicksort(abun1);//Sorts abun1
-               abun2 = vecCalc.quicksort(abun2);//Sorts abun2
-               abun1 = vecCalc.genRelVec(abun1);//Generates the relative vector for abun1
-               abun2 = vecCalc.genRelVec(abun2);//Generates the relative vector for abun2
-       
-               abun1 = vecCalc.genCVec(abun1);//Generates the cumulative vector for abun1
-               abun2 = vecCalc.genCVec(abun2);//Generates the cumulative vector for abun2
-       
-               double maxDiff = vecCalc.findMaxDiff(abun1, abun2);
-               double DStatistic = maxDiff*numNZ1*numNZ2;
-       
-               cout << "Null Hypothesis = There is no difference.\n";
-               cout << "D-Statistic = " << DStatistic << "\n";
-       
-               double a = pow((numNZ1 + numNZ2)/(numNZ1*numNZ2),.5);
-               double pVal = exp(-2*pow(maxDiff/a,2));
-       
-               if(numNZ1 > 25 && numNZ2 > 25) //If the sample sizes are both bigger than 25.
-                       cout << "P-Value = " << pVal << "\n\n";
-               else
-               {       
-                       cout << "D-Statistic must be higher than the critical value to reject the null hypothesis.\n" ;
-                       cout << "90% Confidence Critical Value = " << 1.22*a*numNZ1*numNZ2 << "\n";
-                       cout << "95% Confidence Critical Value = " << 1.36*a*numNZ1*numNZ2 << "\n";
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the KS2SampleTest class Function doKSTest. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the KS2SampleTest class function doKSTest. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-
-/***********************************************************************
-
-void QStatistic::doQStat(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               vector<double> cVec = vecCalc.genCSVec(vec);
-               vector<int> q = vecCalc.findQuartiles(cVec);//q.at(0) is the index of the first quartile; q.at(1) is the index of the second quartile.
-               vector<double> nDupVec = vecCalc.remDup(vec);//nDupVec only contains one of every unique element in cVec.
-               double Q;
-               if(q.at(0) != 0)//The case if neither quartile is 0 or 1
-                       Q = (.5*(cVec.at(q.at(0))-cVec.at(q.at(0)-1)) + (cVec.at(q.at(1)-1)-cVec.at(q.at(0))) + .5*(cVec.at(q.at(1))-cVec.at(q.at(1)-1)))/log(nDupVec.at(nDupVec.size()-1-q.at(1))/nDupVec.at(nDupVec.size()-1-q.at(0)));
-               else if(q.at(0) == 0 && (q.at(1) == 0 || q.at(1) == 1))//The case if the quartiles are both at index 0 or one is at 0 and the other at 1.
-                       Q = (.5*cVec.at(0) + .5*(cVec.at(1)-cVec.at(0)))/log(nDupVec.at(nDupVec.size()-2)/nDupVec.at(nDupVec.size()-1));
-               else if(q.at(0) == 0 && q.at(1) > 1) //The case if the lower quartile is at index 0 and upper quartile index is above index 1.
-                       Q = (.5*cVec.at(0) + (cVec.at(q.at(1)-1)-cVec.at(q.at(0))) + .5*(cVec.at(q.at(1))-cVec.at(q.at(1)-1)))/log(nDupVec.at(nDupVec.size()-1-q.at(1))/nDupVec.at(nDupVec.size()-1));
-       
-               cout << "Q = " << Q << "\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the QStatistic class Function doQStat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the QStatistic class function doQStat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double SSBPDiversityIndices::getShan(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               double nz = vecCalc.numNZ(vec);
-               double nSum = vecCalc.sumElements(vec);
-               double H = 0;
-               for(int i = 0; i < nz; i++)
-                       H += vec.at(i)/nSum*log(vec.at(i)/nSum);
-               H *= -1;
-               return H;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SSBPDiversityIndices class Function getShan. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SSBPDiversityIndices class function getShan. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double SSBPDiversityIndices::getSimp(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               double nSum = vecCalc.sumElements(vec);
-               double D = 0;
-               for(int j = 0; j < vec.size(); j++)
-                       D += vec.at(j)*(vec.at(j)-1)/(nSum*(nSum-1));
-               return D;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SSBPDiversityIndices class Function getSimp. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SSBPDiversityIndices class function getSimp. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-double SSBPDiversityIndices::getBP(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               double nSum = vecCalc.sumElements(vec);
-               return vecCalc.findMax(vec)/nSum;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SSBPDiversityIndices class Function getBP. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SSBPDiversityIndices class function getBP. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
-/***********************************************************************
-void SSBPDiversityIndices::doSSBP(vector<double> vec)//vec = The data vector.
-{      try {
-               VecCalc vecCalc;
-               double nz = vecCalc.numNZ(vec);
-       
-               //Shannon index
-               double H = getShan(vec);
-               cout << "H = " << H << "\n";
-               cout << "Eveness = " << H/log(nz) << "\n\n";
-       
-               //Simpson index
-               double D = getSimp(vec);
-               cout << "D diversity = " << 1/D << "\n";
-               cout << "Eveness = " << 1/D/nz << "\n\n";
-       
-               //Berger-Parker index
-               double BP = getBP(vec);
-               cout << "BP index = " << BP << "\n\n";
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SSBPDiversityIndices class Function doSSBP. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SSBPDiversityIndices class function doSSBP. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
 /***********************************************************************/
 double TDTable::getConfLimit(int row, int col) //Rows are the degrees of freedom
-{    try {                       
+{                         
                //Found on http://www.vgtu.lt/leidiniai/elektroniniai/Probability.pdf/Table%203.pdf
 
                //Confidence Level        .90    .95     .975     .99    .995     .999    .9995
@@ -871,120 +97,10 @@ double TDTable::getConfLimit(int row, int col) //Rows are the degrees of freedom
                                                                {1.310, 1.697,  2.042,  2.457,  2.750,  3.385,  3.646}};
                                                                
                return values[row][col];
-       }
-       catch(exception& e) {
-               errorOut(e, "TDTable", "getConfLimit");
-               exit(1);
-       }
+       
 }
 
-/***********************************************************************
-double KOSTable::getConfLimit(int index) //Table of Critical values for N = 4-20 for One-Sample Kolmogorov-Smirnov Test
-{    try {                       
-               //Confidence Level = .05
-               //Sample size = 4-20.
-               //Found on http://www.utdallas.edu/~herve/MolinAbdi1998-LillieforsTechReport.pdf
+/***********************************************************************/
 
-               double values[21] = {.9011,
-                                                        .6372,
-                                                        .5203,
-                                                        .4506,
-                                                        0.3754,    
-                                                0.3427,                                    
-                                                        0.3245,
-                                                0.3041,
-                                                0.2875,
-                                                0.2744,
-                                                0.2616,
-                                                0.2506,
-                                                0.2426,
-                                                0.2337,
-                                                0.2257,
-                                                0.2196,
-                                                0.2128,
-                                                0.2071,
-                                                0.2018,
-                                                0.1965,
-                                                0.1920,
-                                                        };
-               return values[index];
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the TDTable class Function getConfLimit. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the TDTable class function getConfLimit. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
 
-/***********************************************************************
-void TrunLN::doTrunLN(vector<double> indVec, vector<double> specVec) //indVec = individuals vector, specVec = species vector
-{      
-       VecCalc vecCalc;
-       double numSpec = vecCalc.sumElements(specVec); //numSpec = The total number of species
-       double numInd = vecCalc.sumElements(vecCalc.multVecs(indVec,specVec)); //numInd = The total number of individuals
-       
-       double obsMean = 0;
-       for(int i = 0; i < indVec.size(); i++)
-               obsMean += log10(indVec.at(i));
-       obsMean /= numSpec; //obsMean = observed mean of the individuals vector
-       cout << "obsMean = " << obsMean << "\n";
-       double variance = 0;
-       for(int t = 0; t < indVec.size(); t++)
-               variance += pow(log10(indVec.at(t))-obsMean,2)/numSpec;
-        
-        double rO = 0;
-        for(int k = 0; k < indVec.size(); k++)
-               rO += log10(indVec.at(k));
-        rO /= indVec.size();
-        double veilLine = .5;//The desired veil line.
-        double auxFunc = -(obsMean-rO)/(obsMean-log10(veilLine));
-        double uX = obsMean-auxFunc*(obsMean-log10(veilLine));
-        double vX = variance + auxFunc*pow(obsMean-log10(veilLine),2);
-        double z = (log10(veilLine)-uX)/pow(vX, .5);
-        double p = .5*(erf(z)+1);
-        double specRichness = numSpec/(1-p);
-        
-        double numUnseen = .5*(erf((log10(.5)-uX)/pow(vX,.5))+1)*specRichness;
-        
-        
-        vector<double> cExp;
-        for(int i = 1; i < 8; i++)
-        {
-               double a = pow(10, i-1)+.5;
-               double b = log10(a);
-               double c = (b - uX)/pow(vX,.5);
-               double d = .5*(erf(c)+1);
-               double numS = d*specRichness;
-               double toPush = numS - numUnseen;
-               cExp.push_back(toPush);
-       }       
-       vector<double> cObs;
-       double sumOct = 0;
-       for(int i = 0; i < 8; i++)
-       {
-               sumOct = 0;
-               for(int r = 0; r < indVec.size(); r++)
-               {
-                       if(indVec.at(r) < pow(10, i-1)+.5)
-                               sumOct += specVec.at(r);
-                       else
-                       {
-                               cObs.push_back(sumOct);
-                               sumOct = specVec.at(r);
-                               r = indVec.size();
-                       }
-                       if(r == indVec.size()-1)
-                               cObs.push_back(sumOct);
-               }
-       }
 
-       //Statistical Analysis
-       double d = vecCalc.findDStat(cExp, cObs, numSpec);
-       cout << "DStat = " << d << "\n";
-       cout << ".05 confidence value = " << .89196/sqrt(numSpec) << "\n";
-       cout << ".01 confidence value = " << 1.0471/sqrt(numSpec) << "\n\n";
-}
-/***********************************************************************/
index ffc92b929f75fe7164301f94f969e384ad9d907a..8d9b8f01afcd580b70d92ccd1b83f0208532bb28 100644 (file)
@@ -7,6 +7,7 @@
 #include "sharedsabundvector.h"
 #include "rabundvector.hpp"
 #include "uvest.h"
+#include "mothurout.h"
 
 /* The calculator class is the parent class for all the different estimators implemented in mothur except the tree calculators.
 It has 2 pure functions EstOutput getValues(SAbundVector*), which works on a single group, and 
@@ -20,9 +21,9 @@ typedef vector<double> EstOutput;
 class Calculator {
 
 public:
-       Calculator(){};
+       Calculator(){ m = MothurOut::getInstance();  }
        virtual ~Calculator(){};
-       Calculator(string n, int c, bool m) : name(n), cols(c), multiple(m) {};
+       Calculator(string n, int c, bool f) : name(n), cols(c), multiple(f) {};
        virtual EstOutput getValues(SAbundVector*) = 0; 
        virtual EstOutput getValues(vector<SharedRAbundVector*>) = 0;
        virtual void print(ostream& f)  { f.setf(ios::fixed, ios::floatfield); f.setf(ios::showpoint);
@@ -31,6 +32,7 @@ public:
        virtual int getCols()           {       return cols;    }
        virtual bool getMultiple()  {   return multiple;   }
 protected:
+       MothurOut* m;
        EstOutput data;
        string name;
        int cols;
index 28e9723f6c19984b3e6cb9dbcfc869c0d75d6ffe..00a30e5b6c0db1f58cb90b3c564703b7d3d77f6d 100644 (file)
--- a/ccode.cpp
+++ b/ccode.cpp
@@ -38,8 +38,6 @@ void Ccode::printHeader(ostream& out) {
 void Ccode::print(ostream& out, ostream& outAcc) {
        try {
                
-               mothurOutEndLine();
-               
                ofstream out2;
                openOutputFileAppend(mapInfo, out2);
                
@@ -111,7 +109,7 @@ void Ccode::print(ostream& out, ostream& outAcc) {
                out << endl;    
                        
                if (results) {
-                       mothurOut(querySeq->getName() + " was found have at least one chimeric window."); mothurOutEndLine();
+                       m->mothurOut(querySeq->getName() + " was found have at least one chimeric window."); m->mothurOutEndLine();
                        outAcc << querySeq->getName() << endl;
                }
 
@@ -121,7 +119,7 @@ void Ccode::print(ostream& out, ostream& outAcc) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "print");
+               m->errorOut(e, "Ccode", "print");
                exit(1);
        }
 }
@@ -224,7 +222,7 @@ int Ccode::getChimeras(Sequence* query) {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getChimeras");
+               m->errorOut(e, "Ccode", "getChimeras");
                exit(1);
        }
 }
@@ -306,7 +304,7 @@ void Ccode::trimSequences(Sequence* query) {
 
                
                //check to make sure that is not whole seq
-               if ((rearPos - frontPos - 1) <= 0) {  mothurOut("Error, when I trim your sequences, the entire sequence is trimmed."); mothurOutEndLine(); exit(1);  }
+               if ((rearPos - frontPos - 1) <= 0) {  m->mothurOut("Error, when I trim your sequences, the entire sequence is trimmed."); m->mothurOutEndLine(); exit(1);  }
                
                map<int, int> tempTrim;
                tempTrim[frontPos] = rearPos;
@@ -326,7 +324,7 @@ void Ccode::trimSequences(Sequence* query) {
                spotMap = newMap;
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "trimSequences");
+               m->errorOut(e, "Ccode", "trimSequences");
                exit(1);
        }
 }
@@ -341,13 +339,13 @@ vector<int> Ccode::findWindows() {
        
                //default is wanted = 10% of total length
                if (windowSizes > length) { 
-                       mothurOut("You have slected a window larger than your sequence length after all filters, masks and trims have been done. I will use the default 10% of sequence length.");
+                       m->mothurOut("You have slected a window larger than your sequence length after all filters, masks and trims have been done. I will use the default 10% of sequence length.");
                        windowSizes = length / 10;
                }else if (windowSizes == 0) { windowSizes = length / 10;  }
                else if (windowSizes > (length * 0.20)) {
-                       mothurOut("You have selected a window that is larger than 20% of your sequence length.  This is not recommended, but I will continue anyway."); mothurOutEndLine();
+                       m->mothurOut("You have selected a window that is larger than 20% of your sequence length.  This is not recommended, but I will continue anyway."); m->mothurOutEndLine();
                }else if (windowSizes < (length * 0.05)) {
-                       mothurOut("You have selected a window that is smaller than 5% of your sequence length.  This is not recommended, but I will continue anyway."); mothurOutEndLine();
+                       m->mothurOut("You have selected a window that is smaller than 5% of your sequence length.  This is not recommended, but I will continue anyway."); m->mothurOutEndLine();
                }
                
                //save starting points of each window
@@ -361,7 +359,7 @@ vector<int> Ccode::findWindows() {
                return win;
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "findWindows");
+               m->errorOut(e, "Ccode", "findWindows");
                exit(1);
        }
 }
@@ -416,7 +414,7 @@ int Ccode::getDiff(string seqA, string seqB) {
        
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getDiff");
+               m->errorOut(e, "Ccode", "getDiff");
                exit(1);
        }
 }
@@ -486,12 +484,12 @@ void Ccode::removeBadReferenceSeqs(vector<SeqDist>& seqs) {
                        seqs = goodSeqs;
                        
                }else { //warn, but dont remove any
-                       mothurOut(querySeq->getName() + " does not have an adaquate number of reference sequences that are within 20% and 0.5% similarity.  I will continue, but please check."); mothurOutEndLine();  
+                       m->mothurOut(querySeq->getName() + " does not have an adaquate number of reference sequences that are within 20% and 0.5% similarity.  I will continue, but please check."); m->mothurOutEndLine();  
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "removeBadReferenceSeqs");
+               m->errorOut(e, "Ccode", "removeBadReferenceSeqs");
                exit(1);
        }
 }
@@ -531,7 +529,7 @@ vector<SeqDist>  Ccode::findClosest(Sequence* q, int numWanted) {
 
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "findClosestSides");
+               m->errorOut(e, "Ccode", "findClosestSides");
                exit(1);
        }
 }
@@ -618,7 +616,7 @@ void Ccode::getAverageRef(vector<SeqDist> ref) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getAverageRef");
+               m->errorOut(e, "Ccode", "getAverageRef");
                exit(1);
        }
 }
@@ -687,7 +685,7 @@ void Ccode::getAverageQuery (vector<SeqDist> ref, Sequence* query) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getAverageQuery");
+               m->errorOut(e, "Ccode", "getAverageQuery");
                exit(1);
        }
 }
@@ -713,7 +711,7 @@ void Ccode::findVarianceRef() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "findVarianceRef");
+               m->errorOut(e, "Ccode", "findVarianceRef");
                exit(1);
        }
 }
@@ -738,7 +736,7 @@ void Ccode::findVarianceQuery() {
 
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "findVarianceQuery");
+               m->errorOut(e, "Ccode", "findVarianceQuery");
                exit(1);
        }
 }
@@ -800,7 +798,7 @@ void Ccode::determineChimeras() {
                
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "determineChimeras");
+               m->errorOut(e, "Ccode", "determineChimeras");
                exit(1);
        }
 }
@@ -845,13 +843,13 @@ float Ccode::getT(int numseq) {
         else if (numseq > 2) tvalue = 2.353;
         else if (numseq > 1) tvalue = 2.920;
                else if (numseq <= 1) {
-                       mothurOut("Two or more reference sequences are required, your data will be flawed.\n"); mothurOutEndLine();
+                       m->mothurOut("Two or more reference sequences are required, your data will be flawed.\n"); m->mothurOutEndLine();
                }
                
                return tvalue;
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getT");
+               m->errorOut(e, "Ccode", "getT");
                exit(1);
        }
 }
@@ -897,13 +895,13 @@ float Ccode::getF(int numseq) {
         else if (numseq > 1) fvalue = 18.5;
         else if (numseq > 0) fvalue = 161;
                else if (numseq <= 0) {
-                       mothurOut("Two or more reference sequences are required, your data will be flawed.\n"); mothurOutEndLine();
+                       m->mothurOut("Two or more reference sequences are required, your data will be flawed.\n"); m->mothurOutEndLine();
         }
                
                return fvalue;
        }
        catch(exception& e) {
-               errorOut(e, "Ccode", "getF");
+               m->errorOut(e, "Ccode", "getF");
                exit(1);
        }
 }
index 590c20eeec65215f087bf36fd51593624e02ce02..ad1faa242b81c1520d29fb6395fa5f5825d179ec 100644 (file)
--- a/chao1.cpp
+++ b/chao1.cpp
@@ -70,7 +70,7 @@ EstOutput Chao1::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Chao1", "getValues");
+               m->errorOut(e, "Chao1", "getValues");
                exit(1);
        }
 }
index e7253ec27d25c47157527c0f386ffb84fba4d55d..820b475ef32575a1d690d568b73ce4936a8f603b 100644 (file)
@@ -50,11 +50,11 @@ string Chimera::createFilter(vector<Sequence*> seqs, float t) {
                        //cout << "a = " << a[i] <<  " t = " << t[i] <<  " g = " << g[i] <<  " c = " << c[i] << endl;
                }
 
-               mothurOut("Filter removed " + toString(numColRemoved) + " columns.");  mothurOutEndLine();
+               m->mothurOut("Filter removed " + toString(numColRemoved) + " columns.");  m->mothurOutEndLine();
                return filterString;
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "createFilter");
+               m->errorOut(e, "Chimera", "createFilter");
                exit(1);
        }
 }
@@ -80,7 +80,7 @@ map<int, int> Chimera::runFilter(Sequence* seq) {
                return maskMap;
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "runFilter");
+               m->errorOut(e, "Chimera", "runFilter");
                exit(1);
        }
 }
@@ -88,9 +88,10 @@ map<int, int> Chimera::runFilter(Sequence* seq) {
 vector<Sequence*> Chimera::readSeqs(string file) {
        try {
        
-               mothurOut("Reading sequences... "); cout.flush();
+               m->mothurOut("Reading sequences... "); cout.flush();
                ifstream in;
                openInputFile(file, in);
+               
                vector<Sequence*> container;
                int count = 0;
                length = 0;
@@ -110,12 +111,12 @@ vector<Sequence*> Chimera::readSeqs(string file) {
                }
                
                in.close();
-               mothurOut("Done."); mothurOutEndLine();
+               m->mothurOut("Done."); m->mothurOutEndLine();
                
                return container;
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "readSeqs");
+               m->errorOut(e, "Chimera", "readSeqs");
                exit(1);
        }
 }
@@ -143,7 +144,7 @@ void Chimera::setMask(string filename) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "setMask");
+               m->errorOut(e, "Chimera", "setMask");
                exit(1);
        }
 }
@@ -186,7 +187,7 @@ vector< vector<float> > Chimera::readQuantiles() {
                
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "readQuantiles");
+               m->errorOut(e, "Chimera", "readQuantiles");
                exit(1);
        }
 }
@@ -204,14 +205,14 @@ Sequence* Chimera::getSequence(string name) {
                        }
                }
                
-               if(spot == -1) { mothurOut("Error: Could not find sequence."); mothurOutEndLine(); return NULL; }
+               if(spot == -1) { m->mothurOut("Error: Could not find sequence."); m->mothurOutEndLine(); return NULL; }
                
                temp = new Sequence(templateSeqs[spot]->getName(), templateSeqs[spot]->getAligned());
                
                return temp;
        }
        catch(exception& e) {
-               errorOut(e, "Chimera", "getSequence");
+               m->errorOut(e, "Chimera", "getSequence");
                exit(1);
        }
 }
index 8c00aecf720433bec4610968bc1c227bc93d5a03..f6a5180975b134d7c5928dca4343e0a1f62074da 100644 (file)
--- a/chimera.h
+++ b/chimera.h
@@ -88,10 +88,10 @@ class Chimera {
 
        public:
        
-               Chimera(){};
-               Chimera(string);
-               Chimera(string, bool, string);
-               Chimera(string, string);
+               Chimera(){ m = MothurOut::getInstance(); }
+               Chimera(string) { m = MothurOut::getInstance(); }
+               Chimera(string, bool, string) { m = MothurOut::getInstance(); }
+               Chimera(string, string) { m = MothurOut::getInstance(); }
                virtual ~Chimera(){     for (int i = 0; i < templateSeqs.size(); i++) { delete templateSeqs[i];  } };
                virtual void setFilter(bool f)                  {       filter = f;                     }
                virtual void setCorrection(bool c)              {       correction = c;         }
@@ -138,6 +138,7 @@ class Chimera {
                float divR;
                string seqMask, quanfile, filterString, name, outputDir, templateFileName;
                Sequence* getSequence(string);  //find sequence from name       
+               MothurOut* m;
 };
 
 /***********************************************************************/
index 0a2ea59e0257b9fb58be28e9ca0cb3e0356d749e..3e6dacdee85dbb75fb9b6535f259eead8a4f2509 100644 (file)
@@ -19,7 +19,7 @@ ChimeraCheckRDP::~ChimeraCheckRDP() {
                delete kmer;
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "~AlignSim");
+               m->errorOut(e, "ChimeraCheckRDP", "~AlignSim");
                exit(1);
        }
 }      
@@ -27,7 +27,7 @@ ChimeraCheckRDP::~ChimeraCheckRDP() {
 void ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
        try {
                
-               mothurOut("Processing: " + querySeq->getName()); mothurOutEndLine();
+               m->mothurOut("Processing: " + querySeq->getName()); m->mothurOutEndLine();
                
                out << querySeq->getName() << endl;
                out << "IS scores: " << '\t';
@@ -50,7 +50,7 @@ void ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "print");
+               m->errorOut(e, "ChimeraCheckRDP", "print");
                exit(1);
        }
 }
@@ -58,7 +58,7 @@ void ChimeraCheckRDP::print(ostream& out, ostream& outAcc) {
 void ChimeraCheckRDP::doPrep() {
        try {
                templateDB = new AlignmentDB(templateFileName, "kmer", kmerSize, 0.0,0.0,0.0,0.0);
-               mothurOutEndLine();
+               m->mothurOutEndLine();
                
                kmer = new Kmer(kmerSize);
                
@@ -67,7 +67,7 @@ void ChimeraCheckRDP::doPrep() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "doPrep");
+               m->errorOut(e, "ChimeraCheckRDP", "doPrep");
                exit(1);
        }
 }
@@ -89,7 +89,7 @@ int ChimeraCheckRDP::getChimeras(Sequence* query) {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "getChimeras");
+               m->errorOut(e, "ChimeraCheckRDP", "getChimeras");
                exit(1);
        }
 }
@@ -118,14 +118,14 @@ vector<sim> ChimeraCheckRDP::findIS() {
                int start = seq.length() / 10;
                        
                //for each window
-               for (int m = start; m < (seq.length() - start); m+=increment) {
+               for (int f = start; f < (seq.length() - start); f+=increment) {
                        
-                       if ((m - kmerSize) < 0)  { mothurOut("Your sequence is too short for your kmerSize."); mothurOutEndLine(); exit(1); }
+                       if ((f - kmerSize) < 0)  { m->mothurOut("Your sequence is too short for your kmerSize."); m->mothurOutEndLine(); exit(1); }
                        
                        sim temp;
                        
-                       string fragLeft = seq.substr(0, m);  //left side of breakpoint
-                       string fragRight = seq.substr(m);  //right side of breakpoint
+                       string fragLeft = seq.substr(0, f);  //left side of breakpoint
+                       string fragRight = seq.substr(f);  //right side of breakpoint
                        
                        //make a sequence of the left side and right side
                        Sequence* left = new Sequence(queryName, fragLeft);
@@ -145,7 +145,7 @@ vector<sim> ChimeraCheckRDP::findIS() {
                        //right side is tricky - since the counts grow on eachother to find the correct counts of only the right side you must subtract the counts of the left side
                        //iterate through left sides map to subtract the number of times you saw things before you got the the right side
                        map<int, int> rightside = queryKmerInfo[queryKmerInfo.size()-1];
-                       for (map<int, int>::iterator itleft = queryKmerInfo[m-kmerSize].begin(); itleft != queryKmerInfo[m-kmerSize].end(); itleft++) {
+                       for (map<int, int>::iterator itleft = queryKmerInfo[f-kmerSize].begin(); itleft != queryKmerInfo[f-kmerSize].end(); itleft++) {
                                int howManyTotal = queryKmerInfo[queryKmerInfo.size()-1][itleft->first];   //times that kmer was seen in total
 
                                //itleft->second is times it was seen in left side, so howmanytotal - leftside should give you right side
@@ -158,7 +158,7 @@ vector<sim> ChimeraCheckRDP::findIS() {
                        }
                        
                        map<int, int> closerightside = closeRightKmerInfo[closeRightKmerInfo.size()-1];
-                       for (map<int, int>::iterator itright = closeRightKmerInfo[m-kmerSize].begin(); itright != closeRightKmerInfo[m-kmerSize].end(); itright++) {
+                       for (map<int, int>::iterator itright = closeRightKmerInfo[f-kmerSize].begin(); itright != closeRightKmerInfo[f-kmerSize].end(); itright++) {
                                int howManyTotal = closeRightKmerInfo[(closeRightKmerInfo.size()-1)][itright->first];   //times that kmer was seen in total
 
                                //itleft->second is times it was seen in left side, so howmanytotal - leftside should give you right side
@@ -171,7 +171,7 @@ vector<sim> ChimeraCheckRDP::findIS() {
                        }
 
                        
-                       int nLeft = calcKmers(closeLeftKmerInfo[m-kmerSize], queryKmerInfo[m-kmerSize]);
+                       int nLeft = calcKmers(closeLeftKmerInfo[f-kmerSize], queryKmerInfo[f-kmerSize]);
 
                        int nRight = calcKmers(closerightside, rightside);
 
@@ -181,7 +181,7 @@ vector<sim> ChimeraCheckRDP::findIS() {
                        temp.leftParent = closestLeft.getName();
                        temp.rightParent = closestRight.getName();
                        temp.score = is;
-                       temp.midpoint = m;
+                       temp.midpoint = f;
                        
                        isValues.push_back(temp);
                        
@@ -193,7 +193,7 @@ vector<sim> ChimeraCheckRDP::findIS() {
        
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "findIS");
+               m->errorOut(e, "ChimeraCheckRDP", "findIS");
                exit(1);
        }
 }
@@ -215,7 +215,7 @@ void ChimeraCheckRDP::readName(string namefile) {
        
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "readName");
+               m->errorOut(e, "ChimeraCheckRDP", "readName");
                exit(1);
        }
 }
@@ -252,7 +252,7 @@ int ChimeraCheckRDP::calcKmers(map<int, int> query, map<int, int> subject) {
                
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "calcKmers");
+               m->errorOut(e, "ChimeraCheckRDP", "calcKmers");
                exit(1);
        }
 }
@@ -310,7 +310,7 @@ void ChimeraCheckRDP::makeSVGpic(vector<sim> info) {
 
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraCheckRDP", "makeSVGpic");
+               m->errorOut(e, "ChimeraCheckRDP", "makeSVGpic");
                exit(1);
        }
 }
index fa9dd566c83014124fa302be6d5505102acdddac..487e7ca8f0425d7ba22e61690a4e0e8bc4758206 100644 (file)
@@ -12,7 +12,7 @@
 #include "nast.hpp"
 
 //***************************************************************************************************************
-ChimeraReAligner::ChimeraReAligner(vector<Sequence*> t, int m, int mm) : match(m), misMatch(mm) {  templateSeqs = t;  }
+ChimeraReAligner::ChimeraReAligner(vector<Sequence*> t, int ms, int mm) : match(ms), misMatch(mm) {  templateSeqs = t;   m = MothurOut::getInstance(); }
 //***************************************************************************************************************
 ChimeraReAligner::~ChimeraReAligner() {}       
 //***************************************************************************************************************
@@ -78,7 +78,7 @@ void ChimeraReAligner::reAlign(Sequence* query, vector<results> parents) {
                
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraReAligner", "reAlign");
+               m->errorOut(e, "ChimeraReAligner", "reAlign");
                exit(1);
        }
 }
@@ -96,14 +96,14 @@ Sequence* ChimeraReAligner::getSequence(string name) {
                        }
                }
                
-               if(spot == -1) { mothurOut("Error: Could not find sequence."); mothurOutEndLine(); return NULL; }
+               if(spot == -1) { m->mothurOut("Error: Could not find sequence."); m->mothurOutEndLine(); return NULL; }
                
                temp = new Sequence(templateSeqs[spot]->getName(), templateSeqs[spot]->getAligned());
                
                return temp;
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraReAligner", "getSequence");
+               m->errorOut(e, "ChimeraReAligner", "getSequence");
                exit(1);
        }
 }
index 2b53841e241806c435a0a8f30b7c444b6050739f..4cee6eb020643e1b1ed356b597b856614b1b0d9b 100644 (file)
@@ -30,6 +30,7 @@ class ChimeraReAligner  {
                int match, misMatch;
                
                Sequence* getSequence(string);  //find sequence from name
+               MothurOut* m;
 };
 /***********************************************************/
 
index 1758cf682fad21efcd0201b0b50b0ada7857d100..86d6d50ed4295da62d957868386036d838a222be 100644 (file)
@@ -17,7 +17,7 @@
 
 //***************************************************************************************************************
 
-ChimeraSeqsCommand::ChimeraSeqsCommand(string option){
+ChimeraSeqsCommand::ChimeraSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -91,7 +91,7 @@ ChimeraSeqsCommand::ChimeraSeqsCommand(string option){
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
-                       else if (fastafile == "not found") { fastafile = ""; mothurOut("fasta is a required parameter for the chimera.seqs command."); mothurOutEndLine(); abort = true;  }     
+                       else if (fastafile == "not found") { fastafile = ""; m->mothurOut("fasta is a required parameter for the chimera.seqs command."); m->mothurOutEndLine(); abort = true;  }       
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -198,15 +198,15 @@ ChimeraSeqsCommand::ChimeraSeqsCommand(string option){
                        else if (temp == "not found") { temp = "20"; }
                        convert(temp, numwanted);
 
-                       if ((search != "distance") && (search != "blast") && (search != "kmer")) { mothurOut(search + " is not a valid search."); mothurOutEndLine(); abort = true;  }
+                       if ((search != "distance") && (search != "blast") && (search != "kmer")) { m->mothurOut(search + " is not a valid search."); m->mothurOutEndLine(); abort = true;  }
                        
-                       if (((method != "bellerophon")) && (templatefile == "")) { mothurOut("You must provide a template file with the pintail, ccode, chimeraslayer or chimeracheck methods."); mothurOutEndLine(); abort = true;  }
+                       if (((method != "bellerophon")) && (templatefile == "")) { m->mothurOut("You must provide a template file with the pintail, ccode, chimeraslayer or chimeracheck methods."); m->mothurOutEndLine(); abort = true;  }
                        
 
                }
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "ChimeraSeqsCommand");
+               m->errorOut(e, "ChimeraSeqsCommand", "ChimeraSeqsCommand");
                exit(1);
        }
 }
@@ -216,51 +216,51 @@ void ChimeraSeqsCommand::help(){
        try {
        
                //"fasta", "filter", "correction", "processors", "method", "window", "increment", "template", "conservation", "quantile", "mask", "numwanted", "ksize", "svg", "name"
-               //mothurOut("chimera.seqs ASSUMES that your sequences are ALIGNED and if using a template that the template file sequences are the same length as the fasta file sequences.\n\n");
-               mothurOut("The chimera.seqs command reads a fastafile and creates list of potentially chimeric sequences.\n");
-               mothurOut("The chimera.seqs command parameters are fasta, filter, correction, processors, mask, method, window, increment, template, conservation, quantile, numwanted, ksize, svg, name, iters, search, realign.\n");
-               mothurOut("The fasta parameter is always required and template is required if using pintail, ccode or chimeracheck.\n");
-               mothurOut("The filter parameter allows you to specify if you would like to apply a vertical and 50% soft filter. \n");
-               mothurOut("The correction parameter allows you to put more emphasis on the distance between highly similar sequences and less emphasis on the differences between remote homologs.\n");
-               mothurOut("The processors parameter allows you to specify how many processors you would like to use.  The default is 1. \n");
-               mothurOut("The method parameter allows you to specify the method for finding chimeric sequences.  The default is pintail. Options include bellerophon, ccode and chimeracheck \n");
-               mothurOut("The mask parameter allows you to specify a file containing one sequence you wish to use as a mask for the your sequences. \n");
-               mothurOut("The window parameter allows you to specify the window size for searching for chimeras. \n");
-               mothurOut("The increment parameter allows you to specify how far you move each window while finding chimeric sequences.\n");
-               mothurOut("The template parameter allows you to enter a template file containing known non-chimeric sequences. \n");
-               mothurOut("The conservation parameter allows you to enter a frequency file containing the highest bases frequency at each place in the alignment.\n");
-               mothurOut("The quantile parameter allows you to enter a file containing quantiles for a template files sequences.\n");
-               mothurOut("The numwanted parameter allows you to specify how many sequences you would each query sequence compared with.\n");
-               mothurOut("The ksize parameter allows you to input kmersize. \n");
-               mothurOut("The svg parameter allows you to specify whether or not you would like a svg file outputted for each query sequence.\n");
-               mothurOut("The name parameter allows you to enter a file containing names of sequences you would like .svg files for.\n");
-               mothurOut("The iters parameter allows you to specify the number of bootstrap iters to do with the chimeraslayer method.\n");
-               mothurOut("The minsim parameter allows you .... \n");
-               mothurOut("The mincov parameter allows you to specify minimum coverage by closest matches found in template. Default is 70, meaning 70%. \n");
-               mothurOut("The minbs parameter allows you to specify minimum bootstrap support for calling a sequence chimeric. Default is 90, meaning 90%. \n");
-               mothurOut("The minsnp parameter allows you to specify percent of SNPs to sample on each side of breakpoint for computing bootstrap support (default: 10) \n");
-               mothurOut("The search parameter allows you to specify search method for finding the closest parent. Choices are distance, blast, and kmer, default distance.  -used only by chimeraslayer. \n");
-               mothurOut("The realign parameter allows you to realign the query to the potential paretns. Choices are true or false, default false.  -used only by chimeraslayer. \n");
-               mothurOut("NOT ALL PARAMETERS ARE USED BY ALL METHODS. Please look below for method specifics.\n\n");
-               mothurOut("Details for each method: \n"); 
-               mothurOut("\tpintail: \n"); 
-               mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=300, increment=25, conservation=not required, but will improve speed, quantile=not required, but will greatly improve speed. \n"); 
-               mothurOut("\t\tIf you have run chimera.seqs using pintail a .quan and .freq file will be created for your template, if you have not provided them for use in future command executions.\n");
-               mothurOut("\tbellerophon: \n"); 
-               mothurOut("\t\tparameters: fasta=required, filter=F, processors=1, window=1/4 length of seq, increment=25, correction=T. \n"); 
-               mothurOut("\tccode: \n"); 
-               mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=10% of length, numwanted=20\n"); 
-               mothurOut("\tchimeracheck: \n"); 
-               mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, ksize=7, svg=F, name=none\n\n"); 
-               mothurOut("\tchimeraslayer: \n"); 
-               mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n"); 
-               mothurOut("The chimera.seqs command should be in the following format: \n");
-               mothurOut("chimera.seqs(fasta=yourFastaFile, filter=yourFilter, correction=yourCorrection, processors=yourProcessors, method=bellerophon) \n");
-               mothurOut("Example: chimera.seqs(fasta=AD.align, filter=True, correction=true, method=bellerophon, window=200) \n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");        
+               //m->mothurOut("chimera.seqs ASSUMES that your sequences are ALIGNED and if using a template that the template file sequences are the same length as the fasta file sequences.\n\n");
+               m->mothurOut("The chimera.seqs command reads a fastafile and creates list of potentially chimeric sequences.\n");
+               m->mothurOut("The chimera.seqs command parameters are fasta, filter, correction, processors, mask, method, window, increment, template, conservation, quantile, numwanted, ksize, svg, name, iters, search, realign.\n");
+               m->mothurOut("The fasta parameter is always required and template is required if using pintail, ccode or chimeracheck.\n");
+               m->mothurOut("The filter parameter allows you to specify if you would like to apply a vertical and 50% soft filter. \n");
+               m->mothurOut("The correction parameter allows you to put more emphasis on the distance between highly similar sequences and less emphasis on the differences between remote homologs.\n");
+               m->mothurOut("The processors parameter allows you to specify how many processors you would like to use.  The default is 1. \n");
+               m->mothurOut("The method parameter allows you to specify the method for finding chimeric sequences.  The default is pintail. Options include bellerophon, ccode and chimeracheck \n");
+               m->mothurOut("The mask parameter allows you to specify a file containing one sequence you wish to use as a mask for the your sequences. \n");
+               m->mothurOut("The window parameter allows you to specify the window size for searching for chimeras. \n");
+               m->mothurOut("The increment parameter allows you to specify how far you move each window while finding chimeric sequences.\n");
+               m->mothurOut("The template parameter allows you to enter a template file containing known non-chimeric sequences. \n");
+               m->mothurOut("The conservation parameter allows you to enter a frequency file containing the highest bases frequency at each place in the alignment.\n");
+               m->mothurOut("The quantile parameter allows you to enter a file containing quantiles for a template files sequences.\n");
+               m->mothurOut("The numwanted parameter allows you to specify how many sequences you would each query sequence compared with.\n");
+               m->mothurOut("The ksize parameter allows you to input kmersize. \n");
+               m->mothurOut("The svg parameter allows you to specify whether or not you would like a svg file outputted for each query sequence.\n");
+               m->mothurOut("The name parameter allows you to enter a file containing names of sequences you would like .svg files for.\n");
+               m->mothurOut("The iters parameter allows you to specify the number of bootstrap iters to do with the chimeraslayer method.\n");
+               m->mothurOut("The minsim parameter allows you .... \n");
+               m->mothurOut("The mincov parameter allows you to specify minimum coverage by closest matches found in template. Default is 70, meaning 70%. \n");
+               m->mothurOut("The minbs parameter allows you to specify minimum bootstrap support for calling a sequence chimeric. Default is 90, meaning 90%. \n");
+               m->mothurOut("The minsnp parameter allows you to specify percent of SNPs to sample on each side of breakpoint for computing bootstrap support (default: 10) \n");
+               m->mothurOut("The search parameter allows you to specify search method for finding the closest parent. Choices are distance, blast, and kmer, default distance.  -used only by chimeraslayer. \n");
+               m->mothurOut("The realign parameter allows you to realign the query to the potential paretns. Choices are true or false, default false.  -used only by chimeraslayer. \n");
+               m->mothurOut("NOT ALL PARAMETERS ARE USED BY ALL METHODS. Please look below for method specifics.\n\n");
+               m->mothurOut("Details for each method: \n"); 
+               m->mothurOut("\tpintail: \n"); 
+               m->mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=300, increment=25, conservation=not required, but will improve speed, quantile=not required, but will greatly improve speed. \n"); 
+               m->mothurOut("\t\tIf you have run chimera.seqs using pintail a .quan and .freq file will be created for your template, if you have not provided them for use in future command executions.\n");
+               m->mothurOut("\tbellerophon: \n"); 
+               m->mothurOut("\t\tparameters: fasta=required, filter=F, processors=1, window=1/4 length of seq, increment=25, correction=T. \n"); 
+               m->mothurOut("\tccode: \n"); 
+               m->mothurOut("\t\tparameters: fasta=required, template=required, filter=F, mask=no mask, processors=1, window=10% of length, numwanted=20\n"); 
+               m->mothurOut("\tchimeracheck: \n"); 
+               m->mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, ksize=7, svg=F, name=none\n\n"); 
+               m->mothurOut("\tchimeraslayer: \n"); 
+               m->mothurOut("\t\tparameters: fasta=required, template=required, processors=1, increment=10, mask=no mask, numwanted=10, match=5, mismatch=-4, divergence=1.0, minsim=90, parents=5, iters=1000, window=100. \n\n"); 
+               m->mothurOut("The chimera.seqs command should be in the following format: \n");
+               m->mothurOut("chimera.seqs(fasta=yourFastaFile, filter=yourFilter, correction=yourCorrection, processors=yourProcessors, method=bellerophon) \n");
+               m->mothurOut("Example: chimera.seqs(fasta=AD.align, filter=True, correction=true, method=bellerophon, window=200) \n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");     
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "help");
+               m->errorOut(e, "ChimeraSeqsCommand", "help");
                exit(1);
        }
 }
@@ -283,10 +283,10 @@ int ChimeraSeqsCommand::execute(){
                else if (method == "ccode")                             {               chimera = new Ccode(fastafile, outputDir);                                      }
                else if (method == "chimeracheck")              {               chimera = new ChimeraCheckRDP(fastafile, outputDir);            }
                else if (method == "chimeraslayer")             {               chimera = new ChimeraSlayer(search, realign, fastafile);        }
-               else { mothurOut("Not a valid method."); mothurOutEndLine(); return 0;          }
+               else { m->mothurOut("Not a valid method."); m->mothurOutEndLine(); return 0;            }
                
                //set user options
-               if (maskfile == "default") { mothurOut("I am using the default 236627 EU009184.1 Shigella dysenteriae str. FBD013."); mothurOutEndLine();  }
+               if (maskfile == "default") { m->mothurOut("I am using the default 236627 EU009184.1 Shigella dysenteriae str. FBD013."); m->mothurOutEndLine();  }
                
                chimera->setCons(consfile);     
                chimera->setQuantiles(quanfile);                                
@@ -309,19 +309,13 @@ int ChimeraSeqsCommand::execute(){
                chimera->setMinBS(minBS);
                chimera->setMinSNP(minSNP);
                chimera->setIters(iters);
-               chimera->setTemplateFile(templatefile);
+               
 
                string outputFileName = outputDir + getRootName(getSimpleName(fastafile)) + method + maskfile + ".chimeras";
                string accnosFileName = outputDir + getRootName(getSimpleName(fastafile)) + method + maskfile + ".accnos";
-
+               bool hasAccnos = true;
                
-               if ((method != "bellerophon") && (method != "chimeracheck")) {   
-                       if (chimera->getUnaligned()) { 
-                               mothurOut("Your template sequences are different lengths, please correct."); mothurOutEndLine(); 
-                               delete chimera;
-                               return 0; 
-                       }
-               }else if (method == "bellerophon") {//run bellerophon separately since you need to read entire fastafile to run it
+               if (method == "bellerophon") {//run bellerophon separately since you need to read entire fastafile to run it
                        chimera->getChimeras();
                        
                        ofstream out;
@@ -334,9 +328,29 @@ int ChimeraSeqsCommand::execute(){
                        out.close();
                        out2.close(); 
                        
+                       //delete accnos file if its blank 
+                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
+                       
+                       m->mothurOutEndLine();
+                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+                       m->mothurOut(outputFileName); m->mothurOutEndLine();    
+                       if (hasAccnos) {  m->mothurOut(accnosFileName); m->mothurOutEndLine();  }
+                       m->mothurOutEndLine();
+
                        return 0;
                }
                
+               //reads template
+               chimera->setTemplateFile(templatefile);
+               
+               if  (method != "chimeracheck") {   
+                       if (chimera->getUnaligned()) { 
+                               m->mothurOut("Your template sequences are different lengths, please correct."); m->mothurOutEndLine(); 
+                               delete chimera;
+                               return 0; 
+                       }
+               }
+               
                //some methods need to do prep work before processing the chimeras
                chimera->doPrep(); 
                
@@ -349,7 +363,7 @@ int ChimeraSeqsCommand::execute(){
                chimera->printHeader(outHeader);
                outHeader.close();
                
-
+               
                //break up file
                #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                        if(processors == 1){
@@ -362,6 +376,9 @@ int ChimeraSeqsCommand::execute(){
                                
                                driver(lines[0], outputFileName, fastafile, accnosFileName);
                                
+                               //delete accnos file if its blank 
+                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
+                                                               
                        }else{
                                vector<int> positions;
                                processIDS.resize(0);
@@ -394,17 +411,31 @@ int ChimeraSeqsCommand::execute(){
                                createProcesses(outputFileName, fastafile, accnosFileName); 
                        
                                rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
-                               rename((accnosFileName + toString(processIDS[0]) + ".temp").c_str(), accnosFileName.c_str());
                                        
-                               //append alignment and report files
+                               //append output files
                                for(int i=1;i<processors;i++){
                                        appendOutputFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
                                        remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+                               }
+                               
+                               vector<string> nonBlankAccnosFiles;
+                               //delete blank accnos files generated with multiple processes
+                               for(int i=0;i<processors;i++){  
+                                       if (!(isBlank(accnosFileName + toString(processIDS[i]) + ".temp"))) {
+                                               nonBlankAccnosFiles.push_back(accnosFileName + toString(processIDS[i]) + ".temp");
+                                       }else { remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());  }
+                               }
+                               
+                               //append accnos files
+                               if (nonBlankAccnosFiles.size() != 0) { 
+                                       rename(nonBlankAccnosFiles[0].c_str(), accnosFileName.c_str());
                                        
-                                       appendOutputFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
-                                       remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
+                                       for (int h=1; h < nonBlankAccnosFiles.size(); h++) {
+                                               appendOutputFiles(nonBlankAccnosFiles[h], accnosFileName);
+                                               remove(nonBlankAccnosFiles[h].c_str());
+                                       }
+                               }else{ hasAccnos = false;  }
 
-                               }
                        }
 
                #else
@@ -415,10 +446,13 @@ int ChimeraSeqsCommand::execute(){
                        lines.push_back(new linePair(0, numSeqs));
                        
                        driver(lines[0], outputFileName, fastafile, accnosFileName);
+                       
+                       //delete accnos file if its blank 
+                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                #endif
                
-               //mothurOut("Output File Names: ");
-               //if ((filter) && (method == "bellerophon")) { mothurOut(
+               //m->mothurOut("Output File Names: ");
+               //if ((filter) && (method == "bellerophon")) { m->mothurOut(
                //if (outputDir == "") { fastafile = getRootName(fastafile) + "filter.fasta"; }
                //      else                             { fastafile = outputDir + getRootName(getSimpleName(fastafile)) + "filter.fasta"; }
        
@@ -429,15 +463,23 @@ int ChimeraSeqsCommand::execute(){
        
                delete chimera;
                
-               if (method == "chimeracheck") { remove(accnosFileName.c_str());  mothurOutEndLine(); mothurOut("This method does not determine if a sequence is chimeric, but allows you to make that determination based on the IS values."); mothurOutEndLine();  }
+               if (method == "chimeracheck") { remove(accnosFileName.c_str());  m->mothurOutEndLine(); m->mothurOut("This method does not determine if a sequence is chimeric, but allows you to make that determination based on the IS values."); m->mothurOutEndLine();  }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(outputFileName); m->mothurOutEndLine();    
+               if (hasAccnos) {  m->mothurOut(accnosFileName); m->mothurOutEndLine();  }
+               m->mothurOutEndLine();
+
+
                
-               mothurOutEndLine(); mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences.");       mothurOutEndLine();
+               m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
                
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "execute");
+               m->errorOut(e, "ChimeraSeqsCommand", "execute");
                exit(1);
        }
 }//**********************************************************************************************************************
@@ -462,7 +504,7 @@ int ChimeraSeqsCommand::driver(linePair* line, string outputFName, string filena
                        if (candidateSeq->getName() != "") { //incase there is a commented sequence at the end of a file
                                
                                if ((candidateSeq->getAligned().length() != templateSeqsLength) && (method != "chimeracheck")) {  //chimeracheck does not require seqs to be aligned
-                                       mothurOut(candidateSeq->getName() + " is not the same length as the template sequences. Skipping."); mothurOutEndLine();
+                                       m->mothurOut(candidateSeq->getName() + " is not the same length as the template sequences. Skipping."); m->mothurOutEndLine();
                                }else{
                                        //find chimeras
                                        chimera->getChimeras(candidateSeq);
@@ -474,10 +516,10 @@ int ChimeraSeqsCommand::driver(linePair* line, string outputFName, string filena
                        delete candidateSeq;
                        
                        //report progress
-                       if((i+1) % 100 == 0){   mothurOut("Processing sequence: " + toString(i+1)); mothurOutEndLine();         }
+                       if((i+1) % 100 == 0){   m->mothurOut("Processing sequence: " + toString(i+1)); m->mothurOutEndLine();           }
                }
                //report progress
-               if((line->numSeqs) % 100 != 0){ mothurOut("Processing sequence: " + toString(line->numSeqs)); mothurOutEndLine();               }
+               if((line->numSeqs) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(line->numSeqs)); m->mothurOutEndLine();         }
                
                out.close();
                out2.close();
@@ -486,7 +528,7 @@ int ChimeraSeqsCommand::driver(linePair* line, string outputFName, string filena
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "driver");
+               m->errorOut(e, "ChimeraSeqsCommand", "driver");
                exit(1);
        }
 }
@@ -509,7 +551,7 @@ void ChimeraSeqsCommand::createProcesses(string outputFileName, string filename,
                        }else if (pid == 0){
                                driver(lines[process], outputFileName + toString(getpid()) + ".temp", filename, accnos + toString(getpid()) + ".temp");
                                exit(0);
-                       }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
+                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
                
                //force parent to wait until all the processes are done
@@ -520,7 +562,7 @@ void ChimeraSeqsCommand::createProcesses(string outputFileName, string filename,
 #endif         
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "createProcesses");
+               m->errorOut(e, "ChimeraSeqsCommand", "createProcesses");
                exit(1);
        }
 }
@@ -545,7 +587,7 @@ void ChimeraSeqsCommand::appendOutputFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSeqsCommand", "appendOuputFiles");
+               m->errorOut(e, "ChimeraSeqsCommand", "appendOuputFiles");
                exit(1);
        }
 }
index 6ca8c2945bb4600e6c7f518b1d7c4dfa1a529225..f8651079c8da037e6aeb119d494a350ae410597a 100644 (file)
@@ -99,11 +99,11 @@ void ChimeraSlayer::doPrep() {
                //run filter on template
                for (int i = 0; i < templateSeqs.size(); i++) {  runFilter(templateSeqs[i]);  }
                
-               mothurOutEndLine(); mothurOut("It took " + toString(time(NULL) - start) + " secs to filter.");  mothurOutEndLine();
+               m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to filter.");    m->mothurOutEndLine();
 
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSlayer", "doprep");
+               m->errorOut(e, "ChimeraSlayer", "doprep");
                exit(1);
        }
 }
@@ -111,9 +111,9 @@ void ChimeraSlayer::doPrep() {
 ChimeraSlayer::~ChimeraSlayer() {      delete decalc;  if (searchMethod == "kmer") {  delete databaseRight;  delete databaseLeft;  }    }
 //***************************************************************************************************************
 void ChimeraSlayer::printHeader(ostream& out) {
-       mothurOutEndLine();
-       mothurOut("Only reporting sequence supported by " + toString(minBS) + "% of bootstrapped results.");
-       mothurOutEndLine();
+       m->mothurOutEndLine();
+       m->mothurOut("Only reporting sequence supported by " + toString(minBS) + "% of bootstrapped results.");
+       m->mothurOutEndLine();
        
        out << "Name\tLeftParent\tRightParent\tDivQLAQRB\tPerIDQLAQRB\tBootStrapA\tDivQLBQRA\tPerIDQLBQRA\tBootStrapB\tFlag\tLeftWindow\tRightWindow\n";
 }
@@ -129,7 +129,7 @@ void ChimeraSlayer::print(ostream& out, ostream& outAcc) {
                        
                        if (chimeraFlag == "yes") {     
                                if ((chimeraResults[0].bsa >= minBS) || (chimeraResults[0].bsb >= minBS)) {
-                                       mothurOut(querySeq->getName() + "\tyes"); mothurOutEndLine();
+                                       m->mothurOut(querySeq->getName() + "\tyes"); m->mothurOutEndLine();
                                        outAcc << querySeq->getName() << endl;
                                }
                        }
@@ -140,7 +140,7 @@ void ChimeraSlayer::print(ostream& out, ostream& outAcc) {
                
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSlayer", "print");
+               m->errorOut(e, "ChimeraSlayer", "print");
                exit(1);
        }
 }
@@ -247,7 +247,7 @@ int ChimeraSlayer::getChimeras(Sequence* query) {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSlayer", "getChimeras");
+               m->errorOut(e, "ChimeraSlayer", "getChimeras");
                exit(1);
        }
 }
@@ -282,7 +282,7 @@ void ChimeraSlayer::printBlock(data_struct data, ostream& out){
 
        }
        catch(exception& e) {
-               errorOut(e, "ChimeraSlayer", "printBlock");
+               m->errorOut(e, "ChimeraSlayer", "printBlock");
                exit(1);
        }
 }
index 346c76478eefdf896fe6f04659174321bc721063..2db19735a8726e78269fbcce2a58521aa2205b19 100644 (file)
@@ -17,7 +17,7 @@
 /**************************************************************************************************/
 Classify::Classify(string tfile, string tempFile, string method, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch) : taxFile(tfile), templateFile(tempFile) {         
        try {   
-                                                                                       
+               m = MothurOut::getInstance();                                                                   
                readTaxonomy(taxFile);  
                
                int start = time(NULL);
@@ -30,7 +30,7 @@ Classify::Classify(string tfile, string tempFile, string method, int kmerSize, f
                        inFASTA.close();
                }
 
-               mothurOut("Generating search database...    "); cout.flush();
+               m->mothurOut("Generating search database...    "); cout.flush();
                                
                bool needToGenerate = true;
                string kmerDBName;
@@ -45,8 +45,8 @@ Classify::Classify(string tfile, string tempFile, string method, int kmerSize, f
                else if(method == "blast")              {       database = new BlastDB(gapOpen, gapExtend, match, misMatch);    }
                else if(method == "distance")   {       database = new DistanceDB();    }
                else {
-                       mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8.");
-                       mothurOutEndLine();
+                       m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8.");
+                       m->mothurOutEndLine();
                        database = new KmerDB(tempFile, 8);
                }
                
@@ -84,12 +84,12 @@ Classify::Classify(string tfile, string tempFile, string method, int kmerSize, f
                
                database->setNumSeqs(names.size());
                
-               mothurOut("DONE."); mothurOutEndLine();
-               mothurOut("It took " + toString(time(NULL) - start) + " seconds generate search database. "); mothurOutEndLine();
+               m->mothurOut("DONE."); m->mothurOutEndLine();
+               m->mothurOut("It took " + toString(time(NULL) - start) + " seconds generate search database. "); m->mothurOutEndLine();
 
        }
        catch(exception& e) {
-               errorOut(e, "Classify", "Classify");
+               m->errorOut(e, "Classify", "Classify");
                exit(1);
        }
 }
@@ -103,8 +103,8 @@ void Classify::readTaxonomy(string file) {
                ifstream inTax;
                openInputFile(file, inTax);
        
-               mothurOutEndLine();
-               mothurOut("Reading in the " + file + " taxonomy...\t"); cout.flush();
+               m->mothurOutEndLine();
+               m->mothurOut("Reading in the " + file + " taxonomy...\t");      cout.flush();
                
                string name, taxInfo;
                //read template seqs and save
@@ -121,12 +121,12 @@ void Classify::readTaxonomy(string file) {
                phyloTree->assignHeirarchyIDs(0);
                inTax.close();
        
-               mothurOut("DONE.");
-               mothurOutEndLine();     cout.flush();
+               m->mothurOut("DONE.");
+               m->mothurOutEndLine();  cout.flush();
        
        }
        catch(exception& e) {
-               errorOut(e, "Classify", "readTaxonomy");
+               m->errorOut(e, "Classify", "readTaxonomy");
                exit(1);
        }
 }
@@ -152,7 +152,7 @@ vector<string> Classify::parseTax(string tax) {
                return taxons;
        }
        catch(exception& e) {
-               errorOut(e, "Classify", "parseTax");
+               m->errorOut(e, "Classify", "parseTax");
                exit(1);
        }
 }
index 5c5a7ac474ecc0ce7308672e1a606c0052643caa..1a34362ce798072d8554bb22a997b11dc16d223b 100644 (file)
@@ -48,6 +48,7 @@ protected:
        
        void readTaxonomy(string);
        vector<string> parseTax(string);
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index 51578e3ec27dda5b1d73b3497201430cd9868495..7a9a5e9b6f7b54d1218064cc03f7d5c94cb4d31d 100644 (file)
@@ -15,7 +15,7 @@
 
 //**********************************************************************************************************************
 
-ClassifySeqsCommand::ClassifySeqsCommand(string option){
+ClassifySeqsCommand::ClassifySeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -67,14 +67,14 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option){
                        //check for required parameters
                        templateFileName = validParameter.validFile(parameters, "template", true);
                        if (templateFileName == "not found") { 
-                               mothurOut("template is a required parameter for the classify.seqs command."); 
-                               mothurOutEndLine();
+                               m->mothurOut("template is a required parameter for the classify.seqs command."); 
+                               m->mothurOutEndLine();
                                abort = true; 
                        }
                        else if (templateFileName == "not open") { abort = true; }      
                        
                        fastaFileName = validParameter.validFile(parameters, "fasta", false);
-                       if (fastaFileName == "not found") { mothurOut("fasta is a required parameter for the classify.seqs command."); mothurOutEndLine(); abort = true;  }
+                       if (fastaFileName == "not found") { m->mothurOut("fasta is a required parameter for the classify.seqs command."); m->mothurOutEndLine(); abort = true;  }
                        else { 
                                splitAtDash(fastaFileName, fastaFileNames);
                                
@@ -90,7 +90,7 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option){
                                        ifstream in;
                                        ableToOpen = openInputFile(fastaFileNames[i], in);
                                        if (ableToOpen == 1) { 
-                                               mothurOut(fastaFileNames[i] + " will be disregarded."); mothurOutEndLine(); 
+                                               m->mothurOut(fastaFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); 
                                                //erase from file list
                                                fastaFileNames.erase(fastaFileNames.begin()+i);
                                                i--;
@@ -99,14 +99,14 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option){
                                }
                                
                                //make sure there is at least one valid file left
-                               if (fastaFileNames.size() == 0) { mothurOut("no valid files."); mothurOutEndLine(); abort = true; }
+                               if (fastaFileNames.size() == 0) { m->mothurOut("no valid files."); m->mothurOutEndLine(); abort = true; }
                        }
 
                        
                        taxonomyFileName = validParameter.validFile(parameters, "taxonomy", true);
                        if (taxonomyFileName == "not found") { 
-                               mothurOut("taxonomy is a required parameter for the classify.seqs command."); 
-                               mothurOutEndLine();
+                               m->mothurOut("taxonomy is a required parameter for the classify.seqs command."); 
+                               m->mothurOutEndLine();
                                abort = true; 
                        }
                        else if (taxonomyFileName == "not open") { abort = true; }      
@@ -129,13 +129,13 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option){
                                        int ableToOpen;
                                        ifstream in;
                                        ableToOpen = openInputFile(namefileNames[i], in);
-                                       if (ableToOpen == 1) {  mothurOut("Unable to match name file with fasta file."); mothurOutEndLine(); abort = true;      }
+                                       if (ableToOpen == 1) {  m->mothurOut("Unable to match name file with fasta file."); m->mothurOutEndLine(); abort = true;        }
                                        in.close();
                                }
                        }
 
                        if (namefile != "") {
-                               if (namefileNames.size() != fastaFileNames.size()) { abort = true; mothurOut("If you provide a name file, you must have one for each fasta file."); mothurOutEndLine(); }
+                               if (namefileNames.size() != fastaFileNames.size()) { abort = true; m->mothurOut("If you provide a name file, you must have one for each fasta file."); m->mothurOutEndLine(); }
                        }
                        
                        //check for optional parameter and set defaults
@@ -178,14 +178,14 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option){
 
                        
                        if ((method == "bayesian") && (search != "kmer"))  { 
-                               mothurOut("The bayesian method requires the kmer search." + search + "will be disregarded." ); mothurOutEndLine();
+                               m->mothurOut("The bayesian method requires the kmer search." + search + "will be disregarded." ); m->mothurOutEndLine();
                                search = "kmer";
                        }
                }
                
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "ClassifySeqsCommand");
+               m->errorOut(e, "ClassifySeqsCommand", "ClassifySeqsCommand");
                exit(1);
        }
 }
@@ -203,31 +203,31 @@ ClassifySeqsCommand::~ClassifySeqsCommand(){
 
 void ClassifySeqsCommand::help(){
        try {
-               mothurOut("The classify.seqs command reads a fasta file containing sequences and creates a .taxonomy file and a .tax.summary file.\n");
-               mothurOut("The classify.seqs command parameters are template, fasta, name, search, ksize, method, taxonomy, processors, match, mismatch, gapopen, gapextend, numwanted and probs.\n");
-               mothurOut("The template, fasta and taxonomy parameters are required. You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n");
-               mothurOut("The search parameter allows you to specify the method to find most similar template.  Your options are: suffix, kmer, blast and distance. The default is kmer.\n");
-               mothurOut("The name parameter allows you add a names file with your fasta file, if you enter multiple fasta files, you must enter matching names files for them.\n");
-               mothurOut("The method parameter allows you to specify classification method to use.  Your options are: bayesian and knn. The default is bayesian.\n");
-               mothurOut("The ksize parameter allows you to specify the kmer size for finding most similar template to candidate.  The default is 8.\n");
-               mothurOut("The processors parameter allows you to specify the number of processors to use. The default is 1.\n");
-               mothurOut("The match parameter allows you to specify the bonus for having the same base. The default is 1.0.\n");
-               mothurOut("The mistmatch parameter allows you to specify the penalty for having different bases.  The default is -1.0.\n");
-               mothurOut("The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -2.0.\n");
-               mothurOut("The gapextend parameter allows you to specify the penalty for extending a gap in an alignment.  The default is -1.0.\n");
-               mothurOut("The numwanted parameter allows you to specify the number of sequence matches you want with the knn method.  The default is 10.\n");
-               mothurOut("The cutoff parameter allows you to specify a bootstrap confidence threshold for your taxonomy.  The default is 0.\n");
-               mothurOut("The probs parameter shut off the bootstrapping results for the bayesian method. The default is true, meaning you want the bootstrapping to be run.\n");
-               mothurOut("The iters parameter allows you to specify how many iterations to do when calculating the bootstrap confidence score for your taxonomy with the bayesian method.  The default is 100.\n");
-               mothurOut("The classify.seqs command should be in the following format: \n");
-               mothurOut("classify.seqs(template=yourTemplateFile, fasta=yourFastaFile, method=yourClassificationMethod, search=yourSearchmethod, ksize=yourKmerSize, taxonomy=yourTaxonomyFile, processors=yourProcessors) \n");
-               mothurOut("Example classify.seqs(fasta=amazon.fasta, template=core.filtered, method=knn, search=gotoh, ksize=8, processors=2)\n");
-               mothurOut("The .taxonomy file consists of 2 columns: 1 = your sequence name, 2 = the taxonomy for your sequence. \n");
-               mothurOut("The .tax.summary is a summary of the different taxonomies represented in your fasta file. \n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
+               m->mothurOut("The classify.seqs command reads a fasta file containing sequences and creates a .taxonomy file and a .tax.summary file.\n");
+               m->mothurOut("The classify.seqs command parameters are template, fasta, name, search, ksize, method, taxonomy, processors, match, mismatch, gapopen, gapextend, numwanted and probs.\n");
+               m->mothurOut("The template, fasta and taxonomy parameters are required. You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n");
+               m->mothurOut("The search parameter allows you to specify the method to find most similar template.  Your options are: suffix, kmer, blast and distance. The default is kmer.\n");
+               m->mothurOut("The name parameter allows you add a names file with your fasta file, if you enter multiple fasta files, you must enter matching names files for them.\n");
+               m->mothurOut("The method parameter allows you to specify classification method to use.  Your options are: bayesian and knn. The default is bayesian.\n");
+               m->mothurOut("The ksize parameter allows you to specify the kmer size for finding most similar template to candidate.  The default is 8.\n");
+               m->mothurOut("The processors parameter allows you to specify the number of processors to use. The default is 1.\n");
+               m->mothurOut("The match parameter allows you to specify the bonus for having the same base. The default is 1.0.\n");
+               m->mothurOut("The mistmatch parameter allows you to specify the penalty for having different bases.  The default is -1.0.\n");
+               m->mothurOut("The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -2.0.\n");
+               m->mothurOut("The gapextend parameter allows you to specify the penalty for extending a gap in an alignment.  The default is -1.0.\n");
+               m->mothurOut("The numwanted parameter allows you to specify the number of sequence matches you want with the knn method.  The default is 10.\n");
+               m->mothurOut("The cutoff parameter allows you to specify a bootstrap confidence threshold for your taxonomy.  The default is 0.\n");
+               m->mothurOut("The probs parameter shut off the bootstrapping results for the bayesian method. The default is true, meaning you want the bootstrapping to be run.\n");
+               m->mothurOut("The iters parameter allows you to specify how many iterations to do when calculating the bootstrap confidence score for your taxonomy with the bayesian method.  The default is 100.\n");
+               m->mothurOut("The classify.seqs command should be in the following format: \n");
+               m->mothurOut("classify.seqs(template=yourTemplateFile, fasta=yourFastaFile, method=yourClassificationMethod, search=yourSearchmethod, ksize=yourKmerSize, taxonomy=yourTaxonomyFile, processors=yourProcessors) \n");
+               m->mothurOut("Example classify.seqs(fasta=amazon.fasta, template=core.filtered, method=knn, search=gotoh, ksize=8, processors=2)\n");
+               m->mothurOut("The .taxonomy file consists of 2 columns: 1 = your sequence name, 2 = the taxonomy for your sequence. \n");
+               m->mothurOut("The .tax.summary is a summary of the different taxonomies represented in your fasta file. \n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "help");
+               m->errorOut(e, "ClassifySeqsCommand", "help");
                exit(1);
        }
 }
@@ -242,11 +242,12 @@ int ClassifySeqsCommand::execute(){
                if(method == "bayesian"){       classify = new Bayesian(taxonomyFileName, templateFileName, search, kmerSize, cutoff, iters);           }
                else if(method == "knn"){       classify = new Knn(taxonomyFileName, templateFileName, search, kmerSize, gapOpen, gapExtend, match, misMatch, numWanted);                               }
                else {
-                       mothurOut(search + " is not a valid method option. I will run the command using bayesian.");
-                       mothurOutEndLine();
+                       m->mothurOut(search + " is not a valid method option. I will run the command using bayesian.");
+                       m->mothurOutEndLine();
                        classify = new Bayesian(taxonomyFileName, templateFileName, search, kmerSize, cutoff, iters);   
                }
 
+               vector<string> outputNames;
                                
                for (int s = 0; s < fastaFileNames.size(); s++) {
                
@@ -265,13 +266,16 @@ int ClassifySeqsCommand::execute(){
                                inNames.close();
                        }
                
-                       mothurOut("Classifying sequences from " + fastaFileNames[s] + " ..." ); mothurOutEndLine();
+                       m->mothurOut("Classifying sequences from " + fastaFileNames[s] + " ..." ); m->mothurOutEndLine();
                        
                        if (outputDir == "") { outputDir += hasPath(fastaFileNames[s]); }
                        string newTaxonomyFile = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + getRootName(getSimpleName(taxonomyFileName)) + "taxonomy";
                        string tempTaxonomyFile = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + "taxonomy.temp";
                        string taxSummary = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + getRootName(getSimpleName(taxonomyFileName)) + "tax.summary";
                        
+                       outputNames.push_back(newTaxonomyFile);
+                       outputNames.push_back(taxSummary);
+                       
                        int start = time(NULL);
                        int numFastaSeqs = 0;
                        for (int i = 0; i < lines.size(); i++) {  delete lines[i];  }  lines.clear();
@@ -352,7 +356,7 @@ int ClassifySeqsCommand::execute(){
                                        itNames = nameMap.find(name);
                
                                        if (itNames == nameMap.end()) { 
-                                               mothurOut(name + " is not in your name file please correct."); mothurOutEndLine(); exit(1);
+                                               m->mothurOut(name + " is not in your name file please correct."); m->mothurOutEndLine(); exit(1);
                                        }else{
                                                for (int i = 0; i < itNames->second; i++) { 
                                                        taxaBrowser.addSeqToTree(name+toString(i), taxon);  //add it as many times as there are identical seqs
@@ -399,15 +403,21 @@ int ClassifySeqsCommand::execute(){
                        remove(newTaxonomyFile.c_str());
                        rename(unclass.c_str(), newTaxonomyFile.c_str());
                        
-                       mothurOutEndLine();
-                       mothurOut("It took " + toString(time(NULL) - start) + " secs to classify " + toString(numFastaSeqs) + " sequences."); mothurOutEndLine(); mothurOutEndLine();
+                       m->mothurOutEndLine();
+                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+                       m->mothurOutEndLine();
+
+                       
+                       m->mothurOutEndLine();
+                       m->mothurOut("It took " + toString(time(NULL) - start) + " secs to classify " + toString(numFastaSeqs) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
                }
                
                delete classify;
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "execute");
+               m->errorOut(e, "ClassifySeqsCommand", "execute");
                exit(1);
        }
 }
@@ -436,7 +446,7 @@ string ClassifySeqsCommand::addUnclassifieds(string tax, int maxlevel) {
                return newTax;
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "addUnclassifieds");
+               m->errorOut(e, "ClassifySeqsCommand", "addUnclassifieds");
                exit(1);
        }
 }
@@ -459,7 +469,7 @@ void ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile
                        }else if (pid == 0){
                                driver(lines[process], taxFileName + toString(getpid()) + ".temp", tempTaxFile + toString(getpid()) + ".temp", filename);
                                exit(0);
-                       }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
+                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
                
                //force parent to wait until all the processes are done
@@ -470,7 +480,7 @@ void ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile
 #endif         
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "createProcesses");
+               m->errorOut(e, "ClassifySeqsCommand", "createProcesses");
                exit(1);
        }
 }
@@ -493,7 +503,7 @@ void ClassifySeqsCommand::appendTaxFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "appendTaxFiles");
+               m->errorOut(e, "ClassifySeqsCommand", "appendTaxFiles");
                exit(1);
        }
 }
@@ -536,7 +546,7 @@ int ClassifySeqsCommand::driver(linePair* line, string taxFName, string tempTFNa
                        delete candidateSeq;
                        
                        if((i+1) % 100 == 0){
-                               mothurOut("Classifying sequence " + toString(i+1)); mothurOutEndLine();
+                               m->mothurOut("Classifying sequence " + toString(i+1)); m->mothurOutEndLine();
                        }
                }
                
@@ -547,7 +557,7 @@ int ClassifySeqsCommand::driver(linePair* line, string taxFName, string tempTFNa
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "ClassifySeqsCommand", "driver");
+               m->errorOut(e, "ClassifySeqsCommand", "driver");
                exit(1);
        }
 }
index 19fc8a011d9b3dbc8dd8f1e482f7b50dc100078f..890085e53261ccf204a02b44fd6634e5020f0af0 100644 (file)
@@ -28,7 +28,7 @@
 class ClassifySeqsCommand : public Command {
        
 public:
-       ClassifySeqsCommand(string);    
+       ClassifySeqsCommand(string);
        ~ClassifySeqsCommand();
        int execute(); 
        void help();    
index c6a9ca4059b0fafb4dc2529ccf12bf3f134eb69e..bd5986e7d7a2d0bdfe759088c8306e206a4ee9ad 100644 (file)
@@ -14,8 +14,8 @@
 
 /***********************************************************************/
 
-Cluster::Cluster(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c, string m) :
-rabund(rav), list(lv), dMatrix(dm), method(m)
+Cluster::Cluster(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c, string f) :
+rabund(rav), list(lv), dMatrix(dm), method(f)
 {
 /*
        cout << "sizeof(MatData): " << sizeof(MatData) << endl;
@@ -59,6 +59,7 @@ rabund(rav), list(lv), dMatrix(dm), method(m)
        
        //save so you can modify as it changes in average neighbor
        cutoff = c;
+       m = MothurOut::getInstance();
 }
 
 /***********************************************************************/
@@ -77,7 +78,7 @@ void Cluster::getRowColCells() {
                nColCells = colCells.size();
        }
        catch(exception& e) {
-               errorOut(e, "Cluster", "getRowColCells");
+               m->errorOut(e, "Cluster", "getRowColCells");
                exit(1);
        }
 
@@ -142,7 +143,7 @@ void Cluster::clusterBins(){
        //      cout << '\t' << rabund->get(smallRow) << '\t' << rabund->get(smallCol) << endl;
        }
        catch(exception& e) {
-               errorOut(e, "Cluster", "clusterBins");
+               m->errorOut(e, "Cluster", "clusterBins");
                exit(1);
        }
 
@@ -163,7 +164,7 @@ void Cluster::clusterNames(){
        //      cout << '\t' << list->get(smallRow) << '\t' << list->get(smallCol) << endl;
     }
        catch(exception& e) {
-               errorOut(e, "Cluster", "clusterNames");
+               m->errorOut(e, "Cluster", "clusterNames");
                exit(1);
        }
 
@@ -213,10 +214,10 @@ void Cluster::update(double& cutOFF){
                                }
                                //if not merged it you need it for warning 
                                if ((!merged) && (method == "average")) {  
-                                       //mothurOut("Warning: trying to merge cell " + toString(rowCells[i]->row+1) + " " + toString(rowCells[i]->column+1) + " distance " + toString(rowCells[i]->dist) + " with value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); mothurOutEndLine(); 
+                                       //m->mothurOut("Warning: trying to merge cell " + toString(rowCells[i]->row+1) + " " + toString(rowCells[i]->column+1) + " distance " + toString(rowCells[i]->dist) + " with value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); m->mothurOutEndLine(); 
                                        if (cutOFF > rowCells[i]->dist) {  
                                                cutOFF = rowCells[i]->dist;  
-                                               //mothurOut("changing cutoff to " + toString(cutOFF));  mothurOutEndLine(); 
+                                               //m->mothurOut("changing cutoff to " + toString(cutOFF));  m->mothurOutEndLine(); 
                                        }
 
                                }
@@ -233,10 +234,10 @@ void Cluster::update(double& cutOFF){
                        if (foundCol[i] == 0) {
                                if (method == "average") {
                                        if (!((colCells[i]->row == smallRow) && (colCells[i]->column == smallCol))) {
-                                               //mothurOut("Warning: merging cell " + toString(colCells[i]->row+1) + " " + toString(colCells[i]->column+1) + " distance " + toString(colCells[i]->dist) + " value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); mothurOutEndLine();
+                                               //m->mothurOut("Warning: merging cell " + toString(colCells[i]->row+1) + " " + toString(colCells[i]->column+1) + " distance " + toString(colCells[i]->dist) + " value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); m->mothurOutEndLine();
                                                if (cutOFF > colCells[i]->dist) {  
                                                        cutOFF = colCells[i]->dist;  
-                                                       //mothurOut("changing cutoff to " + toString(cutOFF));  mothurOutEndLine(); 
+                                                       //m->mothurOut("changing cutoff to " + toString(cutOFF));  m->mothurOutEndLine(); 
                                                }
                                        }
                                }
@@ -245,14 +246,14 @@ void Cluster::update(double& cutOFF){
                }
        }
        catch(exception& e) {
-               errorOut(e, "Cluster", "update");
+               m->errorOut(e, "Cluster", "update");
                exit(1);
        }
 }
 /***********************************************************************/
-void Cluster::setMapWanted(bool m)  {  
+void Cluster::setMapWanted(bool f)  {  
        try {
-               mapWanted = m;
+               mapWanted = f;
                
                //initialize map
                for (int i = 0; i < list->getNumBins(); i++) {
@@ -273,7 +274,7 @@ void Cluster::setMapWanted(bool m)  {
                
        }
        catch(exception& e) {
-               errorOut(e, "Cluster", "setMapWanted");
+               m->errorOut(e, "Cluster", "setMapWanted");
                exit(1);
        }
 }
@@ -295,7 +296,7 @@ try {
                
        }
        catch(exception& e) {
-               errorOut(e, "Cluster", "updateMap");
+               m->errorOut(e, "Cluster", "updateMap");
                exit(1);
        }
 }
index 6d7fc470e91eca8dae548ffb5594a4099a203f35..72d3611a093296b3dc18d9ddb7bf12d0a0a9a0e5 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "mothur.h"
 #include "sparsematrix.hpp"
+#include "mothurout.h"
 
 class RAbundVector;
 class ListVector;
@@ -46,6 +47,7 @@ protected:
        MatVec colCells;
        ull nRowCells;
        ull nColCells;
+       MothurOut* m;
 };
 
 /***********************************************************************/
index e4e2d2104e3af44829990b01cef6782147359b98..5d9c7bccfbb250267553997fa3d6b16d7aa560b7 100644 (file)
 
 //**********************************************************************************************************************
 //This function checks to make sure the cluster command has no errors and then clusters based on the method chosen.
-ClusterCommand::ClusterCommand(string option){
+ClusterCommand::ClusterCommand(string option)  {
        try{
                globaldata = GlobalData::getInstance();
+               
                abort = false;
                
                //allow user to run help
@@ -41,7 +42,7 @@ ClusterCommand::ClusterCommand(string option){
                        
                        //error checking to make sure they read a distance file
                        if ((globaldata->gSparseMatrix == NULL) || (globaldata->gListVector == NULL)) {
-                               mothurOut("Before you use the cluster command, you first need to read in a distance matrix."); mothurOutEndLine();
+                               m->mothurOut("Before you use the cluster command, you first need to read in a distance matrix."); m->mothurOutEndLine();
                                abort = true;
                        } 
                
@@ -64,7 +65,7 @@ ClusterCommand::ClusterCommand(string option){
                        if (method == "not found") { method = "furthest"; }
                        
                        if ((method == "furthest") || (method == "nearest") || (method == "average")) { }
-                       else { mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); mothurOutEndLine(); abort = true; }
+                       else { m->mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); m->mothurOutEndLine(); abort = true; }
 
                        showabund = validParameter.validFile(parameters, "showabund", false);
                        if (showabund == "not found") { showabund = "T"; }
@@ -95,11 +96,15 @@ ClusterCommand::ClusterCommand(string option){
                                openOutputFile(fileroot+ tag + ".sabund",       sabundFile);
                                openOutputFile(fileroot+ tag + ".rabund",       rabundFile);
                                openOutputFile(fileroot+ tag + ".list",         listFile);
+                               
+                               outputNames.push_back(fileroot+ tag + ".sabund");
+                               outputNames.push_back(fileroot+ tag + ".rabund");
+                               outputNames.push_back(fileroot+ tag + ".list");
                        }
                }
        }
        catch(exception& e) {
-               errorOut(e, "ClusterCommand", "ClusterCommand");
+               m->errorOut(e, "ClusterCommand", "ClusterCommand");
                exit(1);
        }
 }
@@ -108,14 +113,14 @@ ClusterCommand::ClusterCommand(string option){
 
 void ClusterCommand::help(){
        try {
-               mothurOut("The cluster command can only be executed after a successful read.dist command.\n");
-               mothurOut("The cluster command parameter options are method, cuttoff, precision, showabund and timing. No parameters are required.\n");
-               mothurOut("The cluster command should be in the following format: \n");
-               mothurOut("cluster(method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
-               mothurOut("The acceptable cluster methods are furthest, nearest and average.  If no method is provided then furthest is assumed.\n\n"); 
+               m->mothurOut("The cluster command can only be executed after a successful read.dist command.\n");
+               m->mothurOut("The cluster command parameter options are method, cuttoff, precision, showabund and timing. No parameters are required.\n");
+               m->mothurOut("The cluster command should be in the following format: \n");
+               m->mothurOut("cluster(method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
+               m->mothurOut("The acceptable cluster methods are furthest, nearest and average.  If no method is provided then furthest is assumed.\n\n");      
        }
        catch(exception& e) {
-               errorOut(e, "ClusterCommand", "help");
+               m->errorOut(e, "ClusterCommand", "help");
                exit(1);
        }
 }
@@ -150,7 +155,7 @@ int ClusterCommand::execute(){
                
                while (matrix->getSmallDist() < cutoff && matrix->getNNodes() > 0){
                        if (print_start && isTrue(timing)) {
-                               mothurOut("Clustering (" + tag + ") dist " + toString(matrix->getSmallDist()) + "/" 
+                               m->mothurOut("Clustering (" + tag + ") dist " + toString(matrix->getSmallDist()) + "/" 
                                        + toString(roundDist(matrix->getSmallDist(), precision)) 
                                        + "\t(precision: " + toString(precision) + ", Nodes: " + toString(matrix->getNNodes()) + ")");
                                cout.flush();
@@ -177,7 +182,7 @@ int ClusterCommand::execute(){
                }
 
                if (print_start && isTrue(timing)) {
-                       mothurOut("Clustering (" + tag + ") for distance " + toString(previousDist) + "/" + toString(rndPreviousDist) 
+                       m->mothurOut("Clustering (" + tag + ") for distance " + toString(previousDist) + "/" + toString(rndPreviousDist) 
                                         + "\t(precision: " + toString(precision) + ", Nodes: " + toString(matrix->getNNodes()) + ")");
                        cout.flush();
                        print_start = false;
@@ -206,17 +211,23 @@ int ClusterCommand::execute(){
                rabundFile.close();
                listFile.close();
                
-               if (saveCutoff != cutoff) { mothurOut("changed cutoff to " + toString(cutoff)); mothurOutEndLine();  }
+               if (saveCutoff != cutoff) { m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();  }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
                
                //if (isTrue(timing)) {
-                       mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster"); mothurOutEndLine();
+                       m->mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster"); m->mothurOutEndLine();
                //}
                
                
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ClusterCommand", "execute");
+               m->errorOut(e, "ClusterCommand", "execute");
                exit(1);
        }
 }
@@ -226,8 +237,8 @@ int ClusterCommand::execute(){
 void ClusterCommand::printData(string label){
        try {
                if (isTrue(timing)) {
-                       mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins()) 
-                    + "\tclusters. Updates: " + toString(loops)); mothurOutEndLine();
+                       m->mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins()) 
+                    + "\tclusters. Updates: " + toString(loops)); m->mothurOutEndLine();
                }
                print_start = true;
                loops = 0;
@@ -244,7 +255,7 @@ void ClusterCommand::printData(string label){
                oldList.print(listFile);
        }
        catch(exception& e) {
-               errorOut(e, "ClusterCommand", "printData");
+               m->errorOut(e, "ClusterCommand", "printData");
                exit(1);
        }
 
index 5c21efccb279aeeb447a00087c846859c84eae3f..5c57b69d1bd5dc0495925cb452df908ff5cb5b81 100644 (file)
@@ -29,7 +29,7 @@
 class ClusterCommand : public Command {
        
 public:
-       ClusterCommand(string); 
+       ClusterCommand(string);
        ~ClusterCommand();
        int execute();  
        void help();
@@ -56,6 +56,7 @@ private:
        unsigned long loops;
        
        void printData(string label);
+       vector<string> outputNames;
 };
 
 #endif
index 34191a07a324fb255120b02bfabba4b56c9d0c48..08426a8499bdf41c0fab815f20421d4bc070de0f 100644 (file)
@@ -52,7 +52,7 @@ void Collect::getCurve(int increment = 1){
                                delete ccd;
         }
         catch(exception& e) {
-                       errorOut(e, "Collect", "getCurve");
+                       m->errorOut(e, "Collect", "getCurve");
                        exit(1);
         }
 }
@@ -158,7 +158,7 @@ try {
 
         }
         catch(exception& e) {
-                errorOut(e, "Collect", "getSharedCurve");
+                m->errorOut(e, "Collect", "getSharedCurve");
                                exit(1);
         }
 }
index 134edf00ec71638af7e8309a1cc9dbf34469eb9d..0db15045024f2ea8c30d4c316d539f564df690cf 100644 (file)
--- a/collect.h
+++ b/collect.h
@@ -9,6 +9,7 @@
 #include "sharedordervector.h"
 #include "datavector.hpp"
 #include "globaldata.hpp"
+#include "mothurout.h"
 
 /***********************************************************************/
 
@@ -16,9 +17,9 @@ class Collect {
        
 public:
        Collect(OrderVector* order, vector<Display*> disp) :
-                                       numSeqs(order->getNumSeqs()), order(order), displays(disp), label(order->getLabel())  {};
+                                       numSeqs(order->getNumSeqs()), order(order), displays(disp), label(order->getLabel())  { m = MothurOut::getInstance(); };
        Collect(SharedOrderVector* sharedorder, vector<Display*> disp) :
-                                       numSeqs(sharedorder->getNumSeqs()), sharedorder(sharedorder), displays(disp), label(sharedorder->getLabel())  {};
+                                       numSeqs(sharedorder->getNumSeqs()), sharedorder(sharedorder), displays(disp), label(sharedorder->getLabel())  { m = MothurOut::getInstance(); }
 
        ~Collect(){             };
        void getCurve(int);
@@ -34,6 +35,7 @@ private:
        void getGroupComb();
        vector<string> groupComb;
        bool validGroup(vector<string>, string);
+       MothurOut* m;
 };
 
 
index 473d2db8b473bbef240793c419e6c8beece29ddf..d8da50e0d2f559f25657008d046e7ec6951c4552 100644 (file)
@@ -31,7 +31,7 @@
 
 
 //**********************************************************************************************************************
-CollectCommand::CollectCommand(string option){
+CollectCommand::CollectCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -61,7 +61,7 @@ CollectCommand::CollectCommand(string option){
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = "";         }
                        
                        //make sure the user has already run the read.otu command
-                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund, rabund or shared file before you can use the collect.single command."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund, rabund or shared file before you can use the collect.single command."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -98,7 +98,7 @@ CollectCommand::CollectCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "CollectCommand", "CollectCommand");
+               m->errorOut(e, "CollectCommand", "CollectCommand");
                exit(1);
        }                       
 }
@@ -106,19 +106,19 @@ CollectCommand::CollectCommand(string option){
 
 void CollectCommand::help(){
        try {
-               mothurOut("The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. \n");
-               mothurOut("The collect.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
-               mothurOut("The collect.single command parameters are label, freq, calc and abund.  No parameters are required. \n");
-               mothurOut("The collect.single command should be in the following format: \n");
-               mothurOut("collect.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
-               mothurOut("Example collect(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n");
-               mothurOut("The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson.\n");
+               m->mothurOut("The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. \n");
+               m->mothurOut("The collect.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
+               m->mothurOut("The collect.single command parameters are label, freq, calc and abund.  No parameters are required. \n");
+               m->mothurOut("The collect.single command should be in the following format: \n");
+               m->mothurOut("collect.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
+               m->mothurOut("Example collect(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n");
+               m->mothurOut("The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson.\n");
                validCalculator->printCalc("single", cout);
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "CollectCommand", "help");
+               m->errorOut(e, "CollectCommand", "help");
                exit(1);
        }
 }
@@ -134,6 +134,8 @@ int CollectCommand::execute(){
                
                if (abort == true) { return 0; }
                
+               vector<string> outputNames;
+               
                if ((globaldata->getFormat() != "sharedfile")) { inputFileNames.push_back(globaldata->inputFileName);  }
                else {  inputFileNames = parseSharedFile(globaldata->getSharedFile());  globaldata->setFormat("rabund");  }
        
@@ -144,7 +146,7 @@ int CollectCommand::execute(){
                        globaldata->inputFileName = inputFileNames[p];
                
                        if (inputFileNames.size() > 1) {
-                               mothurOutEndLine(); mothurOut("Processing group " + groups[p]); mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
                        }
                
                        validCalculator = new ValidCalculators();
@@ -153,44 +155,64 @@ int CollectCommand::execute(){
                                if (validCalculator->isValidCalculator("single", Estimators[i]) == true) { 
                                        if (Estimators[i] == "sobs") { 
                                                cDisplays.push_back(new CollectDisplay(new Sobs(), new OneColumnFile(fileNameRoot+"sobs")));
+                                               outputNames.push_back(fileNameRoot+"sobs");
                                        }else if (Estimators[i] == "chao") { 
                                                cDisplays.push_back(new CollectDisplay(new Chao1(), new ThreeColumnFile(fileNameRoot+"chao")));
+                                               outputNames.push_back(fileNameRoot+"chao");
                                        }else if (Estimators[i] == "nseqs") { 
                                                cDisplays.push_back(new CollectDisplay(new NSeqs(), new OneColumnFile(fileNameRoot+"nseqs")));
+                                               outputNames.push_back(fileNameRoot+"nseqs");
                                        }else if (Estimators[i] == "coverage") { 
                                                cDisplays.push_back(new CollectDisplay(new Coverage(), new OneColumnFile(fileNameRoot+"coverage")));
+                                               outputNames.push_back(fileNameRoot+"coverage");
                                        }else if (Estimators[i] == "ace") { 
                                                cDisplays.push_back(new CollectDisplay(new Ace(abund), new ThreeColumnFile(fileNameRoot+"ace")));
+                                               outputNames.push_back(fileNameRoot+"ace");
                                        }else if (Estimators[i] == "jack") { 
                                                cDisplays.push_back(new CollectDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"jack")));
+                                               outputNames.push_back(fileNameRoot+"jack");
                                        }else if (Estimators[i] == "shannon") { 
                                                cDisplays.push_back(new CollectDisplay(new Shannon(), new ThreeColumnFile(fileNameRoot+"shannon")));
+                                               outputNames.push_back(fileNameRoot+"shannon");
                                        }else if (Estimators[i] == "npshannon") { 
                                                cDisplays.push_back(new CollectDisplay(new NPShannon(), new OneColumnFile(fileNameRoot+"np_shannon")));
+                                               outputNames.push_back(fileNameRoot+"np_shannon");
                                        }else if (Estimators[i] == "simpson") { 
                                                cDisplays.push_back(new CollectDisplay(new Simpson(), new ThreeColumnFile(fileNameRoot+"simpson")));
+                                               outputNames.push_back(fileNameRoot+"simpson");
                                        }else if (Estimators[i] == "bootstrap") { 
                                                cDisplays.push_back(new CollectDisplay(new Bootstrap(), new OneColumnFile(fileNameRoot+"bootstrap")));
+                                               outputNames.push_back(fileNameRoot+"bootstrap");
                                        }else if (Estimators[i] == "geometric") { 
                                                cDisplays.push_back(new CollectDisplay(new Geom(), new OneColumnFile(fileNameRoot+"geometric")));
+                                               outputNames.push_back(fileNameRoot+"geometric");
                                        }else if (Estimators[i] == "qstat") { 
                                                cDisplays.push_back(new CollectDisplay(new QStat(), new OneColumnFile(fileNameRoot+"qstat")));
+                                               outputNames.push_back(fileNameRoot+"qstat");
                                        }else if (Estimators[i] == "logseries") { 
                                                cDisplays.push_back(new CollectDisplay(new LogSD(), new OneColumnFile(fileNameRoot+"logseries")));
+                                               outputNames.push_back(fileNameRoot+"logseries");
                                        }else if (Estimators[i] == "bergerparker") { 
                                                cDisplays.push_back(new CollectDisplay(new BergerParker(), new OneColumnFile(fileNameRoot+"bergerparker")));
+                                               outputNames.push_back(fileNameRoot+"bergerparker");
                                        }else if (Estimators[i] == "bstick") { 
                                                cDisplays.push_back(new CollectDisplay(new BStick(), new ThreeColumnFile(fileNameRoot+"bstick")));
+                                               outputNames.push_back(fileNameRoot+"bstick");
                                        }else if (Estimators[i] == "goodscoverage") { 
                                                cDisplays.push_back(new CollectDisplay(new GoodsCoverage(), new OneColumnFile(fileNameRoot+"goodscoverage")));
+                                               outputNames.push_back(fileNameRoot+"goodscoverage");
                                        }else if (Estimators[i] == "efron") {
                                                cDisplays.push_back(new CollectDisplay(new Efron(size), new OneColumnFile(fileNameRoot+"efron")));
+                                               outputNames.push_back(fileNameRoot+"efron");
                                        }else if (Estimators[i] == "boneh") {
                                                cDisplays.push_back(new CollectDisplay(new Boneh(size), new OneColumnFile(fileNameRoot+"boneh")));
+                                               outputNames.push_back(fileNameRoot+"boneh");
                                        }else if (Estimators[i] == "solow") {
                                                cDisplays.push_back(new CollectDisplay(new Solow(size), new OneColumnFile(fileNameRoot+"solow")));
+                                               outputNames.push_back(fileNameRoot+"solow");
                                        }else if (Estimators[i] == "shen") {
                                                cDisplays.push_back(new CollectDisplay(new Shen(size, abund), new OneColumnFile(fileNameRoot+"shen")));
+                                               outputNames.push_back(fileNameRoot+"shen");
                                        }
                                }
                        }
@@ -217,7 +239,7 @@ int CollectCommand::execute(){
                                        cCurve->getCurve(freq);
                                        delete cCurve;
                                        
-                                       mothurOut(order->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(order->getLabel());
                                        userLabels.erase(order->getLabel());
                                        
@@ -234,7 +256,7 @@ int CollectCommand::execute(){
                                        cCurve->getCurve(freq);
                                        delete cCurve;
                                        
-                                       mothurOut(order->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(order->getLabel());
                                        userLabels.erase(order->getLabel());
                                        
@@ -252,12 +274,12 @@ int CollectCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                        
@@ -266,7 +288,7 @@ int CollectCommand::execute(){
                                if (order != NULL) {    delete order;   }
                                order = (input->getOrderVector(lastLabel));
                                
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                
                                cCurve = new Collect(order, cDisplays);
                                cCurve->getCurve(freq);
@@ -282,12 +304,16 @@ int CollectCommand::execute(){
                        delete validCalculator;
                }
                
-               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
                
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "CollectCommand", "execute");
+               m->errorOut(e, "CollectCommand", "execute");
                exit(1);
        }
 }
@@ -347,7 +373,7 @@ vector<string> CollectCommand::parseSharedFile(string filename) {
                return filenames;
        }
        catch(exception& e) {
-               errorOut(e, "CollectCommand", "parseSharedFile");
+               m->errorOut(e, "CollectCommand", "parseSharedFile");
                exit(1);
        }
 }
index 2f12282d7c4ca3379e9fe9b9848acd6ed5bd2df6..0c937f62c83a5a1b1cac914c1a2e01b356dddc03 100644 (file)
@@ -36,7 +36,7 @@
 
 //**********************************************************************************************************************
 
-CollectSharedCommand::CollectSharedCommand(string option){
+CollectSharedCommand::CollectSharedCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -69,8 +69,8 @@ CollectSharedCommand::CollectSharedCommand(string option){
                                                
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
-                               if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
-                               else if (globaldata->getGroupFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
+                               if (globaldata->getListFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); m->mothurOutEndLine(); abort = true; }
+                               else if (globaldata->getGroupFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); m->mothurOutEndLine(); abort = true; }
                        }
 
                        
@@ -124,46 +124,67 @@ CollectSharedCommand::CollectSharedCommand(string option){
                                        if (validCalculator->isValidCalculator("shared", Estimators[i]) == true) { 
                                                if (Estimators[i] == "sharedchao") { 
                                                        cDisplays.push_back(new CollectDisplay(new SharedChao1(), new SharedOneColumnFile(fileNameRoot+"shared.chao")));
+                                                       outputNames.push_back(fileNameRoot+"shared.chao");
                                                }else if (Estimators[i] == "sharedsobs") { 
                                                        cDisplays.push_back(new CollectDisplay(new SharedSobsCS(), new SharedOneColumnFile(fileNameRoot+"shared.sobs")));
+                                                       outputNames.push_back(fileNameRoot+"shared.sobs");
                                                }else if (Estimators[i] == "sharedace") { 
                                                        cDisplays.push_back(new CollectDisplay(new SharedAce(), new SharedOneColumnFile(fileNameRoot+"shared.ace")));
+                                                       outputNames.push_back(fileNameRoot+"shared.ace");
                                                }else if (Estimators[i] == "jabund") {  
                                                        cDisplays.push_back(new CollectDisplay(new JAbund(), new SharedOneColumnFile(fileNameRoot+"jabund")));
+                                                       outputNames.push_back(fileNameRoot+"jabund");
                                                }else if (Estimators[i] == "sorabund") { 
                                                        cDisplays.push_back(new CollectDisplay(new SorAbund(), new SharedOneColumnFile(fileNameRoot+"sorabund")));
+                                                       outputNames.push_back(fileNameRoot+"sorabund");
                                                }else if (Estimators[i] == "jclass") { 
                                                        cDisplays.push_back(new CollectDisplay(new Jclass(), new SharedOneColumnFile(fileNameRoot+"jclass")));
+                                                       outputNames.push_back(fileNameRoot+"jclass");
                                                }else if (Estimators[i] == "sorclass") { 
                                                        cDisplays.push_back(new CollectDisplay(new SorClass(), new SharedOneColumnFile(fileNameRoot+"sorclass")));
+                                                       outputNames.push_back(fileNameRoot+"sorclass");
                                                }else if (Estimators[i] == "jest") { 
                                                        cDisplays.push_back(new CollectDisplay(new Jest(), new SharedOneColumnFile(fileNameRoot+"jest")));
+                                                       outputNames.push_back(fileNameRoot+"jest");
                                                }else if (Estimators[i] == "sorest") { 
                                                        cDisplays.push_back(new CollectDisplay(new SorEst(), new SharedOneColumnFile(fileNameRoot+"sorest")));
+                                                       outputNames.push_back(fileNameRoot+"sorest");
                                                }else if (Estimators[i] == "thetayc") { 
                                                        cDisplays.push_back(new CollectDisplay(new ThetaYC(), new SharedOneColumnFile(fileNameRoot+"thetayc")));
+                                                       outputNames.push_back(fileNameRoot+"thetayc");
                                                }else if (Estimators[i] == "thetan") { 
                                                        cDisplays.push_back(new CollectDisplay(new ThetaN(), new SharedOneColumnFile(fileNameRoot+"thetan")));
+                                                       outputNames.push_back(fileNameRoot+"thetan");
                                                }else if (Estimators[i] == "kstest") { 
                                                        cDisplays.push_back(new CollectDisplay(new KSTest(), new SharedOneColumnFile(fileNameRoot+"kstest")));
+                                                       outputNames.push_back(fileNameRoot+"kstest");
                                                }else if (Estimators[i] == "whittaker") { 
                                                        cDisplays.push_back(new CollectDisplay(new Whittaker(), new SharedOneColumnFile(fileNameRoot+"whittaker")));
+                                                       outputNames.push_back(fileNameRoot+"whittaker");
                                                }else if (Estimators[i] == "sharednseqs") { 
                                                        cDisplays.push_back(new CollectDisplay(new SharedNSeqs(), new SharedOneColumnFile(fileNameRoot+"shared.nseqs")));
+                                                       outputNames.push_back(fileNameRoot+"shared.nseqs");
                                                }else if (Estimators[i] == "ochiai") { 
                                                        cDisplays.push_back(new CollectDisplay(new Ochiai(), new SharedOneColumnFile(fileNameRoot+"ochiai")));
+                                                       outputNames.push_back(fileNameRoot+"ochiai");
                                                }else if (Estimators[i] == "anderberg") { 
                                                        cDisplays.push_back(new CollectDisplay(new Anderberg(), new SharedOneColumnFile(fileNameRoot+"anderberg")));
+                                                       outputNames.push_back(fileNameRoot+"anderberg");
                                                }else if (Estimators[i] == "skulczynski") { 
                                                        cDisplays.push_back(new CollectDisplay(new Kulczynski(), new SharedOneColumnFile(fileNameRoot+"kulczynski")));
+                                                       outputNames.push_back(fileNameRoot+"kulczynski");
                                                }else if (Estimators[i] == "kulczynskicody") { 
                                                        cDisplays.push_back(new CollectDisplay(new KulczynskiCody(), new SharedOneColumnFile(fileNameRoot+"kulczynskicody")));
+                                                       outputNames.push_back(fileNameRoot+"kulczynskicody");
                                                }else if (Estimators[i] == "lennon") { 
                                                        cDisplays.push_back(new CollectDisplay(new Lennon(), new SharedOneColumnFile(fileNameRoot+"lennon")));
+                                                       outputNames.push_back(fileNameRoot+"lennon");
                                                }else if (Estimators[i] == "morisitahorn") { 
                                                        cDisplays.push_back(new CollectDisplay(new MorHorn(), new SharedOneColumnFile(fileNameRoot+"morisitahorn")));
+                                                       outputNames.push_back(fileNameRoot+"morisitahorn");
                                                }else if (Estimators[i] == "braycurtis") { 
                                                        cDisplays.push_back(new CollectDisplay(new BrayCurtis(), new SharedOneColumnFile(fileNameRoot+"braycurtis")));
+                                                       outputNames.push_back(fileNameRoot+"braycurtis");
                                                }
                                        }
                                }       
@@ -172,7 +193,7 @@ CollectSharedCommand::CollectSharedCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "CollectSharedCommand", "CollectSharedCommand");
+               m->errorOut(e, "CollectSharedCommand", "CollectSharedCommand");
                exit(1);
        }
 }
@@ -180,23 +201,23 @@ CollectSharedCommand::CollectSharedCommand(string option){
 
 void CollectSharedCommand::help(){
        try {
-               mothurOut("The collect.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The collect.shared command parameters are label, freq, calc and groups.  No parameters are required \n");
-               mothurOut("The collect.shared command should be in the following format: \n");
-               mothurOut("collect.shared(label=yourLabel, freq=yourFreq, calc=yourEstimators, groups=yourGroups).\n");
-               mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
-               mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n");
-               mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The collect.shared command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The collect.shared command parameters are label, freq, calc and groups.  No parameters are required \n");
+               m->mothurOut("The collect.shared command should be in the following format: \n");
+               m->mothurOut("collect.shared(label=yourLabel, freq=yourFreq, calc=yourEstimators, groups=yourGroups).\n");
+               m->mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
+               m->mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
                validCalculator->printCalc("shared", cout);
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
-               mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
+               m->mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
                
        }
        catch(exception& e) {
-               errorOut(e, "CollectSharedCommand", "help");
+               m->errorOut(e, "CollectSharedCommand", "help");
                exit(1);
        }
 }
@@ -248,7 +269,7 @@ int CollectSharedCommand::execute(){
                                cCurve->getSharedCurve(freq);
                                delete cCurve;
                        
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
                        }
@@ -265,7 +286,7 @@ int CollectSharedCommand::execute(){
                                cCurve->getSharedCurve(freq);
                                delete cCurve;
                        
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
                                
@@ -285,12 +306,12 @@ int CollectSharedCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -303,7 +324,7 @@ int CollectSharedCommand::execute(){
                        cCurve->getSharedCurve(freq);
                        delete cCurve;
                        
-                       mothurOut(order->getLabel()); mothurOutEndLine();
+                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                        delete order;
                }
                
@@ -312,10 +333,16 @@ int CollectSharedCommand::execute(){
                //reset groups parameter
                globaldata->Groups.clear(); 
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "CollectSharedCommand", "execute");
+               m->errorOut(e, "CollectSharedCommand", "execute");
                exit(1);
        }
 }
index 10efcc80077c193694ee7297e40027a35f8bb10a..da43adc791ec9809d6ffe1031a9d65e6d77d8db6 100644 (file)
@@ -48,7 +48,7 @@ private:
        bool abort, allLines, all;
        set<string> labels; //holds labels to be used
        string label, calc, groups, outputDir;
-       vector<string>  Estimators, Groups;
+       vector<string>  Estimators, Groups, outputNames;
 
 
 };
index 1dd5e871aaa66362e02e997c9ff26b427ed9178a..b6bf5cd397644ad215a8a88f269f461d04add112 100644 (file)
 #include "mothur.h"
 #include "optionparser.h"
 #include "validparameter.h"
+#include "mothurout.h"
 
 class Command {
        
        public:
+               Command() {  m = MothurOut::getInstance();  }
                virtual int execute() = 0;
                virtual void help() = 0;
                virtual ~Command() { }
+       protected:
+               MothurOut* m;
 };
 
 #endif
index baef2164942f5e637f43d8b3b6431091ef13ca63..dd97b2f0d801dc64f4a9f110957c093dab136b04 100644 (file)
@@ -80,6 +80,8 @@ CommandFactory* CommandFactory::getInstance() {
 /***********************************************************/
 CommandFactory::CommandFactory(){
        string s = "";
+       m = MothurOut::getInstance();
+       
        command = new NoCommand(s);
        
        outputDir = ""; inputDir = "";
@@ -169,67 +171,67 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                        else { optionString += "inputdir=" + inputDir; }
                }
                
-               if(commandName == "read.dist")                                  {       command = new ReadDistCommand(optionString);                    }
-               else if(commandName == "read.otu")                              {       command = new ReadOtuCommand(optionString);                             }
-               else if(commandName == "read.tree")                             {       command = new ReadTreeCommand(optionString);                    }
-               else if(commandName == "cluster")                               {       command = new ClusterCommand(optionString);                             }
-               else if(commandName == "unique.seqs")                   {       command = new DeconvoluteCommand(optionString);                 }
-               else if(commandName == "parsimony")                             {       command = new ParsimonyCommand(optionString);                   }
-               else if(commandName == "help")                                  {       command = new HelpCommand(optionString);                                }
-               else if(commandName == "quit")                                  {       command = new QuitCommand(optionString);                                }
-               else if(commandName == "collect.single")                {       command = new CollectCommand(optionString);                             }
-               else if(commandName == "collect.shared")                {       command = new CollectSharedCommand(optionString);               }
-               else if(commandName == "rarefaction.single")    {       command = new RareFactCommand(optionString);                    }
-               else if(commandName == "rarefaction.shared")    {       command = new RareFactSharedCommand(optionString);              }
-               else if(commandName == "summary.single")                {       command = new SummaryCommand(optionString);                             }
-               else if(commandName == "summary.shared")                {       command = new SummarySharedCommand(optionString);               }
-               else if(commandName == "unifrac.weighted")              {       command = new UnifracWeightedCommand(optionString);             }
-               else if(commandName == "unifrac.unweighted")    {       command = new UnifracUnweightedCommand(optionString);   }
-               else if(commandName == "get.group")             {   command = new GetgroupCommand(optionString);                        }
-               else if(commandName == "get.label")             {   command = new GetlabelCommand(optionString);                        }
-               else if(commandName == "get.sabund")            {   command = new GetSAbundCommand(optionString);                       }
-               else if(commandName == "get.rabund")            {   command = new GetRAbundCommand(optionString);                       }
-               else if(commandName == "libshuff")              {   command = new LibShuffCommand(optionString);                        }
-               else if(commandName == "heatmap.bin")                   {   command = new HeatMapCommand(optionString);                         }
-               else if(commandName == "heatmap.sim")                   {   command = new HeatMapSimCommand(optionString);                      }
-               else if(commandName == "filter.seqs")                   {   command = new FilterSeqsCommand(optionString);                      }
-               else if(commandName == "venn")                                  {   command = new VennCommand(optionString);                            }
-               else if(commandName == "bin.seqs")                              {   command = new BinSeqCommand(optionString);                          }
-               else if(commandName == "get.oturep")                    {   command = new GetOTURepCommand(optionString);                       }
-               else if(commandName == "tree.shared")                   {   command = new TreeGroupCommand(optionString);                       }
-               else if(commandName == "dist.shared")                   {   command = new MatrixOutputCommand(optionString);            }
-               else if(commandName == "bootstrap.shared")              {   command = new BootSharedCommand(optionString);                      }
-               //else if(commandName == "consensus")                   {   command = new ConcensusCommand(optionString);                       }
-               else if(commandName == "dist.seqs")                             {   command = new DistanceCommand(optionString);                        }
-               else if(commandName == "align.seqs")                    {   command = new AlignCommand(optionString);                           }
-               else if(commandName == "summary.seqs")                  {       command = new SeqSummaryCommand(optionString);                  }
-               else if(commandName == "screen.seqs")                   {       command = new ScreenSeqsCommand(optionString);                  }
-               else if(commandName == "reverse.seqs")                  {       command = new ReverseSeqsCommand(optionString);                 }
-               else if(commandName == "trim.seqs")                             {       command = new TrimSeqsCommand(optionString);                    }
-               else if(commandName == "chimera.seqs")                  {       command = new ChimeraSeqsCommand(optionString);                 }
-               else if(commandName == "list.seqs")                             {       command = new ListSeqsCommand(optionString);                    }
-               else if(commandName == "get.seqs")                              {       command = new GetSeqsCommand(optionString);                             }
-               else if(commandName == "remove.seqs")                   {       command = new RemoveSeqsCommand(optionString);                  }
-               else if(commandName == "merge.files")                   {       command = new MergeFileCommand(optionString);                   }
-               else if(commandName == "system")                                {       command = new SystemCommand(optionString);                              }
-               else if(commandName == "align.check")                   {       command = new AlignCheckCommand(optionString);                  }
-               else if(commandName == "get.sharedseqs")                {       command = new GetSharedOTUCommand(optionString);                }
-               else if(commandName == "get.otulist")                   {       command = new GetListCountCommand(optionString);                }
-               else if(commandName == "hcluster")                              {       command = new HClusterCommand(optionString);                    }
-               else if(commandName == "classify.seqs")                 {       command = new ClassifySeqsCommand(optionString);                }
-               else if(commandName == "phylotype")                             {       command = new PhylotypeCommand(optionString);                   }
-               else if(commandName == "mgcluster")                             {       command = new MGClusterCommand(optionString);                   }
-               else if(commandName == "pre.cluster")                   {       command = new PreClusterCommand(optionString);                  }
-               else if(commandName == "pcoa")                                  {       command = new PCACommand(optionString);                                 }
-               else if(commandName == "otu.hierarchy")                 {       command = new OtuHierarchyCommand(optionString);                }
-               else if(commandName == "set.dir")                               {       command = new SetDirectoryCommand(optionString);                }
-               else if(commandName == "parse.list")                    {       command = new ParseListCommand(optionString);                   }
-               else                                                                                    {       command = new NoCommand(optionString);                                  }
+               if(commandName == "read.dist")                                  {       command = new ReadDistCommand(optionString);                            }
+               else if(commandName == "read.otu")                              {       command = new ReadOtuCommand(optionString);                                     }
+               else if(commandName == "read.tree")                             {       command = new ReadTreeCommand(optionString);                            }
+               else if(commandName == "cluster")                               {       command = new ClusterCommand(optionString);                                     }
+               else if(commandName == "unique.seqs")                   {       command = new DeconvoluteCommand(optionString);                         }
+               else if(commandName == "parsimony")                             {       command = new ParsimonyCommand(optionString);                           }
+               else if(commandName == "help")                                  {       command = new HelpCommand(optionString);                                        }
+               else if(commandName == "quit")                                  {       command = new QuitCommand(optionString);                                        }
+               else if(commandName == "collect.single")                {       command = new CollectCommand(optionString);                                     }
+               else if(commandName == "collect.shared")                {       command = new CollectSharedCommand(optionString);                       }
+               else if(commandName == "rarefaction.single")    {       command = new RareFactCommand(optionString);                            }
+               else if(commandName == "rarefaction.shared")    {       command = new RareFactSharedCommand(optionString);                      }
+               else if(commandName == "summary.single")                {       command = new SummaryCommand(optionString);                                     }
+               else if(commandName == "summary.shared")                {       command = new SummarySharedCommand(optionString);                       }
+               else if(commandName == "unifrac.weighted")              {       command = new UnifracWeightedCommand(optionString);                     }
+               else if(commandName == "unifrac.unweighted")    {       command = new UnifracUnweightedCommand(optionString);           }
+               else if(commandName == "get.group")             {   command = new GetgroupCommand(optionString);                                }
+               else if(commandName == "get.label")             {   command = new GetlabelCommand(optionString);                                }
+               else if(commandName == "get.sabund")            {   command = new GetSAbundCommand(optionString);                               }
+               else if(commandName == "get.rabund")            {   command = new GetRAbundCommand(optionString);                               }
+               else if(commandName == "libshuff")              {   command = new LibShuffCommand(optionString);                                }
+               else if(commandName == "heatmap.bin")                   {   command = new HeatMapCommand(optionString);                                 }
+               else if(commandName == "heatmap.sim")                   {   command = new HeatMapSimCommand(optionString);                              }
+               else if(commandName == "filter.seqs")                   {   command = new FilterSeqsCommand(optionString);                              }
+               else if(commandName == "venn")                                  {   command = new VennCommand(optionString);                                    }
+               else if(commandName == "bin.seqs")                              {   command = new BinSeqCommand(optionString);                                  }
+               else if(commandName == "get.oturep")                    {   command = new GetOTURepCommand(optionString);                               }
+               else if(commandName == "tree.shared")                   {   command = new TreeGroupCommand(optionString);                               }
+               else if(commandName == "dist.shared")                   {   command = new MatrixOutputCommand(optionString);                    }
+               else if(commandName == "bootstrap.shared")              {   command = new BootSharedCommand(optionString);                              }
+               //else if(commandName == "consensus")                   {   command = new ConcensusCommand(optionString);                               }
+               else if(commandName == "dist.seqs")                             {   command = new DistanceCommand(optionString);                                }
+               else if(commandName == "align.seqs")                    {   command = new AlignCommand(optionString);                                   }
+               else if(commandName == "summary.seqs")                  {       command = new SeqSummaryCommand(optionString);                          }
+               else if(commandName == "screen.seqs")                   {       command = new ScreenSeqsCommand(optionString);                          }
+               else if(commandName == "reverse.seqs")                  {       command = new ReverseSeqsCommand(optionString);                         }
+               else if(commandName == "trim.seqs")                             {       command = new TrimSeqsCommand(optionString);                            }
+               else if(commandName == "chimera.seqs")                  {       command = new ChimeraSeqsCommand(optionString);                         }
+               else if(commandName == "list.seqs")                             {       command = new ListSeqsCommand(optionString);                            }
+               else if(commandName == "get.seqs")                              {       command = new GetSeqsCommand(optionString);                                     }
+               else if(commandName == "remove.seqs")                   {       command = new RemoveSeqsCommand(optionString);                          }
+               else if(commandName == "merge.files")                   {       command = new MergeFileCommand(optionString);                           }
+               else if(commandName == "system")                                {       command = new SystemCommand(optionString);                                      }
+               else if(commandName == "align.check")                   {       command = new AlignCheckCommand(optionString);                          }
+               else if(commandName == "get.sharedseqs")                {       command = new GetSharedOTUCommand(optionString);                        }
+               else if(commandName == "get.otulist")                   {       command = new GetListCountCommand(optionString);                        }
+               else if(commandName == "hcluster")                              {       command = new HClusterCommand(optionString);                            }
+               else if(commandName == "classify.seqs")                 {       command = new ClassifySeqsCommand(optionString);                        }
+               else if(commandName == "phylotype")                             {       command = new PhylotypeCommand(optionString);                           }
+               else if(commandName == "mgcluster")                             {       command = new MGClusterCommand(optionString);                           }
+               else if(commandName == "pre.cluster")                   {       command = new PreClusterCommand(optionString);                          }
+               else if(commandName == "pcoa")                                  {       command = new PCACommand(optionString);                                         }
+               else if(commandName == "otu.hierarchy")                 {       command = new OtuHierarchyCommand(optionString);                        }
+               else if(commandName == "set.dir")                               {       command = new SetDirectoryCommand(optionString);                        }
+               else if(commandName == "parse.list")                    {       command = new ParseListCommand(optionString);                           }
+               else                                                                                    {       command = new NoCommand(optionString);                                          }
 
                return command;
        }
        catch(exception& e) {
-               errorOut(e, "CommandFactory", "getCommand");
+               m->errorOut(e, "CommandFactory", "getCommand");
                exit(1);
        }
 }
@@ -245,7 +247,7 @@ Command* CommandFactory::getCommand(){
                return command;
        }
        catch(exception& e) {
-               errorOut(e, "CommandFactory", "getCommand");
+               m->errorOut(e, "CommandFactory", "getCommand");
                exit(1);
        }
 }
@@ -257,17 +259,17 @@ bool CommandFactory::isValidCommand(string command) {
                if ((commands.find(command)) != (commands.end())) {
                        return true;
                }else{
-                       mothurOut(command + " is not a valid command in Mothur.  Valid commands are ");
+                       m->mothurOut(command + " is not a valid command in Mothur.  Valid commands are ");
                        for (it = commands.begin(); it != commands.end(); it++) {
-                               mothurOut(it->first + ", ");
+                               m->mothurOut(it->first + ", ");
                        }
-                       mothurOutEndLine();
+                       m->mothurOutEndLine();
                        return false;
                }
                
        }
        catch(exception& e) {
-               errorOut(e, "CommandFactory", "isValidCommand");
+               m->errorOut(e, "CommandFactory", "isValidCommand");
                exit(1);
        }
 }
@@ -282,7 +284,7 @@ void CommandFactory::printCommands(ostream& out) {
                out << endl;
        }
        catch(exception& e) {
-               errorOut(e, "CommandFactory", "printCommands");
+               m->errorOut(e, "CommandFactory", "printCommands");
                exit(1);
        }
 }
index d84be62a074dde5dc29b8006a636bd7b67b9607d..e1f62da1444022618454df7078180ed488edf325 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h";
 
 class Command;
 
@@ -27,6 +28,7 @@ public:
 
 private:
        Command* command;
+       MothurOut* m;
        map<string, string> commands;
        map<string, string>::iterator it;
        string outputDir, inputDir;
index f013a25361366bfecbecdccf0dd1d00c7805d16e..df216da738e7ba6dd92ec0817c6353b0b1723870 100644 (file)
@@ -16,6 +16,8 @@
 //This Function parses through the command line and pulls out the command then sends the options to  the parseGlobalData
 CommandOptionParser::CommandOptionParser(string input){
        try {
+               m = MothurOut::getInstance();
+               
                int openParen = input.find_first_of('(');
                int closeParen = input.find_last_of(')');
                optionString = "";
@@ -25,14 +27,14 @@ CommandOptionParser::CommandOptionParser(string input){
                        commandString = input.substr(0, openParen);   //commandString contains everything before "("
                        optionString = input.substr((openParen+1), (closeParen-openParen-1)); //optionString contains everything between "(" and ")".
                }
-               else if (openParen == -1) { mothurOut("You are missing ("); mothurOutEndLine(); }
-               else if (closeParen == -1) { mothurOut("You are missing )"); mothurOutEndLine(); }
+               else if (openParen == -1) { m->mothurOut("You are missing ("); m->mothurOutEndLine(); }
+               else if (closeParen == -1) { m->mothurOut("You are missing )"); m->mothurOutEndLine(); }
                                        
                //GlobalData* globaldata = GlobalData::getInstance();
                //globaldata->parseGlobalData(commandString, optionString);                     //parser to separate and check options
        }
        catch(exception& e) {
-               errorOut(e, "CommandOptionParser", "CommandOptionParser");
+               m->errorOut(e, "CommandOptionParser", "CommandOptionParser");
                exit(1);
        }
 }
index 44df8f7619a0e8cb4ab39717934c04524337c346..0c3a6f378b02a1b86c5f4cad5a52302c239b7877 100644 (file)
@@ -2,6 +2,7 @@
 #define COMMANDOPTIONPARSER_HPP
 
 #include "mothur.h"
+#include "mothurout.h"
 
 //**********************************************************************************************************************
 
@@ -13,6 +14,7 @@ public:
        
 private:
        string commandString, optionString;
+       MothurOut* m;
 };
 
 //**********************************************************************************************************************
index df6371ac8c988ce08b4ff670d0c4da86f6dff85f..86e90547f494ef0883705f640521cb82cf6dbb8f 100644 (file)
@@ -26,7 +26,7 @@ bool CompleteLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
                return(changed);
        }
        catch(exception& e) {
-               errorOut(e, "CompleteLinkage", "updateDistance");
+               m->errorOut(e, "CompleteLinkage", "updateDistance");
                exit(1);
        }
 }
index 8c34068bba76f4347d8783b35c74af69979921ea..dc278017c906dcfeb9f7967bc99f767df7007011 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-ConcensusCommand::ConcensusCommand(string fileroot){
+ConcensusCommand::ConcensusCommand(string fileroot)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -22,7 +22,7 @@ ConcensusCommand::ConcensusCommand(string fileroot){
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "ConcensusCommand");
+               m->errorOut(e, "ConcensusCommand", "ConcensusCommand");
                exit(1);
        }
 }
@@ -31,17 +31,17 @@ ConcensusCommand::ConcensusCommand(string fileroot){
 
 void ConcensusCommand::help(){
        try {
-               mothurOut("The consensus command can only be executed after a successful read.tree command.\n");
-               mothurOut("The consensus command has no parameters.\n");
-               mothurOut("The consensus command should be in the following format: consensus().\n");
-               mothurOut("The consensus command output two files: .consensus.tre and .consensuspairs.\n");
-               mothurOut("The .consensus.tre file contains the consensus tree of the trees in your input file.\n");
-               mothurOut("The branch lengths are the percentage of trees in your input file that had the given pair.\n");
-               mothurOut("The .consensuspairs file contains a list of the internal nodes in your tree.  For each node, the pair that was used in the consensus tree \n");
-               mothurOut("is reported with its percentage, as well as the other pairs that were seen for that node but not used and their percentages.\n\n");          
+               m->mothurOut("The consensus command can only be executed after a successful read.tree command.\n");
+               m->mothurOut("The consensus command has no parameters.\n");
+               m->mothurOut("The consensus command should be in the following format: consensus().\n");
+               m->mothurOut("The consensus command output two files: .consensus.tre and .consensuspairs.\n");
+               m->mothurOut("The .consensus.tre file contains the consensus tree of the trees in your input file.\n");
+               m->mothurOut("The branch lengths are the percentage of trees in your input file that had the given pair.\n");
+               m->mothurOut("The .consensuspairs file contains a list of the internal nodes in your tree.  For each node, the pair that was used in the consensus tree \n");
+               m->mothurOut("is reported with its percentage, as well as the other pairs that were seen for that node but not used and their percentages.\n\n");               
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "help");
+               m->errorOut(e, "ConcensusCommand", "help");
                exit(1);
        }
 }
@@ -148,7 +148,7 @@ int ConcensusCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "execute");
+               m->errorOut(e, "ConcensusCommand", "execute");
                exit(1);
        }
 }
@@ -180,7 +180,7 @@ int ConcensusCommand::buildConcensusTree(vector<string> nodeSet) {
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "buildConcensusTree");
+               m->errorOut(e, "ConcensusCommand", "buildConcensusTree");
                exit(1);
        }
 }
@@ -251,7 +251,7 @@ void ConcensusCommand::getSets() {
                
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "getSets");
+               m->errorOut(e, "ConcensusCommand", "getSets");
                exit(1);
        }
 }
@@ -268,7 +268,7 @@ vector<string> ConcensusCommand::getSmallest(map< vector<string>, int> nodes) {
                return smallest;
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "getSmallest");
+               m->errorOut(e, "ConcensusCommand", "getSmallest");
                exit(1);
        }
 }
@@ -306,7 +306,7 @@ vector<string> ConcensusCommand::getNextAvailableSet(vector<string> bigset, vect
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "getNextAvailableSet");
+               m->errorOut(e, "ConcensusCommand", "getNextAvailableSet");
                exit(1);
        }
 }
@@ -373,7 +373,7 @@ int ConcensusCommand::getSubgroupRating(vector<string> group) {
                return rate;
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "getSubgroupRating");
+               m->errorOut(e, "ConcensusCommand", "getSubgroupRating");
                exit(1);
        }
 }
@@ -397,7 +397,7 @@ vector<string> ConcensusCommand::getRestSet(vector<string> bigset, vector<string
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "getRestSet");
+               m->errorOut(e, "ConcensusCommand", "getRestSet");
                exit(1);
        }
 }
@@ -424,7 +424,7 @@ bool ConcensusCommand::isSubset(vector<string> bigset, vector<string> subset) {
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "isSubset");
+               m->errorOut(e, "ConcensusCommand", "isSubset");
                exit(1);
        }
 }
@@ -442,7 +442,7 @@ int ConcensusCommand::findSpot(string node) {
        
        }
        catch(exception& e) {
-               errorOut(e, "ConcensusCommand", "findSpot");
+               m->errorOut(e, "ConcensusCommand", "findSpot");
                exit(1);
        }
 }
index 16d2644242c5b360bd3fbc1e9a0719311f99f6fd..aebe66f1e0814f7a41fb9694403f87919fbcc660 100644 (file)
@@ -20,7 +20,7 @@ EstOutput Coverage::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Coverage", "getValues");
+               m->errorOut(e, "Coverage", "getValues");
                exit(1);
        }
 }
index 5f82bc194a7f6d174ca0a670a0b802b1b18cb715..f587f42f4440261934277d2adab1e8fe006f97ee 100644 (file)
@@ -16,6 +16,7 @@
 Database::Database(){          
        longest = 0;
        numSeqs = 0;
+       m = MothurOut::getInstance();
 }
 /**************************************************************************************************/
 
index 7fd29b3ae4d09ede0d5227f639e1ea6308f778a0..994c84505f4594a4794e0279343fd82f1214b983 100644 (file)
@@ -58,6 +58,7 @@ public:
 
        
 protected:
+       MothurOut* m;
        int numSeqs, longest;
        float searchScore;
        vector<int> results;
index b3c7c90d018ee960e02b281b4f72b1e39601d51b..0b09e0dc4c914f7a5d26461c092ab3cb250bc071 100644 (file)
@@ -3,6 +3,7 @@
 
 
 #include "mothur.h"
+#include "mothurout.h"
 
 /* This class is parent to listvector, ordervector, rabundvector, sabundvector, sharedordervector, sharedrabundvector, sharedsabundvector. 
        The child classes all contain OTU information in different forms. */
@@ -19,7 +20,7 @@ class SharedRAbundVector;
 class DataVector {
        
 public:
-       DataVector(){};// : maxRank(0), numBins(0), numSeqs(0){};
+       DataVector(){ m = MothurOut::getInstance(); }// : maxRank(0), numBins(0), numSeqs(0){};
        DataVector(string l) : label(l) {};
        DataVector(const DataVector& dv) : label(dv.label){};//, maxRank(dv.maxRank), numBins(dv.numBins), numSeqs(dv.numSeqs) {};
        DataVector(ifstream&);
@@ -42,6 +43,7 @@ public:
        
 protected:
        string label;
+       MothurOut* m;
 //     int maxRank;
 //     int numBins;
 //     int numSeqs;    
index c5f0c2607120ba0455d9819e3a6b5cb064900e81..d4c4eb5e8b21e492df18d62af4226b6e8836a110 100644 (file)
@@ -15,9 +15,9 @@
 
 
 //***************************************************************************************************************
-void DeCalculator::setMask(string m) { 
+void DeCalculator::setMask(string ms) { 
        try {
-               seqMask = m; 
+               seqMask = ms
                int count = 0;
                maskMap.clear();
                
@@ -40,7 +40,7 @@ void DeCalculator::setMask(string m) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "setMask");
+               m->errorOut(e, "DeCalculator", "setMask");
                exit(1);
        } 
 }
@@ -62,7 +62,7 @@ void DeCalculator::runMask(Sequence* seq) {
                seq->setUnaligned(tempQuery);
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "runMask");
+               m->errorOut(e, "DeCalculator", "runMask");
                exit(1);
        }
 }
@@ -90,7 +90,7 @@ void DeCalculator::trimSeqs(Sequence* query, Sequence* subject, map<int, int>& t
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "trimSeqs");
+               m->errorOut(e, "DeCalculator", "trimSeqs");
                exit(1);
        }
 }
@@ -106,7 +106,7 @@ vector<int>  DeCalculator::findWindows(Sequence* query, int front, int back, int
                if (size == 0) {  if (cutoff > 1200) {  size = 300; }
                                                        else{  size = (cutoff / 4); }  } 
                else if (size > (cutoff / 4)) { 
-                               mothurOut("You have selected too large a window size for sequence " + query->getName() + ".  I will choose an appropriate window size."); mothurOutEndLine();
+                               m->mothurOut("You have selected too large a window size for sequence " + query->getName() + ".  I will choose an appropriate window size."); m->mothurOutEndLine();
                                size = (cutoff / 4); 
                }
        
@@ -158,7 +158,7 @@ vector<int>  DeCalculator::findWindows(Sequence* query, int front, int back, int
        
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findWindows");
+               m->errorOut(e, "DeCalculator", "findWindows");
                exit(1);
        }
 }
@@ -200,7 +200,7 @@ vector<float> DeCalculator::calcObserved(Sequence* query, Sequence* subject, vec
                return temp;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "calcObserved");
+               m->errorOut(e, "DeCalculator", "calcObserved");
                exit(1);
        }
 }
@@ -232,7 +232,7 @@ float DeCalculator::calcDist(Sequence* query, Sequence* subject, int front, int
                return dist;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "calcDist");
+               m->errorOut(e, "DeCalculator", "calcDist");
                exit(1);
        }
 }
@@ -255,7 +255,7 @@ vector<float> DeCalculator::calcExpected(vector<float> qav, float coef) {
                                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "calcExpected");
+               m->errorOut(e, "DeCalculator", "calcExpected");
                exit(1);
        }
 }
@@ -279,7 +279,7 @@ float DeCalculator::calcDE(vector<float> obs, vector<float> exp) {
                return de;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "calcDE");
+               m->errorOut(e, "DeCalculator", "calcDE");
                exit(1);
        }
 }
@@ -345,7 +345,7 @@ vector<float> DeCalculator::calcFreq(vector<Sequence*> seqs, string filename) {
                                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "calcFreq");
+               m->errorOut(e, "DeCalculator", "calcFreq");
                exit(1);
        }
 }
@@ -375,7 +375,7 @@ vector<float>  DeCalculator::findQav(vector<int> window, int size, vector<float>
                return averages;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findQav");
+               m->errorOut(e, "DeCalculator", "findQav");
                exit(1);
        }
 }
@@ -394,7 +394,7 @@ vector< vector<quanMember> > DeCalculator::getQuantiles(vector<Sequence*> seqs,
                //for each sequence
                for(int i = start; i < end; i++){
                
-                       mothurOut("Processing sequence " + toString(i)); mothurOutEndLine();
+                       m->mothurOut("Processing sequence " + toString(i)); m->mothurOutEndLine();
                        Sequence* query = new Sequence(seqs[i]->getName(), seqs[i]->getAligned());
                        
                        //compare to every other sequence in template
@@ -443,7 +443,7 @@ vector< vector<quanMember> > DeCalculator::getQuantiles(vector<Sequence*> seqs,
                                                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "getQuantiles");
+               m->errorOut(e, "DeCalculator", "getQuantiles");
                exit(1);
        }
 }
@@ -485,7 +485,7 @@ void DeCalculator::removeObviousOutliers(vector< vector<quanMember> >& quantiles
                //while you still have guys to eliminate
                while (contributions.size() > 0) {
                
-                       mothurOut("Removing scores contributed by sequence " + toString(largestContrib) + " in your template file."); mothurOutEndLine();
+                       m->mothurOut("Removing scores contributed by sequence " + toString(largestContrib) + " in your template file."); m->mothurOutEndLine();
                        
                        //remove from quantiles all scores that were made using this largestContrib
                        for (int i = 0; i < quantiles.size(); i++) {
@@ -516,7 +516,7 @@ cout << "high = " << high << endl;
                
                for(int i = 0; i < marked.size(); i++) {
                        if (marked[i] > high) { 
-                               mothurOut("Removing scores contributed by sequence " + toString(marked[i]) + " in your template file."); mothurOutEndLine();
+                               m->mothurOut("Removing scores contributed by sequence " + toString(marked[i]) + " in your template file."); m->mothurOutEndLine();
                                for (int i = 0; i < quantiles.size(); i++) {
                                        removeContrib(marked[i], quantiles[i]);
                                }
@@ -560,7 +560,7 @@ cout << "high = " << high << endl;
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "removeObviousOutliers");
+               m->errorOut(e, "DeCalculator", "removeObviousOutliers");
                exit(1);
        }
 }
@@ -592,7 +592,7 @@ cout << largest->second << '\t' << largest->first->score << '\t' << largest->fir
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "sortContrib");
+               m->errorOut(e, "DeCalculator", "sortContrib");
                exit(1);
        }
 }
@@ -618,7 +618,7 @@ int DeCalculator::findLargestContrib(vector<int> seen) {
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findLargestContribs");
+               m->errorOut(e, "DeCalculator", "findLargestContribs");
                exit(1);
        }
 }
@@ -637,7 +637,7 @@ void DeCalculator::removeContrib(int bad, vector<quanMember>& quan) {
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "removeContrib");
+               m->errorOut(e, "DeCalculator", "removeContrib");
                exit(1);
        }
 }
@@ -655,7 +655,7 @@ float DeCalculator::findAverage(vector<float> myVector) {
                
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findAverage");
+               m->errorOut(e, "DeCalculator", "findAverage");
                exit(1);
        }
 }
@@ -675,7 +675,7 @@ float DeCalculator::getCoef(vector<float> obs, vector<float> qav) {
                return coef;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "getCoef");
+               m->errorOut(e, "DeCalculator", "getCoef");
                exit(1);
        }
 }
@@ -833,7 +833,7 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
                return seqsMatches;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findClosest");
+               m->errorOut(e, "DeCalculator", "findClosest");
                exit(1);
        }
 }
@@ -865,7 +865,7 @@ Sequence* DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*> db) {
                return seqsMatch;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "findClosest");
+               m->errorOut(e, "DeCalculator", "findClosest");
                exit(1);
        }
 }
@@ -945,7 +945,7 @@ map<int, int> DeCalculator::trimSeqs(Sequence* query, vector<Sequence*> topMatch
                if (pos < rearPos) { rearPos = pos; }
 
                //check to make sure that is not whole seq
-               if ((rearPos - frontPos - 1) <= 0) {  mothurOut("Error, when I trim your sequences, the entire sequence is trimmed."); mothurOutEndLine(); exit(1);  }
+               if ((rearPos - frontPos - 1) <= 0) {  m->mothurOut("Error, when I trim your sequences, the entire sequence is trimmed."); m->mothurOutEndLine(); exit(1);  }
 //cout << query->getName() << " front = " << frontPos << " rear = " << rearPos << endl;                
                //trim query
                string newAligned = query->getAligned();
@@ -968,7 +968,7 @@ map<int, int> DeCalculator::trimSeqs(Sequence* query, vector<Sequence*> topMatch
                return trimmedPos;
        }
        catch(exception& e) {
-               errorOut(e, "DeCalculator", "trimSequences");
+               m->errorOut(e, "DeCalculator", "trimSequences");
                exit(1);
        }
 
index 48a72bb9cc10f6387694bee21d5265c6f12e043d..da663e80f786d1a98b646fe856bbe32522dd2c42 100644 (file)
--- a/decalc.h
+++ b/decalc.h
@@ -36,7 +36,7 @@ class DeCalculator {
 
        public:
                
-               DeCalculator() {};
+               DeCalculator() { m = MothurOut::getInstance(); }
                ~DeCalculator() {};
                
                vector<Sequence*> findClosest(Sequence*, vector<Sequence*>, int&, vector<int>&);  //takes querySeq, a reference db, numWanted and indexes 
@@ -71,6 +71,7 @@ class DeCalculator {
                set<int> h;
                int alignLength;
                map<int, int> maskMap;
+               MothurOut* m;
 
 };
 
index 00c40845484e9ba4eba4e62f7c645135f703e9d2..fcfd320e0b6be3aa3572b661a579311c9dead5bf 100644 (file)
@@ -10,7 +10,7 @@
 #include "deconvolutecommand.h"
 
 /**************************************************************************************/
-DeconvoluteCommand::DeconvoluteCommand(string option)        
+DeconvoluteCommand::DeconvoluteCommand(string option)  {       
        try {
                abort = false;
                
@@ -59,7 +59,7 @@ DeconvoluteCommand::DeconvoluteCommand(string option) {
                        //check for required parameters
                        inFastaName = validParameter.validFile(parameters, "fasta", true);
                        if (inFastaName == "not open") { abort = true; }
-                       else if (inFastaName == "not found") { inFastaName = ""; mothurOut("fasta is a required parameter for the unique.seqs command."); mothurOutEndLine(); abort = true;  }  
+                       else if (inFastaName == "not found") { inFastaName = ""; m->mothurOut("fasta is a required parameter for the unique.seqs command."); m->mothurOutEndLine(); abort = true;  }    
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -74,7 +74,7 @@ DeconvoluteCommand::DeconvoluteCommand(string option) {
 
        }
        catch(exception& e) {
-               errorOut(e, "DeconvoluteCommand", "DeconvoluteCommand");
+               m->errorOut(e, "DeconvoluteCommand", "DeconvoluteCommand");
                exit(1);
        }
 }
@@ -82,15 +82,15 @@ DeconvoluteCommand::DeconvoluteCommand(string option) {
 
 void DeconvoluteCommand::help(){
        try {
-               mothurOut("The unique.seqs command reads a fastafile and creates a namesfile.\n");
-               mothurOut("It creates a file where the first column is the groupname and the second column is a list of sequence names who have the same sequence. \n");
-               mothurOut("If the sequence is unique the second column will just contain its name. \n");
-               mothurOut("The unique.seqs command parameter is fasta and it is required.\n");
-               mothurOut("The unique.seqs command should be in the following format: \n");
-               mothurOut("unique.seqs(fasta=yourFastaFile) \n");       
+               m->mothurOut("The unique.seqs command reads a fastafile and creates a namesfile.\n");
+               m->mothurOut("It creates a file where the first column is the groupname and the second column is a list of sequence names who have the same sequence. \n");
+               m->mothurOut("If the sequence is unique the second column will just contain its name. \n");
+               m->mothurOut("The unique.seqs command parameter is fasta and it is required.\n");
+               m->mothurOut("The unique.seqs command should be in the following format: \n");
+               m->mothurOut("unique.seqs(fasta=yourFastaFile) \n");    
        }
        catch(exception& e) {
-               errorOut(e, "DeconvoluteCommand", "help");
+               m->errorOut(e, "DeconvoluteCommand", "help");
                exit(1);
        }
 }
@@ -113,10 +113,18 @@ int DeconvoluteCommand::execute() {
                fastamap.printCondensedFasta(outFastaFile);
                fastamap.printNamesFile(outNameFile);
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(outFastaFile); m->mothurOutEndLine();      
+               m->mothurOut(outNameFile); m->mothurOutEndLine();
+               m->mothurOutEndLine();
+
+
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "DeconvoluteCommand", "execute");
+               m->errorOut(e, "DeconvoluteCommand", "execute");
                exit(1);
        }
 }
index 4cb6aac3e0c9cd23d7b1d11ed40b775d43d4d42d..9c8fd22d702f8a8b98ee12d682d6f880e5c1fb0e 100644 (file)
@@ -19,7 +19,7 @@
 class DeconvoluteCommand : public Command {
 
 public:
-       DeconvoluteCommand(string);     
+       DeconvoluteCommand(string);
        ~DeconvoluteCommand() { };
        int execute();
        void help();    
index 5963975aeb61487f8d49b73aff2a817e2fb23d2d..8671fa6fde96ed137c48b0e9763a029f942df8fd 100644 (file)
--- a/display.h
+++ b/display.h
@@ -22,8 +22,10 @@ public:
        virtual bool getAll()   {       bool a; return a;       }
        virtual string getName() { return ""; };
        virtual ~Display() {}
+       Display() {  m = MothurOut::getInstance();  }
        
-private:
+protected:
+       MothurOut* m;
        
 };
 
diff --git a/dist.h b/dist.h
index 6a461f53a4622dc3f775d1db2200e104255f0734..b914d0d2b1004c56812cea18ea05d0ab1a787ae3 100644 (file)
--- a/dist.h
+++ b/dist.h
 class Dist {
        
 public:
-       Dist(){dist = 0;}
+       Dist(){dist = 0; m = MothurOut::getInstance(); }
        virtual ~Dist() {}
        virtual void calcDist(Sequence, Sequence) = 0;
        double getDist()        {       return dist;    }
 protected:
        double dist;
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index c615b8068ae1576b07f2e64a2742bfcb36e3e9b3..13f56eb90a422d43e821a9fa378f582691468cb8 100644 (file)
 
 //**********************************************************************************************************************
 
-DistanceCommand::DistanceCommand(string option){
+DistanceCommand::DistanceCommand(string option) {
        try {
                abort = false;
                Estimators.clear();
-               
+                               
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -56,7 +56,7 @@ DistanceCommand::DistanceCommand(string option){
 
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the dist.seqs command."); mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the dist.seqs command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
                        else{
                                ifstream inFASTA;
@@ -92,7 +92,7 @@ DistanceCommand::DistanceCommand(string option){
                        
                        output = validParameter.validFile(parameters, "output", false);         if(output == "not found"){      output = "column"; }
                        
-                       if ((output != "column") && (output != "lt") && (output != "square")) { mothurOut(output + " is not a valid output form. Options are column, lt and square. I will use column."); mothurOutEndLine(); output = "column"; }
+                       if ((output != "column") && (output != "lt") && (output != "square")) { m->mothurOut(output + " is not a valid output form. Options are column, lt and square. I will use column."); m->mothurOutEndLine(); output = "column"; }
                        
                        ValidCalculators validCalculator;
                        
@@ -118,7 +118,7 @@ DistanceCommand::DistanceCommand(string option){
                                
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "DistanceCommand");
+               m->errorOut(e, "DistanceCommand", "DistanceCommand");
                exit(1);
        }
 }
@@ -137,21 +137,21 @@ DistanceCommand::~DistanceCommand(){
 
 void DistanceCommand::help(){
        try {
-               mothurOut("The dist.seqs command reads a file containing sequences and creates a distance file.\n");
-               mothurOut("The dist.seqs command parameters are fasta, calc, countends, output, cutoff and processors.  \n");
-               mothurOut("The fasta parameter is required.\n");
-               mothurOut("The calc parameter allows you to specify the method of calculating the distances.  Your options are: nogaps, onegap or eachgap. The default is onegap.\n");
-               mothurOut("The countends parameter allows you to specify whether to include terminal gaps in distance.  Your options are: T or F. The default is T.\n");
-               mothurOut("The cutoff parameter allows you to specify maximum distance to keep. The default is 1.0.\n");
-               mothurOut("The output parameter allows you to specify format of your distance matrix. Options are column, lt, and square. The default is column.\n");
-               mothurOut("The processors parameter allows you to specify number of processors to use.  The default is 1.\n");
-               mothurOut("The dist.seqs command should be in the following format: \n");
-               mothurOut("dist.seqs(fasta=yourFastaFile, calc=yourCalc, countends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) \n");
-               mothurOut("Example dist.seqs(fasta=amazon.fasta, calc=eachgap, countends=F, cutoff= 2.0, processors=3).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc).\n\n");
+               m->mothurOut("The dist.seqs command reads a file containing sequences and creates a distance file.\n");
+               m->mothurOut("The dist.seqs command parameters are fasta, calc, countends, output, cutoff and processors.  \n");
+               m->mothurOut("The fasta parameter is required.\n");
+               m->mothurOut("The calc parameter allows you to specify the method of calculating the distances.  Your options are: nogaps, onegap or eachgap. The default is onegap.\n");
+               m->mothurOut("The countends parameter allows you to specify whether to include terminal gaps in distance.  Your options are: T or F. The default is T.\n");
+               m->mothurOut("The cutoff parameter allows you to specify maximum distance to keep. The default is 1.0.\n");
+               m->mothurOut("The output parameter allows you to specify format of your distance matrix. Options are column, lt, and square. The default is column.\n");
+               m->mothurOut("The processors parameter allows you to specify number of processors to use.  The default is 1.\n");
+               m->mothurOut("The dist.seqs command should be in the following format: \n");
+               m->mothurOut("dist.seqs(fasta=yourFastaFile, calc=yourCalc, countends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) \n");
+               m->mothurOut("Example dist.seqs(fasta=amazon.fasta, calc=eachgap, countends=F, cutoff= 2.0, processors=3).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "help");
+               m->errorOut(e, "DistanceCommand", "help");
                exit(1);
        }
 }
@@ -213,11 +213,16 @@ int DistanceCommand::execute(){
                
                delete distCalculator;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outputFile); m->mothurOutEndLine();
+               m->mothurOutEndLine();
+
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "execute");
+               m->errorOut(e, "DistanceCommand", "execute");
                exit(1);
        }
 }
@@ -238,7 +243,7 @@ void DistanceCommand::createProcesses(string filename) {
                        }else if (pid == 0){
                                driver(lines[process]->start, lines[process]->end, filename + toString(getpid()) + ".temp", cutoff);
                                exit(0);
-                       }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
+                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
        
                //force parent to wait until all the processes are done
@@ -249,7 +254,7 @@ void DistanceCommand::createProcesses(string filename) {
 #endif
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "createProcesses");
+               m->errorOut(e, "DistanceCommand", "createProcesses");
                exit(1);
        }
 }
@@ -295,18 +300,18 @@ int DistanceCommand::driver(int startLine, int endLine, string dFileName, float
                        if (output == "lt") { outFile << endl; }
                        
                        if(i % 100 == 0){
-                               mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); mothurOutEndLine();
+                               m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                        }
                        
                }
-               mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); mothurOutEndLine();
+               m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine();
                
                outFile.close();
                
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "driver");
+               m->errorOut(e, "DistanceCommand", "driver");
                exit(1);
        }
 }
@@ -390,7 +395,7 @@ void DistanceCommand::convertMatrix(string outputFile) {
                
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "convertMatrix");
+               m->errorOut(e, "DistanceCommand", "convertMatrix");
                exit(1);
        }
 }
@@ -413,7 +418,7 @@ void DistanceCommand::appendFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "DistanceCommand", "appendFiles");
+               m->errorOut(e, "DistanceCommand", "appendFiles");
                exit(1);
        }
 }
index 7521ac70bdf6cf323b6442577ec7b1e609d6ccd8..dedcc79da45f6f60d3beb264c157202557847af4 100644 (file)
@@ -20,7 +20,7 @@
 class DistanceCommand : public Command {
 
 public:
-       DistanceCommand(string);        
+       DistanceCommand(string);
        ~DistanceCommand();
        int execute();  
        void help();
index 25641eb0dacdf63d812cd1bf2a828a7cdfd5f8d2..0c1aeebe43af3ca586bfd6416f95db924a047054 100644 (file)
@@ -21,7 +21,7 @@ DistanceDB::DistanceDB() {
                distCalculator = new eachGapDist();
        }
        catch(exception& e) {
-               errorOut(e, "DistanceDB", "DistanceDB");
+               m->errorOut(e, "DistanceDB", "DistanceDB");
                exit(1);
        }       
 }
@@ -29,14 +29,14 @@ DistanceDB::DistanceDB() {
 void DistanceDB::addSequence(Sequence seq) {
        try {
                //are the template sequences aligned
-               if (!isAligned(seq.getAligned())) { templateAligned = false; mothurOut(seq.getName() + " is not aligned. Sequences must be aligned to use the distance method."); mothurOutEndLine(); }
+               if (!isAligned(seq.getAligned())) { templateAligned = false; m->mothurOut(seq.getName() + " is not aligned. Sequences must be aligned to use the distance method."); m->mothurOutEndLine(); }
                
                if (templateSeqsLength == 0) { templateSeqsLength = seq.getAligned().length(); }
                                
                data.push_back(seq);
        }
        catch(exception& e) {
-               errorOut(e, "DistanceDB", "addSequence");
+               m->errorOut(e, "DistanceDB", "addSequence");
                exit(1);
        }       
 }
@@ -49,7 +49,7 @@ vector<int> DistanceDB::findClosestSequences(Sequence* query, int numWanted){
                string sequence = query->getAligned();
                vector<seqDist> dists;
                
-               if (numWanted > data.size()) { mothurOut("numwanted is larger than the number of template sequences, using 10."); mothurOutEndLine(); numWanted = 10; }
+               if (numWanted > data.size()) { m->mothurOut("numwanted is larger than the number of template sequences, using 10."); m->mothurOutEndLine(); numWanted = 10; }
                
                if (sequence.length() != templateSeqsLength) { templateSameLength = false; }
                
@@ -72,14 +72,14 @@ vector<int> DistanceDB::findClosestSequences(Sequence* query, int numWanted){
                        }
                
                }else{
-                       mothurOut("cannot find closest matches using distance method for " + query->getName() + " without aligned template sequences of the same length."); mothurOutEndLine();
+                       m->mothurOut("cannot find closest matches using distance method for " + query->getName() + " without aligned template sequences of the same length."); m->mothurOutEndLine();
                        exit(1);
                }
                
                return topMatches;
        }
        catch(exception& e) {
-               errorOut(e, "DistanceDB", "findClosestSequence");
+               m->errorOut(e, "DistanceDB", "findClosestSequence");
                exit(1);
        }       
 }
@@ -98,7 +98,7 @@ bool DistanceDB::isAligned(string seq){
                return aligned;
        }
        catch(exception& e) {
-               errorOut(e, "DistanceDB", "isAligned");
+               m->errorOut(e, "DistanceDB", "isAligned");
                exit(1);
        }       
 }
index 9ddcdfa6307a4a40e27cb2281fe2fc70389371fd..7e1cba8ce055b9c47042806839ea80236f10b3d4 100644 (file)
--- a/efron.cpp
+++ b/efron.cpp
@@ -16,18 +16,18 @@ EstOutput Efron::getValues(SAbundVector* rank){
                data.resize(1,0);
                
                double n = (double)rank->getNumSeqs();
-               if(m > n || m == 0) {   m = n;  }
+               if(f > n || f == 0) {   f = n;  }
                
                double sum = 0;
                for(int i = 1; i < rank->size(); i++){
-                       sum += pow(-1., i+1) * pow(((double)m / n), i) * (double)(rank->get(i));
+                       sum += pow(-1., i+1) * pow(((double)f / n), i) * (double)(rank->get(i));
                }
                data[0] = sum;
                
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Efron", "getValues");
+               m->errorOut(e, "Efron", "getValues");
                exit(1);
        }
 }
diff --git a/efron.h b/efron.h
index 782e72e8e11f3145032052abab60629107e857a6..44aee5a89162d7604bc8d8e4cf68e137e242c2a0 100644 (file)
--- a/efron.h
+++ b/efron.h
 class Efron : public Calculator  {
        
 public: 
-       Efron(int size) : m(size), Calculator("efron", 1, false) {};
+       Efron(int size) : f(size), Calculator("efron", 1, false) {};
        EstOutput getValues(SAbundVector*);     
        EstOutput getValues(vector<SharedRAbundVector*>) {return data;};
 private:
-       int m;
+       int f;
 };
 
 
index 18e1a595c06343a521d9bcd6458b95db4d863db7..fdd017ab34c7a083b3f09bc270498155b3cb3766 100644 (file)
 Engine::Engine(){
        try {
                cFactory = CommandFactory::getInstance();
+               mout = MothurOut::getInstance();
        }
        catch(exception& e) {
-               errorOut(e, "Engine", "Engine");
+               mout->errorOut(e, "Engine", "Engine");
                exit(1);
        }
 }
@@ -31,6 +32,7 @@ InteractEngine::InteractEngine(string path){
 
        globaldata = GlobalData::getInstance();
        globaldata->argv = path;
+       
 }
 
 /***********************************************************************/
@@ -49,9 +51,10 @@ bool InteractEngine::getInput(){
                
                while(quitCommandCalled != 1){
 
-                       mothurOutEndLine();
+                       mout->mothurOutEndLine();
                        
-                       input = getCommand();                   
+                       input = getCommand();   
+                       mout->mothurOutEndLine();               
                        
                        //allow user to omit the () on the quit command
                        if (input == "quit") { input = "quit()"; }
@@ -68,14 +71,14 @@ bool InteractEngine::getInput(){
                                quitCommandCalled = command->execute();
                                
                        }else {
-                               mothurOut("Your input contains errors. Please try again."); 
-                               mothurOutEndLine();
+                               mout->mothurOut("Your input contains errors. Please try again."); 
+                               mout->mothurOutEndLine();
                        }
                }       
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "InteractEngine", "getInput");
+               mout->errorOut(e, "InteractEngine", "getInput");
                exit(1);
        }
 }
@@ -93,28 +96,28 @@ string Engine::getCommand()  {
                                        cout << nextCommand << endl;
                                }       
                                
-                               mothurOutJustToLog("mothur > " + toString(nextCommand));
+                               mout->mothurOutJustToLog("mothur > " + toString(nextCommand));
                                return nextCommand;
                        #else
                                string nextCommand = "";
-                               mothurOut("mothur > ");
+                               mout->mothurOut("mothur > ");
                                getline(cin, nextCommand);
-                               mothurOutJustToLog("mothur > " + toString(nextCommand));
+                               mout->mothurOutJustToLog("mothur > " + toString(nextCommand));
                                return nextCommand;
                        #endif
                #else
                        string nextCommand = "";
-                       mothurOut("mothur > ");
+                       mout->mothurOut("mothur > ");
                        getline(cin, nextCommand);
-                       mothurOutJustToLog("mothur > " + toString(nextCommand));
+                       mout->mothurOutJustToLog("mothur > " + toString(nextCommand));
                        return nextCommand;
                #endif
                
-               mothurOutEndLine();
+               mout->mothurOutEndLine();
                                                
        }
        catch(exception& e) {
-               errorOut(e, "Engine", "getCommand");
+               mout->errorOut(e, "Engine", "getCommand");
                exit(1);
        }
 }
@@ -129,7 +132,7 @@ BatchEngine::BatchEngine(string path, string batchFileName){
                                
        }
        catch(exception& e) {
-               errorOut(e, "BatchEngine", "BatchEngine");
+               mout->errorOut(e, "BatchEngine", "BatchEngine");
                exit(1);
        }
 }
@@ -144,8 +147,8 @@ bool BatchEngine::getInput(){
        try {
                //check if this is a valid batchfile
                if (openedBatch == 1) {  
-                       mothurOut("unable to open batchfile");  
-                       mothurOutEndLine();
+                       mout->mothurOut("unable to open batchfile");  
+                       mout->mothurOutEndLine();
                        return 1; 
                }
        
@@ -163,9 +166,9 @@ bool BatchEngine::getInput(){
                        
                        if (input[0] != '#') {
                                
-                               mothurOutEndLine();
-                               mothurOut("mothur > " + input);
-                               mothurOutEndLine();
+                               mout->mothurOutEndLine();
+                               mout->mothurOut("mothur > " + input);
+                               mout->mothurOutEndLine();
                                
                                
                                //allow user to omit the () on the quit command
@@ -181,8 +184,8 @@ bool BatchEngine::getInput(){
                                        Command* command = cFactory->getCommand(commandName, options);
                                        quitCommandCalled = command->execute();
                                }else {         
-                                       mothurOut("Invalid."); 
-                                       mothurOutEndLine();
+                                       mout->mothurOut("Invalid."); 
+                                       mout->mothurOutEndLine();
                                }
                                
                        }
@@ -193,7 +196,7 @@ bool BatchEngine::getInput(){
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "BatchEngine", "getInput");
+               mout->errorOut(e, "BatchEngine", "getInput");
                exit(1);
        }
 }
@@ -210,10 +213,10 @@ ScriptEngine::ScriptEngine(string path, string commandString){
                listOfCommands = commandString.substr(1, (commandString.length()-1));
 
                globaldata->argv = path;
-               
+                               
        }
        catch(exception& e) {
-               errorOut(e, "ScriptEngine", "ScriptEngine");
+               mout->errorOut(e, "ScriptEngine", "ScriptEngine");
                exit(1);
        }
 }
@@ -242,9 +245,9 @@ bool ScriptEngine::getInput(){
                        if (input == "") { input = "quit()"; }
                        
                        
-                       mothurOutEndLine();
-                       mothurOut("mothur > " + input);
-                       mothurOutEndLine();
+                       mout->mothurOutEndLine();
+                       mout->mothurOut("mothur > " + input);
+                       mout->mothurOutEndLine();
 
                                
                        //allow user to omit the () on the quit command
@@ -260,8 +263,8 @@ bool ScriptEngine::getInput(){
                                Command* command = cFactory->getCommand(commandName, options);
                                quitCommandCalled = command->execute();
                        }else {         
-                               mothurOut("Invalid."); 
-                               mothurOutEndLine();
+                               mout->mothurOut("Invalid."); 
+                               mout->mothurOutEndLine();
                        }
                        
                }
@@ -269,7 +272,7 @@ bool ScriptEngine::getInput(){
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "ScriptEngine", "getInput");
+               mout->errorOut(e, "ScriptEngine", "getInput");
                exit(1);
        }
 }
@@ -304,7 +307,7 @@ string ScriptEngine::getNextCommand(string& commandString) {
                return nextcommand;
        }
        catch(exception& e) {
-               errorOut(e, "ScriptEngine", "getNextCommand");
+               mout->errorOut(e, "ScriptEngine", "getNextCommand");
                exit(1);
        }
 }
index cbcc99aaf2cd8ebc48f6512eb9e88967df8e94b3..74687d2398c84a532b0ba6c68e17ed8cff1f7cf0 100644 (file)
@@ -17,6 +17,7 @@
 #include "commandoptionparser.hpp"
 #include "command.hpp"
 #include "commandfactory.hpp"
+#include "mothurout.h"
 
 class GlobalData;
 
@@ -31,6 +32,7 @@ public:
 protected:
        vector<string> options;
        CommandFactory* cFactory;
+       MothurOut* mout;
 };
 
 
index f5ac122112a633de7768b251568edda33623a81c..2831ecbff9e2c2427ca551b0e08967ff738f8e7a 100644 (file)
@@ -44,7 +44,7 @@ void FastaMap::readFastaFile(string inFileName) {
                in.close();             
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "readFastaFile");
+               m->errorOut(e, "FastaMap", "readFastaFile");
                exit(1);
        }
 }
@@ -150,7 +150,7 @@ void FastaMap::printNamesFile(string outFileName){ //prints data
                outFile.close();
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "printNamesFile");
+               m->errorOut(e, "FastaMap", "printNamesFile");
                exit(1);
        }
 }
@@ -169,7 +169,7 @@ void FastaMap::printCondensedFasta(string outFileName){ //prints data
                out.close();
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "printCondensedFasta");
+               m->errorOut(e, "FastaMap", "printCondensedFasta");
                exit(1);
        }
 }
index e628aedbc460af82c19fd1b124dec5235b421c2e..e1ff3dff2f9ceab1c663f0646141594fe1d20339 100644 (file)
@@ -11,6 +11,7 @@
  */
  
 #include "mothur.h"
+#include "mothurout.h"
 
 
 /* This class represents the fasta file.  It reads a fasta file a populates the internal data structure "data".
@@ -21,7 +22,7 @@ a list of the sequences names who have the same sequence and a number of how man
 class FastaMap  {
 
 public:
-       FastaMap() {};
+       FastaMap() { m = MothurOut::getInstance(); }
        ~FastaMap() {};
        
        string getGroupName(string);  //pass a sequence name get its group
@@ -42,6 +43,7 @@ private:
 
        map<string, group>  data;  //sequence, groupinfo        - condensed representation of file
        map<string, string>  seqmap;  //name, sequence  -  uncondensed representation of file
+       MothurOut* m;
 };
 
 #endif
index 0d78a2db778b22ec0313d56781de192d56f64693..117f8ab1c3a9a93c5f80f38613c4aefa1c898e32 100644 (file)
@@ -40,7 +40,7 @@ void ThreeColumnFile::initFile(string label){
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               errorOut(e, "ThreeColumnFile", "initFile");
+               m->errorOut(e, "ThreeColumnFile", "initFile");
                exit(1);
        }
 }
@@ -60,7 +60,7 @@ void ThreeColumnFile::output(int nSeqs, vector<double> data){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ThreeColumnFile", "output");
+               m->errorOut(e, "ThreeColumnFile", "output");
                exit(1);
        }
 }
@@ -85,12 +85,12 @@ void ThreeColumnFile::resetFile(){
                
                //checks to make sure user was able to rename and remove successfully
                if ((renameOk != 0)) { 
-                       mothurOut("Unable to rename " + outName); mothurOutEndLine();
+                       m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine();
                        perror(" : ");
                }       
        }
        catch(exception& e) {
-               errorOut(e, "ThreeColumnFile", "resetFile");
+               m->errorOut(e, "ThreeColumnFile", "resetFile");
                exit(1);
        }
 }
@@ -134,7 +134,7 @@ void ColumnFile::initFile(string label, vector<string> tags){
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               errorOut(e, "ColumnFile", "initFile");
+               m->errorOut(e, "ColumnFile", "initFile");
                exit(1);
        }
 }
@@ -164,7 +164,7 @@ void ColumnFile::output(vector<double> data){
 
        }
        catch(exception& e) {
-               errorOut(e, "ColumnFile", "output");
+               m->errorOut(e, "ColumnFile", "output");
                exit(1);
        }
 }
@@ -189,12 +189,12 @@ void ColumnFile::resetFile(){
                
                //checks to make sure user was able to rename and remove successfully
                if ((renameOk != 0)) { 
-                       mothurOut("Unable to rename " + outName); mothurOutEndLine();
+                       m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine();
                        perror(" : ");
                }       
        }
        catch(exception& e) {
-               errorOut(e, "ColumnFile", "resetFile");
+               m->errorOut(e, "ColumnFile", "resetFile");
                exit(1);
        }
 }
@@ -231,7 +231,7 @@ void SharedThreeColumnFile::initFile(string label){
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               errorOut(e, "SharedThreeColumnFile", "initFile");
+               m->errorOut(e, "SharedThreeColumnFile", "initFile");
                exit(1);
        }
 }
@@ -252,7 +252,7 @@ void SharedThreeColumnFile::output(int nSeqs, vector<double> data){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedThreeColumnFile", "output");
+               m->errorOut(e, "SharedThreeColumnFile", "output");
                exit(1);
        }
 }
@@ -277,12 +277,12 @@ void SharedThreeColumnFile::resetFile(){
                
                //checks to make sure user was able to rename and remove successfully
                if ((renameOk != 0)) { 
-                       mothurOut("Unable to rename " + outName); mothurOutEndLine();
+                       m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine();
                        perror(" : ");
                }       
        }
        catch(exception& e) {
-               errorOut(e, "SharedThreeColumnFile", "resetFile");
+               m->errorOut(e, "SharedThreeColumnFile", "resetFile");
                exit(1);
        }
 }
@@ -320,7 +320,7 @@ void OneColumnFile::initFile(string label){
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               errorOut(e, "OneColumnFile", "initFile");
+               m->errorOut(e, "OneColumnFile", "initFile");
                exit(1);
        }
 }
@@ -340,7 +340,7 @@ void OneColumnFile::output(int nSeqs, vector<double> data){
                }
        }
        catch(exception& e) {
-               errorOut(e, "OneColumnFile", "output");
+               m->errorOut(e, "OneColumnFile", "output");
                exit(1);
        }
 }
@@ -364,13 +364,13 @@ void OneColumnFile::resetFile(){
                
                //checks to make sure user was able to rename and remove successfully
                if ((renameOk != 0)) { 
-                       mothurOut("Unable to rename " + outName); mothurOutEndLine();
+                       m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine();
                        perror(" : ");
                }       
 
        }
        catch(exception& e) {
-               errorOut(e, "OneColumnFile", "resetFile");
+               m->errorOut(e, "OneColumnFile", "resetFile");
                exit(1);
        }
 }
@@ -409,7 +409,7 @@ void SharedOneColumnFile::initFile(string label){
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               errorOut(e, "SharedOneColumnFile", "initFile");
+               m->errorOut(e, "SharedOneColumnFile", "initFile");
                exit(1);
        }
 }
@@ -436,7 +436,7 @@ void SharedOneColumnFile::output(int nSeqs, vector<double> data){
                        }
        }
        catch(exception& e) {
-               errorOut(e, "SharedOneColumnFile", "output");
+               m->errorOut(e, "SharedOneColumnFile", "output");
                exit(1);
        }
 }
@@ -461,12 +461,12 @@ void SharedOneColumnFile::resetFile(){
                
                //checks to make sure user was able to rename and remove successfully
                if ((renameOk != 0)) { 
-                       mothurOut("Unable to rename " + outName); mothurOutEndLine();
+                       m->mothurOut("Unable to rename " + outName); m->mothurOutEndLine();
                        perror(" : ");
                }       
        }
        catch(exception& e) {
-               errorOut(e, "SharedOneColumnFile", "resetFile");
+               m->errorOut(e, "SharedOneColumnFile", "resetFile");
                exit(1);
        }
 }
index 17bd7a1d7d23dd6a86ae2ea2ec5e5c16e9665171..170ee68a8151e9252788364c13a09de58b192815 100644 (file)
@@ -2,13 +2,14 @@
 #define FILEOUTPUT_H
 
 #include "mothur.h"
+#include "mothurout.h"
 
 /***********************************************************************/
 
 class FileOutput {
        
 public:
-       FileOutput(){};
+       FileOutput(){ m = MothurOut::getInstance(); }
        virtual ~FileOutput(){};
        
        virtual void initFile(string) = 0;
@@ -20,6 +21,7 @@ public:
 
 protected:
        int renameOk;
+       MothurOut* m;
 
 };     
        
index 8c61ab221d14b27e0f158b93189148817c72b057..d45d916296583824cbc260535a98f7ae850f882a 100644 (file)
@@ -12,7 +12,7 @@
 
 /**************************************************************************************/
 
-FilterSeqsCommand::FilterSeqsCommand(string option){
+FilterSeqsCommand::FilterSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -59,7 +59,7 @@ FilterSeqsCommand::FilterSeqsCommand(string option){
                        
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the filter.seqs command."); mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the filter.seqs command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -96,7 +96,7 @@ FilterSeqsCommand::FilterSeqsCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "FilterSeqsCommand", "FilterSeqsCommand");
+               m->errorOut(e, "FilterSeqsCommand", "FilterSeqsCommand");
                exit(1);
        }
 }
@@ -105,21 +105,21 @@ FilterSeqsCommand::FilterSeqsCommand(string option){
 
 void FilterSeqsCommand::help(){
        try {
-               mothurOut("The filter.seqs command reads a file containing sequences and creates a .filter and .filter.fasta file.\n");
-               mothurOut("The filter.seqs command parameters are fasta, trump, soft, hard and vertical. \n");
-               mothurOut("The fasta parameter is required.\n");
-               mothurOut("The trump parameter .... The default is ...\n");
-               mothurOut("The soft parameter .... The default is ....\n");
-               mothurOut("The hard parameter .... The default is ....\n");
-               mothurOut("The vertical parameter .... The default is T.\n");
-               mothurOut("The filter.seqs command should be in the following format: \n");
-               mothurOut("filter.seqs(fasta=yourFastaFile, trump=yourTrump, soft=yourSoft, hard=yourHard, vertical=yourVertical) \n");
-               mothurOut("Example filter.seqs(fasta=abrecovery.fasta, trump=..., soft=..., hard=..., vertical=T).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The filter.seqs command reads a file containing sequences and creates a .filter and .filter.fasta file.\n");
+               m->mothurOut("The filter.seqs command parameters are fasta, trump, soft, hard and vertical. \n");
+               m->mothurOut("The fasta parameter is required.\n");
+               m->mothurOut("The trump parameter .... The default is ...\n");
+               m->mothurOut("The soft parameter .... The default is ....\n");
+               m->mothurOut("The hard parameter .... The default is ....\n");
+               m->mothurOut("The vertical parameter .... The default is T.\n");
+               m->mothurOut("The filter.seqs command should be in the following format: \n");
+               m->mothurOut("filter.seqs(fasta=yourFastaFile, trump=yourTrump, soft=yourSoft, hard=yourHard, vertical=yourVertical) \n");
+               m->mothurOut("Example filter.seqs(fasta=abrecovery.fasta, trump=..., soft=..., hard=..., vertical=T).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
                
        }
        catch(exception& e) {
-               errorOut(e, "FilterSeqsCommand", "help");
+               m->errorOut(e, "FilterSeqsCommand", "help");
                exit(1);
        }
 }
@@ -207,17 +207,24 @@ int FilterSeqsCommand::execute() {
                        if(filter[i] == '1'){   filteredLength++;       }
                }
                
-               mothurOutEndLine();
-               mothurOut("Length of filtered alignment: " + toString(filteredLength)); mothurOutEndLine();
-               mothurOut("Number of columns removed: " + toString((alignmentLength-filteredLength))); mothurOutEndLine();
-               mothurOut("Length of the original alignment: " + toString(alignmentLength)); mothurOutEndLine();
-               mothurOut("Number of sequences used to construct filter: " + toString(numSeqs)); mothurOutEndLine();
+               m->mothurOutEndLine();
+               m->mothurOut("Length of filtered alignment: " + toString(filteredLength)); m->mothurOutEndLine();
+               m->mothurOut("Number of columns removed: " + toString((alignmentLength-filteredLength))); m->mothurOutEndLine();
+               m->mothurOut("Length of the original alignment: " + toString(alignmentLength)); m->mothurOutEndLine();
+               m->mothurOut("Number of sequences used to construct filter: " + toString(numSeqs)); m->mothurOutEndLine();
                
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(filterFile); m->mothurOutEndLine();        
+               m->mothurOut(filteredFasta); m->mothurOutEndLine();
+               m->mothurOutEndLine();
+
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "FilterSeqsCommand", "execute");
+               m->errorOut(e, "FilterSeqsCommand", "execute");
                exit(1);
        }
 }
index a11601b74004d2429b985a1aa1e6fe4114457855..e13ead55b4743304d90b062f3cda01208149e350 100644 (file)
@@ -162,7 +162,7 @@ void FormatColumnMatrix::read(NameAssignment* nameMap){
 
        }
        catch(exception& e) {
-               errorOut(e, "FormatColumnMatrix", "read");
+               m->errorOut(e, "FormatColumnMatrix", "read");
                exit(1);
        }
 }
index 4ef36d95d6d8e11db5bf065a755fd0292e809c17..30e427668bbcca5a9db73b1858097f3c0e0b4379 100644 (file)
@@ -57,7 +57,7 @@
 class FormatMatrix {
 
 public:
-       FormatMatrix(){ }
+       FormatMatrix(){ m = MothurOut::getInstance(); }
        virtual ~FormatMatrix() {}
        
        virtual void read(NameAssignment*){};
@@ -72,6 +72,7 @@ protected:
        float cutoff;
        string distFile;
        vector<int> rowPos;
+       MothurOut* m;
 };
 
 //**********************************************************************************************************************
index d7211cf8c0a2b1b0ef08c8696e348358404ae369..aaf540aed0d800d111e1a8a7703520640a28d240 100644 (file)
@@ -209,7 +209,7 @@ void FormatPhylipMatrix::read(NameAssignment* nameMap){
                        
        }
        catch(exception& e) {
-               errorOut(e, "FormatPhylipMatrix", "read");
+               m->errorOut(e, "FormatPhylipMatrix", "read");
                 exit(1);
        }
 }
index 5612041528a00e9e0e441422662c6d3738bcb07c..0255d07f00bbcfef3a9c62658149ec39fd6fc5bf 100644 (file)
@@ -13,6 +13,7 @@
 //This constructor reads a distance matrix file and stores the data in the matrix.
 FullMatrix::FullMatrix(ifstream& filehandle) {
        try{
+               m = MothurOut::getInstance();
                globaldata = GlobalData::getInstance();
                groupmap = globaldata->gGroupmap;
                
@@ -25,7 +26,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                        matrix[i].resize(numSeqs, 0.0);
                }
                group = groupmap->getGroup(name);
-               if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
+               if(group == "not found") {      m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
                index.resize(numSeqs);
                index[0].seqName = name;
                index[0].groupName = group;
@@ -62,7 +63,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                                
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "FullMatrix");
+               m->errorOut(e, "FullMatrix", "FullMatrix");
                exit(1);
        }
 }
@@ -84,7 +85,7 @@ void FullMatrix::readSquareMatrix(ifstream& filehandle) {
                        index[i].seqName = name;
                        index[i].groupName = group;
                        
-                       if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
+                       if(group == "not found") {      m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
                                
                        for(int j=0;j<numSeqs;j++){
                                filehandle >> matrix[i][j];
@@ -97,7 +98,7 @@ void FullMatrix::readSquareMatrix(ifstream& filehandle) {
                delete reading;
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "readSquareMatrix");
+               m->errorOut(e, "FullMatrix", "readSquareMatrix");
                exit(1);
        }
 } 
@@ -119,7 +120,7 @@ void FullMatrix::readLTMatrix(ifstream& filehandle) {
                        index[i].seqName = name;
                        index[i].groupName = group;
        
-                       if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                       if(group == "not found") {      m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                                
                        for(int j=0;j<i;j++){
                                filehandle >> distance;
@@ -133,7 +134,7 @@ void FullMatrix::readLTMatrix(ifstream& filehandle) {
                delete reading;
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "readLTMatrix");
+               m->errorOut(e, "FullMatrix", "readLTMatrix");
                exit(1);
        }
 }
@@ -176,7 +177,7 @@ void FullMatrix::sortGroups(int low, int high){
        
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "sortGroups");
+               m->errorOut(e, "FullMatrix", "sortGroups");
                exit(1);
        }
 }
@@ -214,7 +215,7 @@ void FullMatrix::swapRows(int i, int j) {
                
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "swapRows");
+               m->errorOut(e, "FullMatrix", "swapRows");
                exit(1);
        }
 }
@@ -253,7 +254,7 @@ void FullMatrix::printMatrix(ostream& out) {
                for (int i = 0; i < numSeqs; i++) {  out << i << '\t' <<  index[i].seqName << endl;  }
        }
        catch(exception& e) {
-               errorOut(e, "FullMatrix", "printMatrix");
+               m->errorOut(e, "FullMatrix", "printMatrix");
                exit(1);
        }
 }
index 7cb8b15fedf8c39f06aeaee5ca3fb6e9f3274499..15fee6e04a97416f3ad734c4f81fe75a6eb598ec 100644 (file)
@@ -23,7 +23,7 @@ struct Names {
 class FullMatrix {
        
 public:
-       FullMatrix(){};
+       FullMatrix(){ m = MothurOut::getInstance(); }
        FullMatrix(ifstream&);
        ~FullMatrix(){};
        
@@ -53,6 +53,7 @@ private:
        int numGroups;
        int numUserGroups;
        GlobalData* globaldata;
+       MothurOut* m;
 };
 
 #endif
index a52e64443a0ad1fa9a06ca77361eba8741ba97cb..201f8f5873c9cf93b9aaad4c004f6a7a61ee692a 100644 (file)
--- a/geom.cpp
+++ b/geom.cpp
@@ -86,7 +86,7 @@ EstOutput Geom::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Geom", "getValues");
+               m->errorOut(e, "Geom", "getValues");
                exit(1);
        }
 }
index c754f8eb1bb2ba79daf77c3a060a0ebf770252dd..b645517f938928c44eb5faa5871e4171c40fb800 100644 (file)
@@ -10,7 +10,7 @@
 #include "getgroupcommand.h"
 
 //**********************************************************************************************************************
-GetgroupCommand::GetgroupCommand(string option){
+GetgroupCommand::GetgroupCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -35,7 +35,7 @@ GetgroupCommand::GetgroupCommand(string option){
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        string outputDir = validParameter.validFile(parameters, "outputdir", false);            if (outputDir == "not found"){  outputDir = "";         }
                        
-                       if ((globaldata->getSharedFile() == "")) { mothurOut("You must use the read.otu command to read a groupfile or a sharedfile before you can use the get.group command."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "")) { m->mothurOut("You must use the read.otu command to read a groupfile or a sharedfile before you can use the get.group command."); m->mothurOutEndLine(); abort = true; }
                                
                        if (abort == false) {
                                //open shared file
@@ -51,7 +51,7 @@ GetgroupCommand::GetgroupCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "GetgroupCommand", "GetgroupCommand");
+               m->errorOut(e, "GetgroupCommand", "GetgroupCommand");
                exit(1);
        }
 }
@@ -59,16 +59,16 @@ GetgroupCommand::GetgroupCommand(string option){
 
 void GetgroupCommand::help(){
        try {
-               mothurOut("The get.group command can only be executed after a successful read.otu command.\n");
-               //mothurOut("The get.group command outputs a .bootGroups file to you can use in addition to the tree file generated by the bootstrap.shared command to run the consensus command.\n");
-               mothurOut("You may not use any parameters with the get.group command.\n");
-               mothurOut("The get.group command should be in the following format: \n");
-               mothurOut("get.group()\n");
-               mothurOut("Example get.group().\n");
+               m->mothurOut("The get.group command can only be executed after a successful read.otu command.\n");
+               //m->mothurOut("The get.group command outputs a .bootGroups file to you can use in addition to the tree file generated by the bootstrap.shared command to run the consensus command.\n");
+               m->mothurOut("You may not use any parameters with the get.group command.\n");
+               m->mothurOut("The get.group command should be in the following format: \n");
+               m->mothurOut("get.group()\n");
+               m->mothurOut("Example get.group().\n");
                
        }
        catch(exception& e) {
-               errorOut(e, "GetgroupCommand", "help");
+               m->errorOut(e, "GetgroupCommand", "help");
                exit(1);
        }
 }
@@ -94,7 +94,7 @@ int GetgroupCommand::execute(){
                holdLabel = label;
                
                //output first group
-               mothurOut(groupN); mothurOutEndLine();
+               m->mothurOut(groupN); m->mothurOutEndLine();
                out << groupN << '\t' << groupN << endl;        
                        
                //get rest of line
@@ -110,7 +110,7 @@ int GetgroupCommand::execute(){
                        count++;
                        
                        //output next group
-                       mothurOut(groupN); mothurOutEndLine();
+                       m->mothurOut(groupN); m->mothurOutEndLine();
                        out << groupN << '\t' << groupN << endl;                                
                        
                        //fill vector.  
@@ -123,11 +123,17 @@ int GetgroupCommand::execute(){
                
                in.close();
                out.close();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outputFile); m->mothurOutEndLine();        
+               m->mothurOutEndLine();
+               
                return 0;       
        }
 
        catch(exception& e) {
-               errorOut(e, "GetgroupCommand", "execute");
+               m->errorOut(e, "GetgroupCommand", "execute");
                exit(1);
        }
 }
index 2ba3054978ecda124017a1e5d5f0f73640d28702..d306250f5b82b48cd6b353c4af0619907e2b9086 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-GetlabelCommand::GetlabelCommand(string option){
+GetlabelCommand::GetlabelCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -20,12 +20,12 @@ GetlabelCommand::GetlabelCommand(string option){
                if(option == "help") { help(); abort = true; }
                
                else {
-                       if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund or rabund before you can use the get.label command."); mothurOutEndLine(); abort = true; }                               
+                       if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund or rabund before you can use the get.label command."); m->mothurOutEndLine(); abort = true; }                         
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "GetlabelCommand", "GetlabelCommand");
+               m->errorOut(e, "GetlabelCommand", "GetlabelCommand");
                exit(1);
        }
 }
@@ -33,14 +33,14 @@ GetlabelCommand::GetlabelCommand(string option){
 
 void GetlabelCommand::help(){
        try {
-               mothurOut("The get.label command can only be executed after a successful read.otu command.\n");
-               mothurOut("You may not use any parameters with the get.label command.\n");
-               mothurOut("The get.label command should be in the following format: \n");
-               mothurOut("get.label()\n");
-               mothurOut("Example get.label().\n");
+               m->mothurOut("The get.label command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("You may not use any parameters with the get.label command.\n");
+               m->mothurOut("The get.label command should be in the following format: \n");
+               m->mothurOut("get.label()\n");
+               m->mothurOut("Example get.label().\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetlabelCommand", "help");
+               m->errorOut(e, "GetlabelCommand", "help");
                exit(1);
        }
 }
@@ -67,7 +67,7 @@ int GetlabelCommand::execute(){
                        if(count > numBins)
                                count = 0;
                        if(count == 0) {
-                               mothurOut(label); mothurOutEndLine();
+                               m->mothurOut(label); m->mothurOutEndLine();
                                in >> numBins;
                        }
                        in >> label;
@@ -79,7 +79,7 @@ int GetlabelCommand::execute(){
        }
 
        catch(exception& e) {
-               errorOut(e, "GetlabelCommand", "execute");
+               m->errorOut(e, "GetlabelCommand", "execute");
                exit(1);
        }
 }
index fcc42ced634b80790d6aa3f5977ea6ef3121f77a..6053f474224368a5b7f786f24237b2c8645ea1e0 100644 (file)
 #include "getlistcountcommand.h"
 
 //**********************************************************************************************************************
-GetListCountCommand::GetListCountCommand(string option){
+GetListCountCommand::GetListCountCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                allLines = 1;
                labels.clear();
-               
+                               
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -57,7 +57,7 @@ GetListCountCommand::GetListCountCommand(string option){
                        
                        //check for required parameters
                        listfile = validParameter.validFile(parameters, "list", true);
-                       if ((listfile == "not found") && (globaldata->getListFile() == ""))  { mothurOut("You must read a listfile before running the get.listcount command.");  mothurOutEndLine(); abort = true; }
+                       if ((listfile == "not found") && (globaldata->getListFile() == ""))  { m->mothurOut("You must read a listfile before running the get.listcount command.");  m->mothurOutEndLine(); abort = true; }
                        else if ((listfile == "not found") && (globaldata->getListFile() != "")) { listfile = globaldata->getListFile(); }
                        else if (listfile == "not open") { abort = true; }      
                        else { globaldata->setListFile(listfile); }
@@ -80,7 +80,7 @@ GetListCountCommand::GetListCountCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "GetListCountCommand", "GetListCountCommand");
+               m->errorOut(e, "GetListCountCommand", "GetListCountCommand");
                exit(1);
        }
 }
@@ -88,17 +88,17 @@ GetListCountCommand::GetListCountCommand(string option){
 
 void GetListCountCommand::help(){
        try {
-               mothurOut("The get.listcount command can only be executed after a successful read.otu command of a listfile or providing a list file using the list parameter.\n");
-               mothurOut("The get.listcount command parameters are list and label.  No parameters are required.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and are separated by dashes.\n");
-               mothurOut("The get.listcount command should be in the following format: get.listcount(list=yourlistFile, label=yourLabels).\n");
-               mothurOut("Example get.listcount(list=amazon.fn.list, label=0.10).\n");
-               mothurOut("The default value for label is all lines in your inputfile.\n");
-               mothurOut("The get.listcount command outputs a .otu file for each distance you specify listing the bin number and the names of the sequences in that bin.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n");
+               m->mothurOut("The get.listcount command can only be executed after a successful read.otu command of a listfile or providing a list file using the list parameter.\n");
+               m->mothurOut("The get.listcount command parameters are list and label.  No parameters are required.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and are separated by dashes.\n");
+               m->mothurOut("The get.listcount command should be in the following format: get.listcount(list=yourlistFile, label=yourLabels).\n");
+               m->mothurOut("Example get.listcount(list=amazon.fn.list, label=0.10).\n");
+               m->mothurOut("The default value for label is all lines in your inputfile.\n");
+               m->mothurOut("The get.listcount command outputs a .otu file for each distance you specify listing the bin number and the names of the sequences in that bin.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetListCountCommand", "help");
+               m->errorOut(e, "GetListCountCommand", "help");
                exit(1);
        }
 }
@@ -163,12 +163,12 @@ int GetListCountCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + ".");  mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + ".");  m->mothurOutEndLine();
                        }
                }
                
@@ -184,10 +184,15 @@ int GetListCountCommand::execute(){
                delete read;
                globaldata->gListVector = NULL;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "GetListCountCommand", "execute");
+               m->errorOut(e, "GetListCountCommand", "execute");
                exit(1);
        }
 }
@@ -200,8 +205,9 @@ void GetListCountCommand::process(ListVector* list) {
                if (outputDir == "") { outputDir += hasPath(listfile); }
                string outputFileName = outputDir + getRootName(getSimpleName(listfile)) + list->getLabel() + ".otu";
                openOutputFile(outputFileName, out);
+               outputNames.push_back(outputFileName);
                
-               mothurOut(list->getLabel()); mothurOutEndLine();
+               m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                
                //for each bin in the list vector
                for (int i = 0; i < list->getNumBins(); i++) {
@@ -212,7 +218,7 @@ void GetListCountCommand::process(ListVector* list) {
                out.close();
        }
        catch(exception& e) {
-               errorOut(e, "GetListCountCommand", "process");
+               m->errorOut(e, "GetListCountCommand", "process");
                exit(1);
        }
 }
index bd9d20234c6943adba91be63d4e1569e1bdb225e..196d245002498043dd8a32d11de45c5e1eb7c0cb 100644 (file)
@@ -36,6 +36,7 @@ private:
        set<string> labels; //holds labels to be used
        string label, listfile, outputDir;
        ofstream out;
+       vector<string> outputNames;
        
        void process(ListVector*);
 };
index 935812b1cdc07a1e86b8bde1e7179f1fd8db8d13..46a04077b839ec7538f641336b9254961693eb0d 100644 (file)
@@ -36,13 +36,13 @@ inline bool compareGroup(repStruct left, repStruct right){
        return (left.group < right.group);      
 }
 //**********************************************************************************************************************
-GetOTURepCommand::GetOTURepCommand(string option){
+GetOTURepCommand::GetOTURepCommand(string option)  {
        try{
                globaldata = GlobalData::getInstance();
                abort = false;
                allLines = 1;
                labels.clear();
-               
+                               
                //allow user to run help
                if (option == "help") { 
                        help(); abort = true;
@@ -122,11 +122,11 @@ GetOTURepCommand::GetOTURepCommand(string option){
                        
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the get.oturep command."); mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the get.oturep command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
                
                        listfile = validParameter.validFile(parameters, "list", true);
-                       if (listfile == "not found") { mothurOut("list is a required parameter for the get.oturep command."); mothurOutEndLine(); abort = true; }
+                       if (listfile == "not found") { m->mothurOut("list is a required parameter for the get.oturep command."); m->mothurOutEndLine(); abort = true; }
                        else if (listfile == "not open") { abort = true; }      
                        
                        phylipfile = validParameter.validFile(parameters, "phylip", true);
@@ -143,8 +143,8 @@ GetOTURepCommand::GetOTURepCommand(string option){
                        if (namefile == "not open") { abort = true; }   
                        else if (namefile == "not found") { namefile = ""; }
                        
-                       if ((phylipfile == "") && (columnfile == "")) { mothurOut("When executing a get.oturep command you must enter a phylip or a column."); mothurOutEndLine(); abort = true; }
-                       else if ((phylipfile != "") && (columnfile != "")) { mothurOut("When executing a get.oturep command you must enter ONLY ONE of the following: phylip or column."); mothurOutEndLine(); abort = true; }
+                       if ((phylipfile == "") && (columnfile == "")) { m->mothurOut("When executing a get.oturep command you must enter a phylip or a column."); m->mothurOutEndLine(); abort = true; }
+                       else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When executing a get.oturep command you must enter ONLY ONE of the following: phylip or column."); m->mothurOutEndLine(); abort = true; }
                
                        if (columnfile != "") {  if (namefile == "") {  cout << "You need to provide a namefile if you are going to use the column format." << endl; abort = true; }  }
 
@@ -169,12 +169,12 @@ GetOTURepCommand::GetOTURepCommand(string option){
                        
                        sorted = validParameter.validFile(parameters, "sorted", false);         if (sorted == "not found"){     sorted = "";    }
                        if ((sorted != "") && (sorted != "name") && (sorted != "bin") && (sorted != "size") && (sorted != "group")) {
-                               mothurOut(sorted + " is not a valid option for the sorted parameter. The only options are: name, bin, size and group. I will not sort."); mothurOutEndLine();
+                               m->mothurOut(sorted + " is not a valid option for the sorted parameter. The only options are: name, bin, size and group. I will not sort."); m->mothurOutEndLine();
                                sorted = "";
                        }
                        
                        if ((sorted == "group") && (groupfile == "")) {
-                               mothurOut("You must provide a groupfile to sort by group. I will not sort."); mothurOutEndLine();
+                               m->mothurOut("You must provide a groupfile to sort by group. I will not sort."); m->mothurOutEndLine();
                                sorted = "";
                        }
                        
@@ -190,7 +190,7 @@ GetOTURepCommand::GetOTURepCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "GetOTURepCommand");
+               m->errorOut(e, "GetOTURepCommand", "GetOTURepCommand");
                exit(1);
        }
 }
@@ -199,21 +199,21 @@ GetOTURepCommand::GetOTURepCommand(string option){
 
 void GetOTURepCommand::help(){
        try {
-               mothurOut("The get.oturep command parameters are phylip, column, list, fasta, name, group, large, cutoff, precision, sorted and label.  The fasta and list parameters are required, as well as phylip or column and name.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and is separated by dashes.\n");
-               mothurOut("The phylip or column parameter is required, but only one may be used.  If you use a column file the name filename is required. \n");
-               mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
-               mothurOut("The get.oturep command should be in the following format: get.oturep(phylip=yourDistanceMatrix, fasta=yourFastaFile, list=yourListFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n");
-               mothurOut("Example get.oturep(phylip=amazon.dist, fasta=amazon.fasta, list=amazon.fn.list, group=amazon.groups).\n");
-               mothurOut("The default value for label is all labels in your inputfile.\n");
-               mothurOut("The sorted parameter allows you to indicate you want the output sorted. You can sort by sequence name, bin number, bin size or group. The default is no sorting, but your options are name, number, size, or group.\n");
-               mothurOut("The large parameter allows you to indicate that your distance matrix is too large to fit in RAM.  The default value is false.\n");
-               mothurOut("The get.oturep command outputs a .fastarep and .rep.names file for each distance you specify, selecting one OTU representative for each bin.\n");
-               mothurOut("If you provide a groupfile, then it also appends the names of the groups present in that bin.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
+               m->mothurOut("The get.oturep command parameters are phylip, column, list, fasta, name, group, large, cutoff, precision, sorted and label.  The fasta and list parameters are required, as well as phylip or column and name.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and is separated by dashes.\n");
+               m->mothurOut("The phylip or column parameter is required, but only one may be used.  If you use a column file the name filename is required. \n");
+               m->mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
+               m->mothurOut("The get.oturep command should be in the following format: get.oturep(phylip=yourDistanceMatrix, fasta=yourFastaFile, list=yourListFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n");
+               m->mothurOut("Example get.oturep(phylip=amazon.dist, fasta=amazon.fasta, list=amazon.fn.list, group=amazon.groups).\n");
+               m->mothurOut("The default value for label is all labels in your inputfile.\n");
+               m->mothurOut("The sorted parameter allows you to indicate you want the output sorted. You can sort by sequence name, bin number, bin size or group. The default is no sorting, but your options are name, number, size, or group.\n");
+               m->mothurOut("The large parameter allows you to indicate that your distance matrix is too large to fit in RAM.  The default value is false.\n");
+               m->mothurOut("The get.oturep command outputs a .fastarep and .rep.names file for each distance you specify, selecting one OTU representative for each bin.\n");
+               m->mothurOut("If you provide a groupfile, then it also appends the names of the groups present in that bin.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "help");
+               m->errorOut(e, "GetOTURepCommand", "help");
                exit(1);
        }
 }
@@ -234,7 +234,7 @@ int GetOTURepCommand::execute(){
                        //read distance files
                        if (format == "column") { readMatrix = new ReadColumnMatrix(distFile); }        
                        else if (format == "phylip") { readMatrix = new ReadPhylipMatrix(distFile); }
-                       else { mothurOut("File format error."); mothurOutEndLine(); return 0;  }
+                       else { m->mothurOut("File format error."); m->mothurOutEndLine(); return 0;  }
                        
                        readMatrix->setCutoff(cutoff);
        
@@ -266,7 +266,7 @@ int GetOTURepCommand::execute(){
                        //process file and set up indexes
                        if (format == "column") { formatMatrix = new FormatColumnMatrix(distFile); }    
                        else if (format == "phylip") { formatMatrix = new FormatPhylipMatrix(distFile); }
-                       else { mothurOut("File format error."); mothurOutEndLine(); return 0;  }
+                       else { m->mothurOut("File format error."); m->mothurOutEndLine(); return 0;  }
                        
                        formatMatrix->setCutoff(cutoff);
        
@@ -308,7 +308,7 @@ int GetOTURepCommand::execute(){
                                        nameToIndex[names[j]] = i;
                                }
                        }
-               } else { mothurOut("error, no listvector."); mothurOutEndLine(); }
+               } else { m->mothurOut("error, no listvector."); m->mothurOutEndLine(); }
                
                fasta = new FastaMap();
                
@@ -336,7 +336,7 @@ int GetOTURepCommand::execute(){
                while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
                        if (allLines == 1 || labels.count(list->getLabel()) == 1){
-                                       mothurOut(list->getLabel() + "\t" + toString(list->size())); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel() + "\t" + toString(list->size())); m->mothurOutEndLine();
                                        error = process(list);
                                        if (error == 1) { return 0; } //there is an error in hte input files, abort command
                                        
@@ -349,7 +349,7 @@ int GetOTURepCommand::execute(){
                                        
                                        delete list;
                                        list = input->getListVector(lastLabel);
-                                       mothurOut(list->getLabel() + "\t" + toString(list->size())); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel() + "\t" + toString(list->size())); m->mothurOutEndLine();
                                        error = process(list);
                                        if (error == 1) { return 0; } //there is an error in hte input files, abort command
                                        
@@ -369,12 +369,12 @@ int GetOTURepCommand::execute(){
                //output error messages about any remaining user labels
                bool needToRun = false;
                for (set<string>::iterator it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(list->getLabel()) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -382,7 +382,7 @@ int GetOTURepCommand::execute(){
                if (needToRun == true)  {
                        if (list != NULL) {     delete list;    }
                        list = input->getListVector(lastLabel);
-                       mothurOut(list->getLabel() + "\t" + toString(list->size())); mothurOutEndLine();
+                       m->mothurOut(list->getLabel() + "\t" + toString(list->size())); m->mothurOutEndLine();
                        error = process(list);
                        delete list;
                        if (error == 1) { return 0; } //there is an error in hte input files, abort command
@@ -402,10 +402,15 @@ int GetOTURepCommand::execute(){
                        delete groupMap;  globaldata->gGroupmap = NULL;
                }
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "execute");
+               m->errorOut(e, "GetOTURepCommand", "execute");
                exit(1);
        }
 }
@@ -439,7 +444,7 @@ void GetOTURepCommand::readNamesFile() {
 
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "readNamesFile");
+               m->errorOut(e, "GetOTURepCommand", "readNamesFile");
                exit(1);
        }
 }
@@ -461,7 +466,7 @@ string GetOTURepCommand::findRep(int bin, string& group, ListVector* thisList, i
                        for (size_t i = 0; i < names.size(); i++) {
                                string groupName = groupMap->getGroup(names[i]);
                                if (groupName == "not found") {  
-                                       mothurOut(names[i] + " is missing from your group file. Please correct. "); mothurOutEndLine();
+                                       m->mothurOut(names[i] + " is missing from your group file. Please correct. "); m->mothurOutEndLine();
                                        groupError = true;
                                } else {
                                        groups[groupName] = groupName;
@@ -539,7 +544,7 @@ string GetOTURepCommand::findRep(int bin, string& group, ListVector* thisList, i
                }
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "FindRep");
+               m->errorOut(e, "GetOTURepCommand", "FindRep");
                exit(1);
        }
 }
@@ -554,10 +559,12 @@ int GetOTURepCommand::process(ListVector* processList) {
                string outputFileName = outputDir + getRootName(getSimpleName(listfile)) + processList->getLabel() + ".rep.fasta";
                openOutputFile(outputFileName, out);
                vector<repStruct> reps;
+               outputNames.push_back(outputFileName);
                
                ofstream newNamesOutput;
                string outputNamesFile = outputDir + getRootName(getSimpleName(listfile)) + processList->getLabel() + ".rep.names";
                openOutputFile(outputNamesFile, newNamesOutput);
+               outputNames.push_back(outputNamesFile);
                
                //for each bin in the list vector
                for (int i = 0; i < processList->size(); i++) {
@@ -585,7 +592,7 @@ int GetOTURepCommand::process(ListVector* processList) {
                                        reps.push_back(newRep);
                                }
                        }else { 
-                               mothurOut(nameRep + " is missing from your fasta or name file. Please correct. "); mothurOutEndLine(); 
+                               m->mothurOut(nameRep + " is missing from your fasta or name file. Please correct. "); m->mothurOutEndLine(); 
                                remove(outputFileName.c_str());
                                remove(outputNamesFile.c_str());
                                return 1;
@@ -617,7 +624,7 @@ int GetOTURepCommand::process(ListVector* processList) {
 
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "process");
+               m->errorOut(e, "GetOTURepCommand", "process");
                exit(1);
        }
 }
@@ -647,7 +654,7 @@ SeqMap GetOTURepCommand::getMap(int row) {
                return rowMap;
        }
        catch(exception& e) {
-               errorOut(e, "GetOTURepCommand", "getMap");
+               m->errorOut(e, "GetOTURepCommand", "getMap");
                exit(1);
        }
 }
index ceea8988a2bc0963abaa4d18d898729d88c8960a..7890d93db045be399a2854d5d17b314fb748358d 100644 (file)
@@ -59,6 +59,7 @@ private:
        bool abort, allLines, groupError, large;
        set<string> labels; //holds labels to be used
        map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
+       vector<string> outputNames;
        float cutoff;
        int precision;
        vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
index df9754b14219548719305cd53498b5d46b05d42c..5a192c5066d6f23921e356ed7a2785abbd967631 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-GetRAbundCommand::GetRAbundCommand(string option){
+GetRAbundCommand::GetRAbundCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -43,7 +43,7 @@ GetRAbundCommand::GetRAbundCommand(string option){
                        }
                        
                        //make sure the user has already run the read.otu command
-                       if (globaldata->getListFile() == "") { mothurOut("You must read a listfile before you can use the get.rabund command."); mothurOutEndLine(); abort = true; }
+                       if (globaldata->getListFile() == "") { m->mothurOut("You must read a listfile before you can use the get.rabund command."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -73,7 +73,7 @@ GetRAbundCommand::GetRAbundCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "GetRAbundCommand", "GetRAbundCommand");
+               m->errorOut(e, "GetRAbundCommand", "GetRAbundCommand");
                exit(1);
        }                       
 }
@@ -81,18 +81,18 @@ GetRAbundCommand::GetRAbundCommand(string option){
 
 void GetRAbundCommand::help(){
        try {
-               mothurOut("The get.rabund command can only be executed after a successful read.otu of a listfile.\n");
-               mothurOut("The get.rabund command parameters are label and sorted.  No parameters are required.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like included in your .rabund file, and are separated by dashes.\n");
-               mothurOut("The sorted parameters allows you to print the rabund results sorted by abundance or not.  The default is sorted.\n");
-               mothurOut("The get.rabund command should be in the following format: get.rabund(label=yourLabels, sorted=yourSorted).\n");
-               mothurOut("Example get.rabund(sorted=F).\n");
-               mothurOut("The default value for label is all labels in your inputfile.\n");
-               mothurOut("The get.rabund command outputs a .rabund file containing the lines you selected.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n");
+               m->mothurOut("The get.rabund command can only be executed after a successful read.otu of a listfile.\n");
+               m->mothurOut("The get.rabund command parameters are label and sorted.  No parameters are required.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like included in your .rabund file, and are separated by dashes.\n");
+               m->mothurOut("The sorted parameters allows you to print the rabund results sorted by abundance or not.  The default is sorted.\n");
+               m->mothurOut("The get.rabund command should be in the following format: get.rabund(label=yourLabels, sorted=yourSorted).\n");
+               m->mothurOut("Example get.rabund(sorted=F).\n");
+               m->mothurOut("The default value for label is all labels in your inputfile.\n");
+               m->mothurOut("The get.rabund command outputs a .rabund file containing the lines you selected.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetRAbundCommand", "help");
+               m->errorOut(e, "GetRAbundCommand", "help");
                exit(1);
        }
 }
@@ -125,7 +125,7 @@ int GetRAbundCommand::execute(){
                while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
                        if(allLines == 1 || labels.count(list->getLabel()) == 1){
-                                       mothurOut(list->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                                        rabund = new RAbundVector();                            
                                        *rabund = (list->getRAbundVector());
                                        
@@ -144,7 +144,7 @@ int GetRAbundCommand::execute(){
                                        delete list;
                                        list = input->getListVector(lastLabel);
                                        
-                                       mothurOut(list->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                                        rabund = new RAbundVector();
                                        *rabund = (list->getRAbundVector());
                                        
@@ -170,12 +170,12 @@ int GetRAbundCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -184,7 +184,7 @@ int GetRAbundCommand::execute(){
                        if (list != NULL) {     delete list;    }
                        list = input->getListVector(lastLabel);
                        
-                       mothurOut(list->getLabel()); mothurOutEndLine();
+                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                        rabund = new RAbundVector();
                        *rabund = (list->getRAbundVector());
                        
@@ -194,13 +194,19 @@ int GetRAbundCommand::execute(){
                        delete rabund;
                        delete list;
                }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(filename); m->mothurOutEndLine();  
+               m->mothurOutEndLine();
 
+               
                out.close(); 
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "GetRAbundCommand", "execute");
+               m->errorOut(e, "GetRAbundCommand", "execute");
                exit(1);
        }
 }
index 10b998e73d78a3af0d41c3106743c52e6235359b..d9197fe7724b32ca0f6789032a7ea98246bc69a5 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-GetSAbundCommand::GetSAbundCommand(string option){
+GetSAbundCommand::GetSAbundCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -43,7 +43,7 @@ GetSAbundCommand::GetSAbundCommand(string option){
                        }
 
                        //make sure the user has already run the read.otu command
-                       if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "")) { mothurOut("You must read a list or rabund before you can use the get.sabund command."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "")) { m->mothurOut("You must read a list or rabund before you can use the get.sabund command."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -68,7 +68,7 @@ GetSAbundCommand::GetSAbundCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSAbundCommand", "GetSAbundCommand");
+               m->errorOut(e, "GetSAbundCommand", "GetSAbundCommand");
                exit(1);
        }
 }
@@ -76,17 +76,17 @@ GetSAbundCommand::GetSAbundCommand(string option){
 
 void GetSAbundCommand::help(){
        try {
-               mothurOut("The get.sabund command can only be executed after a successful read.otu of a listfile or rabundfile.\n");
-               mothurOut("The get.sabund command parameters is label.  No parameters are required.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like included in your .sabund file, and are separated by dashes.\n");
-               mothurOut("The get.sabund command should be in the following format: get.sabund(label=yourLabels).\n");
-               mothurOut("Example get.sabund().\n");
-               mothurOut("The default value for label is all labels in your inputfile.\n");
-               mothurOut("The get.sabund command outputs a .sabund file containing the labels you selected.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
+               m->mothurOut("The get.sabund command can only be executed after a successful read.otu of a listfile or rabundfile.\n");
+               m->mothurOut("The get.sabund command parameters is label.  No parameters are required.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like included in your .sabund file, and are separated by dashes.\n");
+               m->mothurOut("The get.sabund command should be in the following format: get.sabund(label=yourLabels).\n");
+               m->mothurOut("Example get.sabund().\n");
+               m->mothurOut("The default value for label is all labels in your inputfile.\n");
+               m->mothurOut("The get.sabund command outputs a .sabund file containing the labels you selected.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetSAbundCommand", "help");
+               m->errorOut(e, "GetSAbundCommand", "help");
                exit(1);
        }
 }
@@ -118,7 +118,7 @@ int GetSAbundCommand::execute(){
                while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
                        if(allLines == 1 || labels.count(order->getLabel()) == 1){
-                                       mothurOut(order->getLabel());  mothurOutEndLine();
+                                       m->mothurOut(order->getLabel());  m->mothurOutEndLine();
                                        sabund = new SAbundVector();
                                        *sabund = (order->getSAbundVector());
                                        sabund->print(out);
@@ -134,7 +134,7 @@ int GetSAbundCommand::execute(){
                                        delete order;           
                                        order = (input->getOrderVector(lastLabel));
                                        
-                                       mothurOut(order->getLabel());  mothurOutEndLine();
+                                       m->mothurOut(order->getLabel());  m->mothurOutEndLine();
                                        sabund = new SAbundVector();
                                        *sabund = (order->getSAbundVector());
                                        sabund->print(out);
@@ -158,12 +158,12 @@ int GetSAbundCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + ".");  mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + ".");  m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + ".");  mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + ".");  m->mothurOutEndLine();
                        }
                }
                
@@ -172,7 +172,7 @@ int GetSAbundCommand::execute(){
                        if (order != NULL) {    delete order;   }
                        order = (input->getOrderVector(lastLabel));
                        
-                       mothurOut(order->getLabel());  mothurOutEndLine();
+                       m->mothurOut(order->getLabel());  m->mothurOutEndLine();
                        sabund = new SAbundVector();
                        *sabund = (order->getSAbundVector());
                        sabund->print(out);
@@ -182,11 +182,17 @@ int GetSAbundCommand::execute(){
                globaldata->gorder = NULL;
 
                out.close();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(filename); m->mothurOutEndLine();  
+               m->mothurOutEndLine();
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "GetSAbundCommand", "execute");
+               m->errorOut(e, "GetSAbundCommand", "execute");
                exit(1);
        }
 }
index d63dc79974ac007f504f7f1928ed8d0f031dcfe3..ec0539093be68f0581b12f24170f07f726b1ee29 100644 (file)
 
 //**********************************************************************************************************************
 
-GetSeqsCommand::GetSeqsCommand(string option){
+GetSeqsCommand::GetSeqsCommand(string option)  {
        try {
                abort = false;
-               
+                               
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -97,7 +97,7 @@ GetSeqsCommand::GetSeqsCommand(string option){
                        //check for required parameters
                        accnosfile = validParameter.validFile(parameters, "accnos", true);
                        if (accnosfile == "not open") { abort = true; }
-                       else if (accnosfile == "not found") {  accnosfile = "";  mothurOut("You must provide an accnos file."); mothurOutEndLine(); abort = true; }     
+                       else if (accnosfile == "not found") {  accnosfile = "";  m->mothurOut("You must provide an accnos file."); m->mothurOutEndLine(); abort = true; }       
                        
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
@@ -119,17 +119,17 @@ GetSeqsCommand::GetSeqsCommand(string option){
                        if (listfile == "not open") { abort = true; }
                        else if (listfile == "not found") {  listfile = "";  }
                        
-                       if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == ""))  { mothurOut("You must provide one of the following: fasta, name, group, alignreport or listfile."); mothurOutEndLine(); abort = true; }
+                       if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == ""))  { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport or listfile."); m->mothurOutEndLine(); abort = true; }
                        
                        int okay = 2;
                        if (outputDir != "") { okay++; }
                        
-                       if (parameters.size() > okay) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport or listfile."); mothurOutEndLine(); abort = true;  }
+                       if (parameters.size() > okay) { m->mothurOut("You may only enter one of the following: fasta, name, group, alignreport or listfile."); m->mothurOutEndLine(); abort = true;  }
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
+               m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
                exit(1);
        }
 }
@@ -137,15 +137,15 @@ GetSeqsCommand::GetSeqsCommand(string option){
 
 void GetSeqsCommand::help(){
        try {
-               mothurOut("The get.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
-               mothurOut("It outputs a file containing only the sequences in the .accnos file.\n");
-               mothurOut("The get.seqs command parameters are accnos, fasta, name, group, list and alignreport.  You must provide accnos and one of the other parameters.\n");
-               mothurOut("The get.seqs command should be in the following format: get.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
-               mothurOut("Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The get.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
+               m->mothurOut("It outputs a file containing only the sequences in the .accnos file.\n");
+               m->mothurOut("The get.seqs command parameters are accnos, fasta, name, group, list and alignreport.  You must provide accnos and one of the other parameters.\n");
+               m->mothurOut("The get.seqs command should be in the following format: get.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
+               m->mothurOut("Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "help");
+               m->errorOut(e, "GetSeqsCommand", "help");
                exit(1);
        }
 }
@@ -167,11 +167,18 @@ int GetSeqsCommand::execute(){
                else if (alignfile != "")       {               readAlign();    }
                else if (listfile != "")        {               readList();             }
                
+               if (outputNames.size() != 0) {
+                       m->mothurOutEndLine();
+                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+                       m->mothurOutEndLine();
+               }
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "execute");
+               m->errorOut(e, "GetSeqsCommand", "execute");
                exit(1);
        }
 }
@@ -184,6 +191,7 @@ void GetSeqsCommand::readFasta(){
                ofstream out;
                openOutputFile(outputFileName, out);
                
+               
                ifstream in;
                openInputFile(fastafile, in);
                string name;
@@ -210,13 +218,13 @@ void GetSeqsCommand::readFasta(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else {  outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readFasta");
+               m->errorOut(e, "GetSeqsCommand", "readFasta");
                exit(1);
        }
 }
@@ -275,13 +283,13 @@ void GetSeqsCommand::readList(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else {  outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readList");
+               m->errorOut(e, "GetSeqsCommand", "readList");
                exit(1);
        }
 }
@@ -292,6 +300,7 @@ void GetSeqsCommand::readName(){
                string outputFileName = outputDir + getRootName(getSimpleName(namefile)) + "pick" +  getExtension(namefile);
                ofstream out;
                openOutputFile(outputFileName, out);
+               
 
                ifstream in;
                openInputFile(namefile, in);
@@ -357,13 +366,13 @@ void GetSeqsCommand::readName(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else {  outputNames.push_back(outputFileName); }
                
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readName");
+               m->errorOut(e, "GetSeqsCommand", "readName");
                exit(1);
        }
 }
@@ -375,6 +384,7 @@ void GetSeqsCommand::readGroup(){
                string outputFileName = outputDir + getRootName(getSimpleName(groupfile)) + "pick" + getExtension(groupfile);
                ofstream out;
                openOutputFile(outputFileName, out);
+               
 
                ifstream in;
                openInputFile(groupfile, in);
@@ -402,13 +412,13 @@ void GetSeqsCommand::readGroup(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else {  outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readGroup");
+               m->errorOut(e, "GetSeqsCommand", "readGroup");
                exit(1);
        }
 }
@@ -421,6 +431,7 @@ void GetSeqsCommand::readAlign(){
                string outputFileName = outputDir + getRootName(getSimpleName(alignfile)) + "pick.align.report";
                ofstream out;
                openOutputFile(outputFileName, out);
+               
 
                ifstream in;
                openInputFile(alignfile, in);
@@ -468,13 +479,13 @@ void GetSeqsCommand::readAlign(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else {  outputNames.push_back(outputFileName); }
                
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readAlign");
+               m->errorOut(e, "GetSeqsCommand", "readAlign");
                exit(1);
        }
 }
@@ -498,7 +509,7 @@ void GetSeqsCommand::readAccnos(){
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSeqsCommand", "readAccnos");
+               m->errorOut(e, "GetSeqsCommand", "readAccnos");
                exit(1);
        }
 }
index 24f3968786784965e343f88aef300cad80c54eb4..809109c486de9f00b39091b863da8a23dfc95a96 100644 (file)
@@ -16,13 +16,14 @@ class GetSeqsCommand : public Command {
        
        public:
        
-               GetSeqsCommand(string); 
+               GetSeqsCommand(string);
                ~GetSeqsCommand(){};
                int execute();
                void help();    
                
        private:
                set<string> names;
+               vector<string> outputNames;
                string accnosfile, fastafile, namefile, groupfile, alignfile, listfile, outputDir;
                bool abort;
                
index 049758943550859e7df4a933ea427421be450e85..2e553d96db111a7a0828af855eb7251081014131 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-GetSharedOTUCommand::GetSharedOTUCommand(string option){
+GetSharedOTUCommand::GetSharedOTUCommand(string option)  {
        try {
        
                globaldata = GlobalData::getInstance();
@@ -83,7 +83,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option){
                        if (groupfile == "not open") { abort = true; }  
                        else if (groupfile == "not found") { groupfile = ""; }
                                                
-                       if ((listfile == "") || (groupfile == "")) { mothurOut("The list and group parameters are required."); mothurOutEndLine(); abort = true; }
+                       if ((listfile == "") || (groupfile == "")) { m->mothurOut("The list and group parameters are required."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -123,7 +123,7 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "GetSharedOTUCommand", "GetSharedOTUCommand");
+               m->errorOut(e, "GetSharedOTUCommand", "GetSharedOTUCommand");
                exit(1);
        }
 }
@@ -131,24 +131,24 @@ GetSharedOTUCommand::GetSharedOTUCommand(string option){
 
 void GetSharedOTUCommand::help(){
        try {
-               mothurOut("The get.sharedseqs command parameters are list, group, label, unique, shared, output and fasta.  The list and group parameters are required.\n");
-               mothurOut("The label parameter allows you to select what distance levels you would like output files for, and are separated by dashes.\n");
-               mothurOut("The unique and shared parameters allow you to select groups you would like to know the shared info for, and are separated by dashes.\n");
-               mothurOut("If you enter your groups under the unique parameter mothur will return the otus that contain ONLY sequences from those groups.\n");
-               mothurOut("If you enter your groups under the shared parameter mothur will return the otus that contain sequences from those groups and may also contain sequences from other groups.\n");
-               mothurOut("If you do not enter any groups then the get.sharedseqs command will return sequences that are unique to all groups in your group file.\n");
-               mothurOut("The fasta parameter allows you to input a fasta file and outputs a fasta file for each distance level containing only the sequences that are in OTUs shared by the groups specified.\n");
-               mothurOut("The output parameter allows you to output the list of names without the group and bin number added. \n");
-               mothurOut("With this option you can use the names file as an input in get.seqs and remove.seqs commands. To do this enter output=accnos. \n");
-               mothurOut("The get.sharedseqs command outputs a .names file for each distance level containing a list of sequences in the OTUs shared by the groups specified.\n");
-               mothurOut("The get.sharedseqs command should be in the following format: get.sabund(label=yourLabels, groups=yourGroups, fasta=yourFastafile, output=yourOutput).\n");
-               mothurOut("Example get.sharedseqs(list=amazon.fn.list, label=unique-0.01, group=forest-pasture, fasta=amazon.fasta, output=accnos).\n");
-               mothurOut("The output to the screen is the distance and the number of otus at that distance for the groups you specified.\n");
-               mothurOut("The default value for label is all labels in your inputfile. The default for groups is all groups in your file.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
+               m->mothurOut("The get.sharedseqs command parameters are list, group, label, unique, shared, output and fasta.  The list and group parameters are required.\n");
+               m->mothurOut("The label parameter allows you to select what distance levels you would like output files for, and are separated by dashes.\n");
+               m->mothurOut("The unique and shared parameters allow you to select groups you would like to know the shared info for, and are separated by dashes.\n");
+               m->mothurOut("If you enter your groups under the unique parameter mothur will return the otus that contain ONLY sequences from those groups.\n");
+               m->mothurOut("If you enter your groups under the shared parameter mothur will return the otus that contain sequences from those groups and may also contain sequences from other groups.\n");
+               m->mothurOut("If you do not enter any groups then the get.sharedseqs command will return sequences that are unique to all groups in your group file.\n");
+               m->mothurOut("The fasta parameter allows you to input a fasta file and outputs a fasta file for each distance level containing only the sequences that are in OTUs shared by the groups specified.\n");
+               m->mothurOut("The output parameter allows you to output the list of names without the group and bin number added. \n");
+               m->mothurOut("With this option you can use the names file as an input in get.seqs and remove.seqs commands. To do this enter output=accnos. \n");
+               m->mothurOut("The get.sharedseqs command outputs a .names file for each distance level containing a list of sequences in the OTUs shared by the groups specified.\n");
+               m->mothurOut("The get.sharedseqs command should be in the following format: get.sabund(label=yourLabels, groups=yourGroups, fasta=yourFastafile, output=yourOutput).\n");
+               m->mothurOut("Example get.sharedseqs(list=amazon.fn.list, label=unique-0.01, group=forest-pasture, fasta=amazon.fasta, output=accnos).\n");
+               m->mothurOut("The output to the screen is the distance and the number of otus at that distance for the groups you specified.\n");
+               m->mothurOut("The default value for label is all labels in your inputfile. The default for groups is all groups in your file.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "GetSharedOTUCommand", "help");
+               m->errorOut(e, "GetSharedOTUCommand", "help");
                exit(1);
        }
 }
@@ -211,7 +211,7 @@ int GetSharedOTUCommand::execute(){
                        list = new ListVector(in);
                        
                        if(allLines == 1 || labels.count(list->getLabel()) == 1){                       
-                               mothurOut(list->getLabel()); 
+                               m->mothurOut(list->getLabel()); 
                                process(list);
                                
                                processedLabels.insert(list->getLabel());
@@ -221,7 +221,7 @@ int GetSharedOTUCommand::execute(){
                        if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
                                        string saveLabel = list->getLabel();
                                        
-                                       mothurOut(lastlist->getLabel()); 
+                                       m->mothurOut(lastlist->getLabel()); 
                                        process(lastlist);
                                        
                                        processedLabels.insert(lastlist->getLabel());
@@ -243,18 +243,18 @@ int GetSharedOTUCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
                //run last label if you need to
                if (needToRun == true)  {
-                               mothurOut(lastlist->getLabel()); 
+                               m->mothurOut(lastlist->getLabel()); 
                                process(lastlist);
                                        
                                processedLabels.insert(lastlist->getLabel());
@@ -266,11 +266,19 @@ int GetSharedOTUCommand::execute(){
                globaldata->Groups.clear();  
                
                if (lastlist != NULL) {         delete lastlist;        }
+               
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
+
                return 0;
        }
 
        catch(exception& e) {
-               errorOut(e, "GetSharedOTUCommand", "execute");
+               m->errorOut(e, "GetSharedOTUCommand", "execute");
                exit(1);
        }
 }
@@ -300,8 +308,8 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                        bool uniqueOTU = true;
                        
                        map<string, int> atLeastOne;
-                       for (int m = 0; m < Groups.size(); m++) {
-                               atLeastOne[Groups[m]] = 0;
+                       for (int f = 0; f < Groups.size(); f++) {
+                               atLeastOne[Groups[f]] = 0;
                        }
                        
                        vector<string> namesOfSeqsInThisBin;
@@ -317,7 +325,7 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                                        namesOfSeqsInThisBin.push_back((name + "\t" + seqGroup + "\t" + toString(i+1)));
                                }else {  namesOfSeqsInThisBin.push_back(name);  }
                                
-                               if (seqGroup == "not found") { mothurOut(name + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1);  }
+                               if (seqGroup == "not found") { m->mothurOut(name + " is not in your groupfile. Please correct."); m->mothurOutEndLine(); exit(1);  }
                                
                                //is this seq in one of hte groups we care about
                                it = groupFinder.find(seqGroup);
@@ -331,7 +339,7 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                                namesOfSeqsInThisBin.push_back((names + "\t" + seqGroup + "\t" + toString(i+1)));
                        }else {  namesOfSeqsInThisBin.push_back(names); }
                        
-                       if (seqGroup == "not found") { mothurOut(names + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1);  }
+                       if (seqGroup == "not found") { m->mothurOut(names + " is not in your groupfile. Please correct."); m->mothurOutEndLine(); exit(1);  }
                        
                        //is this seq in one of hte groups we care about
                        it = groupFinder.find(seqGroup);
@@ -382,8 +390,11 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                        }
                        
                        outputString += groupString + ".";
-                       mothurOut(outputString); mothurOutEndLine();
-               }else { mothurOut("\t" + toString(num)); mothurOutEndLine(); }
+                       m->mothurOut(outputString); m->mothurOutEndLine();
+               }else { 
+                       m->mothurOut("\t" + toString(num)); m->mothurOutEndLine(); 
+                       outputNames.push_back(outputFileNames);
+               }
                
                //if fasta file provided output new fasta file
                if ((fastafile != "") && wroteSomething) {
@@ -391,6 +402,7 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                        string outputFileFasta = outputDir + getRootName(getSimpleName(fastafile)) + shared->getLabel() + userGroups + ".shared.fasta";
                        ofstream outFasta;
                        openOutputFile(outputFileFasta, outFasta);
+                       outputNames.push_back(outputFileFasta);
                        
                        for (int k = 0; k < seqs.size(); k++) {
                                //if this is a sequence we want, output it
@@ -413,7 +425,7 @@ void GetSharedOTUCommand::process(ListVector* shared) {
                
        }
        catch(exception& e) {
-               errorOut(e, "GetSharedOTUCommand", "process");
+               m->errorOut(e, "GetSharedOTUCommand", "process");
                exit(1);
        }
 }
index 5b5516c3a3d6850aa36cce33b104c888872b9137..c12cc13ab074abcd78b259ce9fff9606ecc3509d 100644 (file)
@@ -39,6 +39,7 @@ class GetSharedOTUCommand : public Command {
                map<string, string> groupFinder;
                map<string, string>::iterator it;
                vector<Sequence> seqs;
+               vector<string> outputNames;
                
                void process(ListVector*);
                
index 8f8d1ad5da1addc5dac09f68c6dec5a5b99c1568..58d00ffbee1166e3422cf070978c8c97fa964cc1 100644 (file)
@@ -47,6 +47,7 @@ void GlobalData::setFormat(string Format)             {       format = Format;                }
 
 /******************************************************/
 GlobalData::GlobalData() {
+       m = MothurOut::getInstance();
        //option definitions should go here...
        clear();
        gListVector = NULL;             
@@ -126,7 +127,7 @@ void GlobalData::newRead() {
                        names.clear();
        }
        catch(exception& e) {
-               errorOut(e, "GlobalData", "newRead");
+               m->errorOut(e, "GlobalData", "newRead");
                exit(1);
        }
 }
@@ -152,7 +153,7 @@ GlobalData::~GlobalData() {
                if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
        }
        catch(exception& e) {
-               errorOut(e, "GlobalData", "~GlobalData");
+               m->errorOut(e, "GlobalData", "~GlobalData");
                exit(1);
        }
 }
index f3b9b9ac148131b186ed1f94da55706714cd6c6d..b4b8e0d33912acdd9790a49bc276dc8deef4d6d8 100644 (file)
@@ -84,7 +84,7 @@ public:
        void newRead();
        
 private:
-
+       MothurOut* m;
        string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, treefile, sharedfile, format, distfile;
 
        static GlobalData* _uniqueInstance;
index 8e823e4c8c3ed513ab2f7e90e44cb6c2de875b08..75baa7b0d2befb61d058853bcc7b959fe6b4b317 100644 (file)
@@ -26,7 +26,7 @@ EstOutput GoodsCoverage::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "GoodsCoverage", "getValues");
+               m->errorOut(e, "GoodsCoverage", "getValues");
                exit(1);
        }
 }
index f6fef1d6baeac3e950c5afbfa94ce4859496eb44..ea27df07068a5e2060d3a1be4220a9b2de57822c 100644 (file)
@@ -25,8 +25,8 @@
 
 /**************************************************************************************************/
 
-GotohOverlap::GotohOverlap(float gO, float gE, float m, float mm, int r) :
-       gapOpen(gO), gapExtend(gE), match(m), mismatch(mm), Alignment(r) {
+GotohOverlap::GotohOverlap(float gO, float gE, float f, float mm, int r) :
+       gapOpen(gO), gapExtend(gE), match(f), mismatch(mm), Alignment(r) {
        
        try {
                for(int i=1;i<nCols;i++){                               //      we initialize the dynamic programming matrix by setting the pointers in
@@ -43,7 +43,7 @@ GotohOverlap::GotohOverlap(float gO, float gE, float m, float mm, int r) :
                
        }
        catch(exception& e) {
-               errorOut(e, "GotohOverlap", "GotohOverlap");
+               m->errorOut(e, "GotohOverlap", "GotohOverlap");
                exit(1);
        }
 }
@@ -94,7 +94,7 @@ void GotohOverlap::align(string A, string B){
                
        }
        catch(exception& e) {
-               errorOut(e, "GotohOverlap", "align");
+               m->errorOut(e, "GotohOverlap", "align");
                exit(1);
        }
 }
index 598e301648978ab642274edb69ffa41bbea6f205..8d0662f9c404cb05d4cfed74596a33284d5235d9 100644 (file)
@@ -12,6 +12,7 @@
 /************************************************************/
 
  GroupMap::GroupMap(string filename) {
+       m = MothurOut::getInstance();
        groupFileName = filename;
        openInputFile(filename, fileHandle);
        index = 0;
@@ -33,7 +34,7 @@ int GroupMap::readMap() {
                        
                        it = groupmap.find(seqName);
                        
-                       if (it != groupmap.end()) { error = 1; mothurOut("Your groupfile contains more than 1 sequence named " + seqName + ", sequence names must be unique. Please correct."); mothurOutEndLine();  }
+                       if (it != groupmap.end()) { error = 1; m->mothurOut("Your groupfile contains more than 1 sequence named " + seqName + ", sequence names must be unique. Please correct."); m->mothurOutEndLine();  }
                        else {
                                groupmap[seqName] = seqGroup;   //store data in map
                                seqsPerGroup[seqGroup]++;  //increment number of seqs in that group
@@ -89,7 +90,7 @@ bool GroupMap::isValidGroup(string groupname) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "GroupMap", "isValidGroup");
+               m->errorOut(e, "GroupMap", "isValidGroup");
                exit(1);
        }
 }
@@ -107,7 +108,7 @@ int GroupMap::getNumSeqs(string group) {
                
        }
        catch(exception& e) {
-               errorOut(e, "GroupMap", "getNumSeqs");
+               m->errorOut(e, "GroupMap", "getNumSeqs");
                exit(1);
        }
 }
@@ -125,7 +126,7 @@ vector<string> GroupMap::getNamesSeqs(){
                return names;
        }
        catch(exception& e) {
-               errorOut(e, "GroupMap", "getNamesSeqs");
+               m->errorOut(e, "GroupMap", "getNamesSeqs");
                exit(1);
        }
 }
index a99ad119db44c2fd3bb6f78b696fc2d9ddf170af..8a1cfff6f660e0042f8a44784e8abff7864c5c2e 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 /* This class is a representation of the groupfile.  It is used by all the shared commands to determine what group a 
        certain sequence belongs to. */
@@ -31,6 +32,7 @@ public:
        int getNumSeqs(string); //return the number of seqs in a given group
                        
 private:
+       MothurOut* m;
        ifstream fileHandle;
        string groupFileName;
        int index;
index ee6040bb8802b36a6728a8abcd7dee7c7e3f2001..7da10a271125fadf7e4833ea37e68ce24cfcd16f 100644 (file)
@@ -13,8 +13,9 @@
 #include "sparsematrix.hpp"
 
 /***********************************************************************/
-HCluster::HCluster(RAbundVector* rav, ListVector* lv, string m, string d, NameAssignment* n, float c) :  rabund(rav), list(lv), method(m), distfile(d), nameMap(n), cutoff(c) {
+HCluster::HCluster(RAbundVector* rav, ListVector* lv, string ms, string d, NameAssignment* n, float c) :  rabund(rav), list(lv), method(ms), distfile(d), nameMap(n), cutoff(c) {
        try {
+               m = MothurOut::getInstance();
                mapWanted = false;
                exitedBreak = false; 
                numSeqs = list->getNumSeqs();
@@ -32,7 +33,7 @@ HCluster::HCluster(RAbundVector* rav, ListVector* lv, string m, string d, NameAs
                }
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "HCluster");
+               m->errorOut(e, "HCluster", "HCluster");
                exit(1);
        }
 }
@@ -49,7 +50,7 @@ void HCluster::clusterBins(){
                //cout << '\t' << rabund->get(clusterArray[smallRow].smallChild) << '\t' << rabund->get(clusterArray[smallCol].smallChild) << endl;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "clusterBins");
+               m->errorOut(e, "HCluster", "clusterBins");
                exit(1);
        }
 
@@ -71,7 +72,7 @@ void HCluster::clusterNames(){
 
     }
        catch(exception& e) {
-               errorOut(e, "HCluster", "clusterNames");
+               m->errorOut(e, "HCluster", "clusterNames");
                exit(1);
        }
 
@@ -86,7 +87,7 @@ int HCluster::getUpmostParent(int node){
                return node;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getUpmostParent");
+               m->errorOut(e, "HCluster", "getUpmostParent");
                exit(1);
        }
 }
@@ -116,7 +117,7 @@ void HCluster::printInfo(){
                
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getUpmostParent");
+               m->errorOut(e, "HCluster", "getUpmostParent");
                exit(1);
        }
 }
@@ -184,7 +185,7 @@ int HCluster::makeActive() {
                return linkValue;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "makeActive");
+               m->errorOut(e, "HCluster", "makeActive");
                exit(1);
        }
 }
@@ -253,7 +254,7 @@ void HCluster::updateArrayandLinkTable() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "updateArrayandLinkTable");
+               m->errorOut(e, "HCluster", "updateArrayandLinkTable");
                exit(1);
        }
 }
@@ -299,14 +300,14 @@ bool HCluster::update(int row, int col, float distance){
                //printInfo();
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "update");
+               m->errorOut(e, "HCluster", "update");
                exit(1);
        }
 }
 /***********************************************************************/
-void HCluster::setMapWanted(bool m)  {  
+void HCluster::setMapWanted(bool ms)  {  
        try {
-               mapWanted = m;
+               mapWanted = ms;
                
                //initialize map
                for (int i = 0; i < list->getNumBins(); i++) {
@@ -327,7 +328,7 @@ void HCluster::setMapWanted(bool m)  {
                
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "setMapWanted");
+               m->errorOut(e, "HCluster", "setMapWanted");
                exit(1);
        }
 }
@@ -348,7 +349,7 @@ try {
                seq2Bin[names] = clusterArray[smallCol].smallChild;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "updateMap");
+               m->errorOut(e, "HCluster", "updateMap");
                exit(1);
        }
 }
@@ -366,7 +367,7 @@ vector<seqDist> HCluster::getSeqs(){
                return sameSeqs;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getSeqs");
+               m->errorOut(e, "HCluster", "getSeqs");
                exit(1);
        }
 }
@@ -424,7 +425,7 @@ vector<seqDist> HCluster::getSeqsFNNN(){
                return sameSeqs;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getSeqsFNNN");
+               m->errorOut(e, "HCluster", "getSeqsFNNN");
                exit(1);
        }
 }
@@ -495,7 +496,7 @@ vector<seqDist> HCluster::getSeqsAN(){
                return temp;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getSeqsAN");
+               m->errorOut(e, "HCluster", "getSeqsAN");
                exit(1);
        }
 }
@@ -649,7 +650,7 @@ void HCluster::combineFile() {
                sort(mergedMin.begin(), mergedMin.end(), compareSequenceDistance);      
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "combineFile");
+               m->errorOut(e, "HCluster", "combineFile");
                exit(1);
        }
 }
@@ -725,7 +726,7 @@ seqDist HCluster::getNextDist(char* buffer, int& index, int size){
                return next;
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "getNextDist");
+               m->errorOut(e, "HCluster", "getNextDist");
                exit(1);
        }
 }
@@ -767,7 +768,7 @@ void HCluster::processFile() {
                rename(outTemp.c_str(), distfile.c_str());
        }
        catch(exception& e) {
-               errorOut(e, "HCluster", "processFile");
+               m->errorOut(e, "HCluster", "processFile");
                exit(1);
        }
 }
index 7fc8177c56d50303771e1a60c9fdd0f4e84d957b..5005ec6c55c9edc608a1ecbf73e65affea0a88a2 100644 (file)
@@ -68,6 +68,7 @@ protected:
        
        vector<seqDist> mergedMin;
        string partialDist;
+       MothurOut* m;
        
        
 };
index 365c80ee7956045fec1c1d82e848183f3138fe70..e6875b6af18d71bb0f78341f2a04bfc2c002886d 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 //This function checks to make sure the cluster command has no errors and then clusters based on the method chosen.
-HClusterCommand::HClusterCommand(string option){
+HClusterCommand::HClusterCommand(string option)  {
        try{
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -87,8 +87,8 @@ HClusterCommand::HClusterCommand(string option){
                        if (namefile == "not open") { abort = true; }   
                        else if (namefile == "not found") { namefile = ""; }
                        
-                       if ((phylipfile == "") && (columnfile == "")) { mothurOut("When executing a hcluster command you must enter a phylip or a column."); mothurOutEndLine(); abort = true; }
-                       else if ((phylipfile != "") && (columnfile != "")) { mothurOut("When executing a hcluster command you must enter ONLY ONE of the following: phylip or column."); mothurOutEndLine(); abort = true; }
+                       if ((phylipfile == "") && (columnfile == "")) { m->mothurOut("When executing a hcluster command you must enter a phylip or a column."); m->mothurOutEndLine(); abort = true; }
+                       else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When executing a hcluster command you must enter ONLY ONE of the following: phylip or column."); m->mothurOutEndLine(); abort = true; }
                
                        if (columnfile != "") {
                                if (namefile == "") {  cout << "You need to provide a namefile if you are going to use the column format." << endl; abort = true; }
@@ -113,7 +113,7 @@ HClusterCommand::HClusterCommand(string option){
                        if (method == "not found") { method = "furthest"; }
                        
                        if ((method == "furthest") || (method == "nearest") || (method == "average")) { }
-                       else { mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); mothurOutEndLine(); abort = true; }
+                       else { m->mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); m->mothurOutEndLine(); abort = true; }
 
                        showabund = validParameter.validFile(parameters, "showabund", false);
                        if (showabund == "not found") { showabund = "T"; }
@@ -138,11 +138,15 @@ HClusterCommand::HClusterCommand(string option){
                                openOutputFile(fileroot+ tag + ".sabund",       sabundFile);
                                openOutputFile(fileroot+ tag + ".rabund",       rabundFile);
                                openOutputFile(fileroot+ tag + ".list",         listFile);
+                               
+                               outputNames.push_back(fileroot+ tag + ".sabund");
+                               outputNames.push_back(fileroot+ tag + ".rabund");
+                               outputNames.push_back(fileroot+ tag + ".list");
                        }
                }
        }
        catch(exception& e) {
-               errorOut(e, "HClusterCommand", "HClusterCommand");
+               m->errorOut(e, "HClusterCommand", "HClusterCommand");
                exit(1);
        }
 }
@@ -151,15 +155,15 @@ HClusterCommand::HClusterCommand(string option){
 
 void HClusterCommand::help(){
        try {
-               mothurOut("The hcluster command parameter options are cutoff, precision, method, phylip, column, name, showabund, timing and sorted. Phylip or column and name are required.\n");
-               mothurOut("The phylip and column parameter allow you to enter your distance file, and sorted indicates whether your column distance file is already sorted. \n");
-               mothurOut("The name parameter allows you to enter your name file and is required if your distance file is in column format. \n");
-               mothurOut("The hcluster command should be in the following format: \n");
-               mothurOut("hcluster(column=youDistanceFile, name=yourNameFile, method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
-               mothurOut("The acceptable hcluster methods are furthest and nearest, but we hope to add average in the future.\n\n");   
+               m->mothurOut("The hcluster command parameter options are cutoff, precision, method, phylip, column, name, showabund, timing and sorted. Phylip or column and name are required.\n");
+               m->mothurOut("The phylip and column parameter allow you to enter your distance file, and sorted indicates whether your column distance file is already sorted. \n");
+               m->mothurOut("The name parameter allows you to enter your name file and is required if your distance file is in column format. \n");
+               m->mothurOut("The hcluster command should be in the following format: \n");
+               m->mothurOut("hcluster(column=youDistanceFile, name=yourNameFile, method=yourMethod, cutoff=yourCutoff, precision=yourPrecision) \n");
+               m->mothurOut("The acceptable hcluster methods are furthest and nearest, but we hope to add average in the future.\n\n");        
        }
        catch(exception& e) {
-               errorOut(e, "HClusterCommand", "help");
+               m->errorOut(e, "HClusterCommand", "help");
                exit(1);
        }
 }
@@ -196,14 +200,14 @@ int HClusterCommand::execute(){
                        list = new ListVector(globaldata->nameMap->getListVector());
                }
        
-               mothurOut("It took " + toString(time(NULL) - estart) + " seconds to sort. "); mothurOutEndLine();
+               m->mothurOut("It took " + toString(time(NULL) - estart) + " seconds to sort. "); m->mothurOutEndLine();
                estart = time(NULL);
        
                //list vector made by read contains all sequence names
                if(list != NULL){
                        rabund = new RAbundVector(list->getRAbundVector());
                }else{
-                       mothurOut("Error: no list vector!"); mothurOutEndLine(); return 0;
+                       m->mothurOut("Error: no list vector!"); m->mothurOutEndLine(); return 0;
                }
                
                float previousDist = 0.00000;
@@ -265,13 +269,18 @@ int HClusterCommand::execute(){
                rabundFile.close();
                listFile.close();
                delete cluster;
-       
-               mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster. "); mothurOutEndLine();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
+               m->mothurOut("It took " + toString(time(NULL) - estart) + " seconds to cluster. "); m->mothurOutEndLine();
                
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "HClusterCommand", "execute");
+               m->errorOut(e, "HClusterCommand", "execute");
                exit(1);
        }
 }
@@ -281,8 +290,8 @@ int HClusterCommand::execute(){
 void HClusterCommand::printData(string label){
        try {
                if (isTrue(timing)) {
-                       mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins()) 
-                    + "\tclusters. Updates: " + toString(loops)); mothurOutEndLine();
+                       m->mothurOut("\tTime: " + toString(time(NULL) - start) + "\tsecs for " + toString(oldRAbund.getNumBins()) 
+                    + "\tclusters. Updates: " + toString(loops)); m->mothurOutEndLine();
                }
                print_start = true;
                loops = 0;
@@ -299,7 +308,7 @@ void HClusterCommand::printData(string label){
                oldList.print(listFile);
        }
        catch(exception& e) {
-               errorOut(e, "HClusterCommand", "printData");
+               m->errorOut(e, "HClusterCommand", "printData");
                exit(1);
        }
 
index 443d8709bb7dd9294841e2dfc24584569e78e7c0..8bbc655fd7c30a9708b8292a81de0bb6a7b6c478 100644 (file)
@@ -53,6 +53,7 @@ private:
        ofstream sabundFile, rabundFile, listFile;
        time_t start;
        unsigned long loops;
+       vector<string> outputNames;
        
        void printData(string label);
 };
index 2bd020e0c3cf8337c0671c1db515954e51177dd0..d05c700dd9dddfd9482ba6016c12f155e38362a9 100644 (file)
 HeatMap::HeatMap(string sort, string scale, string dir){
        try {
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
 //             format = globaldata->getFormat();
                sorted = sort;
                scaler = scale;
                outputDir = dir;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMap", "HeatMap");
+               m->errorOut(e, "HeatMap", "HeatMap");
                exit(1);
        }
 }
 
 //**********************************************************************************************************************
 
-void HeatMap::getPic(RAbundVector* rabund) {
+string HeatMap::getPic(RAbundVector* rabund) {
        try {
                
                
@@ -85,17 +86,17 @@ void HeatMap::getPic(RAbundVector* rabund) {
                outsvg << "</g>\n</svg>\n";
                outsvg.close();
                
-               
+               return filenamesvg;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMap", "getPic");
+               m->errorOut(e, "HeatMap", "getPic");
                exit(1);
        }
 }
 
 //**********************************************************************************************************************
 
-void HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
+string HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
        try {
                //sort lookup so shared bins are on top
                if (isTrue(sorted) == true) {  sortSharedVectors(lookup);  }
@@ -169,10 +170,12 @@ void HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
                
                outsvg << "</g>\n</svg>\n";
                outsvg.close();
+               
+               return filenamesvg;
 
        }
        catch(exception& e) {
-               errorOut(e, "HeatMap", "getPic");
+               m->errorOut(e, "HeatMap", "getPic");
                exit(1);
        }
 }
@@ -252,7 +255,7 @@ void HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
                
        }
        catch(exception& e) {
-               errorOut(e, "HeatMap", "sortSharedVectors");
+               m->errorOut(e, "HeatMap", "sortSharedVectors");
                exit(1);
        }
 }
@@ -292,7 +295,7 @@ void HeatMap::printLegend(int y, float maxbin) {
        }
        
        catch(exception& e) {
-               errorOut(e, "HeatMap", "printLegend");
+               m->errorOut(e, "HeatMap", "printLegend");
                exit(1);
        }
 }
index 438d84bbb69335d9825fa3b34acf96c05ceb59a4..ffbe94675df2dc8b968134ad79ffc7307bb1d458 100644 (file)
--- a/heatmap.h
+++ b/heatmap.h
@@ -22,8 +22,8 @@ class HeatMap {
                HeatMap(string, string, string);
                ~HeatMap(){};
        
-               void getPic(RAbundVector*);
-               void getPic(vector<SharedRAbundVector*>);
+               string getPic(RAbundVector*);
+               string getPic(vector<SharedRAbundVector*>);
 
        private:
                void sortSharedVectors(vector<SharedRAbundVector*>& );
@@ -32,6 +32,7 @@ class HeatMap {
                GlobalData* globaldata;
                string format, sorted, groupComb, scaler, outputDir;
                ofstream outsvg;
+               MothurOut* m;
                        
 };
 
index 04f12456a49b623a82bf3e009929d7a31870da35..a91ef9db9d93b6ad7e65a4705bbe7ad789884a45 100644 (file)
@@ -12,7 +12,7 @@
 
 //**********************************************************************************************************************
 
-HeatMapCommand::HeatMapCommand(string option){
+HeatMapCommand::HeatMapCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -45,7 +45,7 @@ HeatMapCommand::HeatMapCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "") && (globaldata->getSharedFile() == "")) {
-                                mothurOut("You must read a list, rabund, sabund, or a list and a group, or a shared before you can use the heatmap.bin command."); mothurOutEndLine(); abort = true; 
+                                m->mothurOut("You must read a list, rabund, sabund, or a list and a group, or a shared before you can use the heatmap.bin command."); m->mothurOutEndLine(); abort = true; 
                        }
 
                        //check for optional parameter and set defaults
@@ -82,7 +82,7 @@ HeatMapCommand::HeatMapCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapCommand", "HeatMapCommand");
+               m->errorOut(e, "HeatMapCommand", "HeatMapCommand");
                exit(1);
        }
 }
@@ -91,23 +91,23 @@ HeatMapCommand::HeatMapCommand(string option){
 
 void HeatMapCommand::help(){
        try {
-               mothurOut("The heatmap.bin command can only be executed after a successful read.otu command.\n");
-               mothurOut("The heatmap.bin command parameters are groups, sorted, scale label.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n");
-               mothurOut("The sorted parameter allows you to choose to see the file with the shared otus at the top or the otus in the order they appear in your input file. \n");
-               mothurOut("The scale parameter allows you to choose the range of color your bin information will be displayed with.\n");
-               mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and are also separated by dashes.\n");
-               mothurOut("The heatmap.bin command should be in the following format: heatmap.bin(groups=yourGroups, sorted=yourSorted, label=yourLabels).\n");
-               mothurOut("Example heatmap.bin(groups=A-B-C, sorted=F, scale=log10).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n");
-               mothurOut("The default value for sorted is T meaning you want the shared otus on top, you may change it to F meaning the exact representation of your input file.\n");
-               mothurOut("The default value for scale is log10; your other options are log2 and linear.\n");
-               mothurOut("The heatmap.bin command outputs a .svg file for each label you specify.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The heatmap.bin command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The heatmap.bin command parameters are groups, sorted, scale label.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n");
+               m->mothurOut("The sorted parameter allows you to choose to see the file with the shared otus at the top or the otus in the order they appear in your input file. \n");
+               m->mothurOut("The scale parameter allows you to choose the range of color your bin information will be displayed with.\n");
+               m->mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and are also separated by dashes.\n");
+               m->mothurOut("The heatmap.bin command should be in the following format: heatmap.bin(groups=yourGroups, sorted=yourSorted, label=yourLabels).\n");
+               m->mothurOut("Example heatmap.bin(groups=A-B-C, sorted=F, scale=log10).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n");
+               m->mothurOut("The default value for sorted is T meaning you want the shared otus on top, you may change it to F meaning the exact representation of your input file.\n");
+               m->mothurOut("The default value for scale is log10; your other options are log2 and linear.\n");
+               m->mothurOut("The heatmap.bin command outputs a .svg file for each label you specify.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapCommand", "help");
+               m->errorOut(e, "HeatMapCommand", "help");
                exit(1);
        }
 }
@@ -161,8 +161,8 @@ int HeatMapCommand::execute(){
                
                                if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
        
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
-                                       heatmap->getPic(lookup);
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                                       outputNames.push_back(heatmap->getPic(lookup));
                                        
                                        processedLabels.insert(lookup[0]->getLabel());
                                        userLabels.erase(lookup[0]->getLabel());
@@ -173,9 +173,9 @@ int HeatMapCommand::execute(){
                                
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }  
                                        lookup = input->getSharedRAbundVectors(lastLabel);
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        
-                                       heatmap->getPic(lookup);
+                                       outputNames.push_back(heatmap->getPic(lookup));
                                        
                                        processedLabels.insert(lookup[0]->getLabel());
                                        userLabels.erase(lookup[0]->getLabel());
@@ -196,12 +196,12 @@ int HeatMapCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                
@@ -210,8 +210,8 @@ int HeatMapCommand::execute(){
                                for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } }  
                                lookup = input->getSharedRAbundVectors(lastLabel);
                                
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
-                               heatmap->getPic(lookup);
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                               outputNames.push_back(heatmap->getPic(lookup));
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
                        }
                
@@ -226,8 +226,8 @@ int HeatMapCommand::execute(){
 
                                if(allLines == 1 || labels.count(rabund->getLabel()) == 1){                     
        
-                                       mothurOut(rabund->getLabel()); mothurOutEndLine();
-                                       heatmap->getPic(rabund);
+                                       m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
+                                       outputNames.push_back(heatmap->getPic(rabund));
                                        
                                        processedLabels.insert(rabund->getLabel());
                                        userLabels.erase(rabund->getLabel());
@@ -238,9 +238,9 @@ int HeatMapCommand::execute(){
                                        
                                        delete rabund;
                                        rabund = input->getRAbundVector(lastLabel);
-                                       mothurOut(rabund->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
                                        
-                                       heatmap->getPic(rabund);
+                                       outputNames.push_back(heatmap->getPic(rabund));
                                        
                                        processedLabels.insert(rabund->getLabel());
                                        userLabels.erase(rabund->getLabel());
@@ -260,12 +260,12 @@ int HeatMapCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                
@@ -274,9 +274,9 @@ int HeatMapCommand::execute(){
                
                                if (rabund != NULL) {   delete rabund;  }
                                rabund = input->getRAbundVector(lastLabel);
-                               mothurOut(rabund->getLabel()); mothurOutEndLine();
+                               m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
                                        
-                               heatmap->getPic(rabund);
+                               outputNames.push_back(heatmap->getPic(rabund));
                                delete rabund; globaldata->rabund = NULL;
                        }
                
@@ -284,10 +284,16 @@ int HeatMapCommand::execute(){
                
                globaldata->rabund = NULL;
                delete input; globaldata->ginput = NULL;
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapCommand", "execute");
+               m->errorOut(e, "HeatMapCommand", "execute");
                exit(1);
        }
 }
index 83f6c0f21f4aefeb209056bdad3002e5449762be..47838d80bb6f8cded11793bc7ed7ef942f9f8ec9 100644 (file)
@@ -40,7 +40,7 @@ private:
        bool abort, allLines;
        set<string> labels; //holds labels to be used
        string format, groups, sorted, scale, label, outputDir;
-       vector<string> Groups;
+       vector<string> Groups, outputNames;
 
 
 };
index b29e98b68c4af0824d4effbffa753ede522309c7..9a1255037c4312291238b613d39929c7b50549b5 100644 (file)
 //**********************************************************************************************************************
 HeatMapSim::HeatMapSim(string dir) : outputDir(dir) {
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
 }
 //**********************************************************************************************************************
-void HeatMapSim::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> calcs) {
+vector<string> HeatMapSim::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> calcs) {
        try {
                EstOutput data;
                vector<double> sims;
+               vector<string> outputNames;
                                
                //make file for each calculator selected
                for (int m = 0; m < calcs.size(); m++) {
                        
                        string filenamesvg = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + calcs[m]->getName() + ".heatmap.sim.svg";
                        openOutputFile(filenamesvg, outsvg);
+                       outputNames.push_back(filenamesvg);
                        
                        //svg image
                        outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString((lookup.size() * 150) + 160) + " " + toString((lookup.size() * 150) + 160)  + "\">\n";
@@ -94,15 +97,15 @@ void HeatMapSim::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*>
 
                }
                
-               
+               return outputNames;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSim", "getPic");
+               m->errorOut(e, "HeatMapSim", "getPic");
                exit(1);
        }
 }
 //**********************************************************************************************************************
-void HeatMapSim::getPic(vector< vector<double> > dists, vector<string> groups) {
+string HeatMapSim::getPic(vector< vector<double> > dists, vector<string> groups) {
        try {
                
                vector<double> sims;
@@ -161,9 +164,11 @@ void HeatMapSim::getPic(vector< vector<double> > dists, vector<string> groups) {
                outsvg << "</g>\n</svg>\n";
                outsvg.close();
                
+               return filenamesvg;
+               
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSim", "getPic");
+               m->errorOut(e, "HeatMapSim", "getPic");
                exit(1);
        }
 }
@@ -202,7 +207,7 @@ void HeatMapSim::printLegend(int y, float maxSim) {
        }
        
        catch(exception& e) {
-               errorOut(e, "HeatMapSim", "printLegend");
+               m->errorOut(e, "HeatMapSim", "printLegend");
                exit(1);
        }
 }
index ffafb7d3f96ac5d72695371af4b3e850c3fc80ad..bb78e42df9e124c01969449ace2d59e5fe0dd7f9 100644 (file)
@@ -23,8 +23,8 @@ class HeatMapSim {
                HeatMapSim(string);
                ~HeatMapSim(){};
        
-               void getPic(vector<SharedRAbundVector*>, vector<Calculator*>);
-               void getPic(vector< vector<double> >, vector<string>);
+               vector<string> getPic(vector<SharedRAbundVector*>, vector<Calculator*>);
+               string getPic(vector< vector<double> >, vector<string>);
 
        private:
                void printLegend(int, float);
@@ -32,6 +32,7 @@ class HeatMapSim {
                GlobalData* globaldata;
                string format, groupComb, outputDir;
                ofstream outsvg;
+               MothurOut* m;
                        
 };
 
index cef790633454b7d8136556d6441a684f0e45e3de..1b4b9d79010b22391ed29e148c8b3f9137ac1b3f 100644 (file)
@@ -22,7 +22,7 @@
 
 //**********************************************************************************************************************
 
-HeatMapSimCommand::HeatMapSimCommand(string option){
+HeatMapSimCommand::HeatMapSimCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -30,7 +30,7 @@ HeatMapSimCommand::HeatMapSimCommand(string option){
                labels.clear();
                Groups.clear();
                Estimators.clear();
-               
+                       
                //allow user to run help
                if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; }
                
@@ -101,11 +101,11 @@ HeatMapSimCommand::HeatMapSimCommand(string option){
                        
                        
                        //error checking on files                       
-                       if ((globaldata->getSharedFile() == "") && ((phylipfile == "") && (columnfile == "")))  { mothurOut("You must run the read.otu command or provide a distance file before running the heatmap.sim command."); mothurOutEndLine(); abort = true; }
-                       else if ((phylipfile != "") && (columnfile != "")) { mothurOut("When running the heatmap.sim command with a distance file you may not use both the column and the phylip parameters."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "") && ((phylipfile == "") && (columnfile == "")))  { m->mothurOut("You must run the read.otu command or provide a distance file before running the heatmap.sim command."); m->mothurOutEndLine(); abort = true; }
+                       else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When running the heatmap.sim command with a distance file you may not use both the column and the phylip parameters."); m->mothurOutEndLine(); abort = true; }
                        
                        if (columnfile != "") {
-                               if (namefile == "") {  mothurOut("You need to provide a namefile if you are going to use the column format."); mothurOutEndLine(); abort = true; }
+                               if (namefile == "") {  m->mothurOut("You need to provide a namefile if you are going to use the column format."); m->mothurOutEndLine(); abort = true; }
                        }
                        
                        if (format == "") { format = "shared"; }
@@ -180,7 +180,7 @@ HeatMapSimCommand::HeatMapSimCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSimCommand", "HeatMapSimCommand");
+               m->errorOut(e, "HeatMapSimCommand", "HeatMapSimCommand");
                exit(1);
        }
 }
@@ -189,27 +189,27 @@ HeatMapSimCommand::HeatMapSimCommand(string option){
 
 void HeatMapSimCommand::help(){
        try {
-               mothurOut("The heatmap.sim command can only be executed after a successful read.otu command, or by providing a distance file.\n");
-               mothurOut("The heatmap.sim command parameters are phylip, column, name, groups, calc and label.  No parameters are required.\n");
-               mothurOut("There are two ways to use the heatmap.sim command. The first is with the read.otu command. \n");
-               mothurOut("With the read.otu command you may use the groups, label and calc parameters. \n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n");
-               mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and is also separated by dashes.\n");
-               mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(groups=yourGroups, calc=yourCalc, label=yourLabels).\n");
-               mothurOut("Example heatmap.sim(groups=A-B-C, calc=jabund).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n");
+               m->mothurOut("The heatmap.sim command can only be executed after a successful read.otu command, or by providing a distance file.\n");
+               m->mothurOut("The heatmap.sim command parameters are phylip, column, name, groups, calc and label.  No parameters are required.\n");
+               m->mothurOut("There are two ways to use the heatmap.sim command. The first is with the read.otu command. \n");
+               m->mothurOut("With the read.otu command you may use the groups, label and calc parameters. \n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n");
+               m->mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and is also separated by dashes.\n");
+               m->mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(groups=yourGroups, calc=yourCalc, label=yourLabels).\n");
+               m->mothurOut("Example heatmap.sim(groups=A-B-C, calc=jabund).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n");
                validCalculator->printCalc("heat", cout);
-               mothurOut("The default value for calc is jclass-thetayc.\n");
-               mothurOut("The heatmap.sim command outputs a .svg file for each calculator you choose at each label you specify.\n");
-               mothurOut("The second way to use the heatmap.sim command is with a distance file representing the distance bewteen your groups. \n");
-               mothurOut("Using the command this way, the phylip or column parameter are required, and only one may be used.  If you use a column file the name filename is required. \n");
-               mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(phylip=yourDistanceFile).\n");
-               mothurOut("Example heatmap.sim(phylip=amazonGroups.dist).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The default value for calc is jclass-thetayc.\n");
+               m->mothurOut("The heatmap.sim command outputs a .svg file for each calculator you choose at each label you specify.\n");
+               m->mothurOut("The second way to use the heatmap.sim command is with a distance file representing the distance bewteen your groups. \n");
+               m->mothurOut("Using the command this way, the phylip or column parameter are required, and only one may be used.  If you use a column file the name filename is required. \n");
+               m->mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(phylip=yourDistanceFile).\n");
+               m->mothurOut("Example heatmap.sim(phylip=amazonGroups.dist).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSimCommand", "help");
+               m->errorOut(e, "HeatMapSimCommand", "help");
                exit(1);
        }
 }
@@ -239,11 +239,16 @@ int HeatMapSimCommand::execute(){
                
                delete heatmap;
                delete validCalculator;
-
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSimCommand", "execute");
+               m->errorOut(e, "HeatMapSimCommand", "execute");
                exit(1);
        }
 }
@@ -252,7 +257,7 @@ int HeatMapSimCommand::execute(){
 int HeatMapSimCommand::runCommandShared() {
        try {
                //if the users entered no valid calculators don't execute command
-               if (heatCalculators.size() == 0) { mothurOut("No valid calculators."); mothurOutEndLine(); return 0; }
+               if (heatCalculators.size() == 0) { m->mothurOut("No valid calculators."); m->mothurOutEndLine(); return 0; }
                
                //you have groups
                read = new ReadOTUFile(globaldata->inputFileName);      
@@ -262,7 +267,7 @@ int HeatMapSimCommand::runCommandShared() {
                lookup = input->getSharedRAbundVectors();
                string lastLabel = lookup[0]->getLabel();
                
-               if (lookup.size() < 2) { mothurOut("You have not provided enough valid groups.  I cannot run the command."); mothurOutEndLine(); return 0;}
+               if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); return 0;}
                                
                //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
                set<string> processedLabels;
@@ -273,8 +278,9 @@ int HeatMapSimCommand::runCommandShared() {
                
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
        
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
-                               heatmap->getPic(lookup, heatCalculators);
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                               vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
+                               for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
                                        
                                processedLabels.insert(lookup[0]->getLabel());
                                userLabels.erase(lookup[0]->getLabel());
@@ -286,8 +292,9 @@ int HeatMapSimCommand::runCommandShared() {
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                lookup = input->getSharedRAbundVectors(lastLabel);                              
 
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
-                               heatmap->getPic(lookup, heatCalculators);
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                               vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
+                               for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
                                        
                                processedLabels.insert(lookup[0]->getLabel());
                                userLabels.erase(lookup[0]->getLabel());
@@ -309,12 +316,12 @@ int HeatMapSimCommand::runCommandShared() {
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -323,8 +330,10 @@ int HeatMapSimCommand::runCommandShared() {
                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) { delete lookup[i]; } } 
                        lookup = input->getSharedRAbundVectors(lastLabel);                              
 
-                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
-                       heatmap->getPic(lookup, heatCalculators);
+                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                       vector<string> outfilenames = heatmap->getPic(lookup, heatCalculators);
+                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+                       
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                }
                
@@ -338,7 +347,7 @@ int HeatMapSimCommand::runCommandShared() {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSimCommand", "runCommandShared");
+               m->errorOut(e, "HeatMapSimCommand", "runCommandShared");
                exit(1);
        }
 }
@@ -455,12 +464,12 @@ int HeatMapSimCommand::runCommandDist() {
                }
                
 
-               heatmap->getPic(matrix, names); //vector<vector<double>>, vector<string>
+               outputNames.push_back(heatmap->getPic(matrix, names)); //vector<vector<double>>, vector<string>
                
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "HeatMapSimCommand", "runCommandDist");
+               m->errorOut(e, "HeatMapSimCommand", "runCommandDist");
                exit(1);
        }
 }
index 838babdbe388b69b57d56f01fa3d1e508e18faae..a26018062f28c4406dd83a518f67ee78b388d227 100644 (file)
@@ -40,7 +40,7 @@ private:
        bool abort, allLines;
        set<string> labels; //holds labels to be used
        string format, groups, label, calc, phylipfile, columnfile, namefile, outputDir;
-       vector<string> Estimators, Groups;
+       vector<string> Estimators, Groups, outputNames;
        
        int runCommandShared();
        int runCommandDist();
index 948c31760a6ace11e2eba806c46d44e9f89f6719..608ff3e275a1c7240975b506961d3a7ecf78fa79 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-HelpCommand::HelpCommand(string option){
+HelpCommand::HelpCommand(string option)  {
        
        validCommands = CommandFactory::getInstance();
 }
@@ -25,9 +25,9 @@ HelpCommand::~HelpCommand(){}
 int HelpCommand::execute(){
 
        validCommands->printCommands(cout);
-       mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); mothurOutEndLine();
+       m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine();
        
-       mothurOutEndLine(); mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n");
+       m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n");
        return 0;
 }
 
index bf783a35d5e06e12fa4fcf2c3ff58ba7d9618778..8e54ab787c683535dd132caf0881aab3399945b9 100644 (file)
@@ -15,7 +15,7 @@
 /***********************************************************************/
 
 InputData::InputData(string fName, string f) : format(f){
-       
+       m = MothurOut::getInstance();
        openInputFile(fName, fileHandle);
        filename = fName;
        
@@ -34,7 +34,7 @@ InputData::~InputData(){
 
 InputData::InputData(string fName, string orderFileName, string f) : format(f){
        try {
-               
+               m = MothurOut::getInstance();
                ifstream ofHandle;
                openInputFile(orderFileName, ofHandle);
                string name;
@@ -52,7 +52,7 @@ InputData::InputData(string fName, string orderFileName, string f) : format(f){
                openInputFile(fName, fileHandle);
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "InputData");
+               m->errorOut(e, "InputData", "InputData");
                exit(1);
        }
 }
@@ -73,7 +73,7 @@ ListVector* InputData::getListVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getListVector");
+               m->errorOut(e, "InputData", "getListVector");
                exit(1);
        }
 }
@@ -111,7 +111,7 @@ ListVector* InputData::getListVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getListVector");
+               m->errorOut(e, "InputData", "getListVector");
                exit(1);
        }
 }
@@ -134,7 +134,7 @@ SharedListVector* InputData::getSharedListVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedListVector");
+               m->errorOut(e, "InputData", "getSharedListVector");
                exit(1);
        }
 }
@@ -172,7 +172,7 @@ SharedListVector* InputData::getSharedListVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedListVector");
+               m->errorOut(e, "InputData", "getSharedListVector");
                exit(1);
        }
 }
@@ -196,7 +196,7 @@ SharedOrderVector* InputData::getSharedOrderVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedOrderVector");
+               m->errorOut(e, "InputData", "getSharedOrderVector");
                exit(1);
        }
 }
@@ -235,7 +235,7 @@ SharedOrderVector* InputData::getSharedOrderVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedOrderVector");
+               m->errorOut(e, "InputData", "getSharedOrderVector");
                exit(1);
        }
 }
@@ -275,7 +275,7 @@ OrderVector* InputData::getOrderVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getOrderVector");
+               m->errorOut(e, "InputData", "getOrderVector");
                exit(1);
        }
 }
@@ -378,7 +378,7 @@ OrderVector* InputData::getOrderVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getOrderVector");
+               m->errorOut(e, "InputData", "getOrderVector");
                exit(1);
        }
 }
@@ -408,7 +408,7 @@ vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(){
                
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedRAbundVectors");
+               m->errorOut(e, "InputData", "getSharedRAbundVectors");
                exit(1);
        }
 }
@@ -466,7 +466,7 @@ vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(string label){
        
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSharedRAbundVectors");
+               m->errorOut(e, "InputData", "getSharedRAbundVectors");
                exit(1);
        }
 }
@@ -505,7 +505,7 @@ SAbundVector* InputData::getSAbundVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSAbundVector");
+               m->errorOut(e, "InputData", "getSAbundVector");
                exit(1);
        }
 }
@@ -607,7 +607,7 @@ SAbundVector* InputData::getSAbundVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getSAbundVector");
+               m->errorOut(e, "InputData", "getSAbundVector");
                exit(1);
        }
 }
@@ -644,7 +644,7 @@ RAbundVector* InputData::getRAbundVector(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getRAbundVector");
+               m->errorOut(e, "InputData", "getRAbundVector");
                exit(1);
        }
 }
@@ -745,7 +745,7 @@ RAbundVector* InputData::getRAbundVector(string label){
                }
        }
        catch(exception& e) {
-               errorOut(e, "InputData", "getRAbundVector");
+               m->errorOut(e, "InputData", "getRAbundVector");
                exit(1);
        }
 }
index 6d2d004911b663c63c1b5b582411bb38b70e3c00..251df5bf9a11d230eaae79103c8546e7def900a7 100644 (file)
@@ -41,6 +41,7 @@ private:
        RAbundVector* rabund;
        map<string,int> orderMap;
        string filename;
+       MothurOut* m;
 };
 
 
index 35f0910fab36ca781d2f7653461b0ea79771adf4..7f613665eb3db230c5c14c9240faa0e482f450be 100644 (file)
@@ -25,7 +25,7 @@ void Jackknife::getAMatrix(void){
                }
        }
        catch(exception& e) {
-               errorOut(e, "Jackknife", "getAMatrix");
+               m->errorOut(e, "Jackknife", "getAMatrix");
                exit(1);
        }
 }
@@ -53,7 +53,7 @@ double Jackknife::CN(double z){
                return n;
        }
        catch(exception& e) {
-               errorOut(e, "Jackknife", "CN");
+               m->errorOut(e, "Jackknife", "CN");
                exit(1);
        }
 }
@@ -144,7 +144,7 @@ EstOutput Jackknife::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Jackknife", "getValues");
+               m->errorOut(e, "Jackknife", "getValues");
                exit(1);
        }
 }
index 2560a443044016d8096f7ce2f7cf0636291e97c1..7f7f26589cf6a5c8a566393db9ec76939eb7c0a9 100644 (file)
@@ -42,7 +42,7 @@ KmerDB::KmerDB(string fastaFileName, int kSize) : Database(), kmerSize(kSize) {
                
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "KmerDB");
+               m->errorOut(e, "KmerDB", "KmerDB");
                exit(1);
        }       
 
@@ -94,7 +94,7 @@ vector<int> KmerDB::findClosestSequences(Sequence* candidateSeq, int num){
                return topMatches;              
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "findClosestSequences");
+               m->errorOut(e, "KmerDB", "findClosestSequences");
                exit(1);
        }       
 }
@@ -118,7 +118,7 @@ void KmerDB::generateDB(){
                
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "generateDB");
+               m->errorOut(e, "KmerDB", "generateDB");
                exit(1);
        }       
        
@@ -143,7 +143,7 @@ void KmerDB::addSequence(Sequence seq) {
                count++;
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "addSequence");
+               m->errorOut(e, "KmerDB", "addSequence");
                exit(1);
        }       
 }
@@ -170,7 +170,7 @@ void KmerDB::readKmerDB(ifstream& kmerDBFile){
                
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "readKmerDB");
+               m->errorOut(e, "KmerDB", "readKmerDB");
                exit(1);
        }       
 }
@@ -183,7 +183,7 @@ int KmerDB::getCount(int kmer) {
                else {  return kmerLocations[kmer].size();      }  // kmer is in vector range
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "getCount");
+               m->errorOut(e, "KmerDB", "getCount");
                exit(1);
        }       
 }
@@ -200,7 +200,7 @@ vector<int> KmerDB::getSequencesWithKmer(int kmer) {
                return seqs;
        }
        catch(exception& e) {
-               errorOut(e, "KmerDB", "getSequencesWithKmer");
+               m->errorOut(e, "KmerDB", "getSequencesWithKmer");
                exit(1);
        }       
 }
diff --git a/knn.cpp b/knn.cpp
index 706d2435117513d4a7149e0cc2a670e0e18dc7bb..c11626a082ac9003785fd937e87b922e3bf8025a 100644 (file)
--- a/knn.cpp
+++ b/knn.cpp
@@ -28,23 +28,23 @@ string Knn::getTaxonomy(Sequence* seq) {
                
                        //is this sequence in the taxonomy file
                        if (it == taxonomy.end()) { //error not in file
-                               mothurOut("Error: sequence " + names[closest[i]] + " is not in the taxonomy file.  It will be eliminated as a match to sequence " + seq->getName() + "."); mothurOutEndLine();
+                               m->mothurOut("Error: sequence " + names[closest[i]] + " is not in the taxonomy file.  It will be eliminated as a match to sequence " + seq->getName() + "."); m->mothurOutEndLine();
                        }else{   closestNames.push_back(it->first);     }
                }
                
                if (closestNames.size() == 0) {
-                       mothurOut("Error: All the matches for sequence " + seq->getName() + " have been eliminated. " + seq->getName() + " will be disregarded."); mothurOutEndLine();
+                       m->mothurOut("Error: All the matches for sequence " + seq->getName() + " have been eliminated. " + seq->getName() + " will be disregarded."); m->mothurOutEndLine();
                        tax = "bad seq";
                }else{
                        tax = findCommonTaxonomy(closestNames);
-                       if (tax == "") { mothurOut("There are no common levels for sequence " + seq->getName() + ". " + seq->getName() + " will be disregarded."); mothurOutEndLine(); tax = "bad seq"; }
+                       if (tax == "") { m->mothurOut("There are no common levels for sequence " + seq->getName() + ". " + seq->getName() + " will be disregarded."); m->mothurOutEndLine(); tax = "bad seq"; }
                }
                
                simpleTax = tax;
                return tax;     
        }
        catch(exception& e) {
-               errorOut(e, "Knn", "getTaxonomy");
+               m->errorOut(e, "Knn", "getTaxonomy");
                exit(1);
        }
 }
@@ -92,7 +92,7 @@ string Knn::findCommonTaxonomy(vector<string> closest)  {
                return common;
        }
        catch(exception& e) {
-               errorOut(e, "Knn", "findCommonTaxonomy");
+               m->errorOut(e, "Knn", "findCommonTaxonomy");
                exit(1);
        }
 }
index cd4570ebe7368b9d274e32d7a792170c8ed19aa1..5f1bdefe6ea95e36c6b30800a690af2ceecb1fbb 100644 (file)
@@ -17,13 +17,14 @@ void swap(int& i,int& j){   int t = i;  i = j;  j = t;      }
 
 Libshuff::Libshuff(FullMatrix* D, int it, float step, float co) : matrix(D), iters(it), stepSize(step), cutOff(co){
        try{
+               m = MothurOut::getInstance();
                groupNames = matrix->getGroups();
                groupSizes = matrix->getSizes();
                numGroups = matrix->getNumGroups();
                initializeGroups(matrix);
        }
        catch(exception& e) {
-               errorOut(e, "Libshuff", "Libshuff");
+               m->errorOut(e, "Libshuff", "Libshuff");
                exit(1);
        }
 }
@@ -49,7 +50,7 @@ void Libshuff::initializeGroups(FullMatrix* matrix){
                }
        }
        catch(exception& e) {
-               errorOut(e, "Libshuff", "initializeGroups");
+               m->errorOut(e, "Libshuff", "initializeGroups");
                exit(1);
        }
 }
@@ -78,7 +79,7 @@ vector<double> Libshuff::getMinX(int x){
                return minX;
        }
        catch(exception& e) {
-               errorOut(e, "Libshuff", "getMinX");
+               m->errorOut(e, "Libshuff", "getMinX");
                exit(1);
        }
 }
@@ -99,7 +100,7 @@ vector<double> Libshuff::getMinXY(int x, int y){
                return minXY;
        }
        catch(exception& e) {
-               errorOut(e, "Libshuff", "getMinXY");
+               m->errorOut(e, "Libshuff", "getMinXY");
                exit(1);
        }
 }
@@ -125,7 +126,7 @@ void Libshuff::randomizeGroups(int x, int y){
                for(int k=0;k<groupSizes[y];k++)        {       groups[y][k]=v[index++];        }
        }
        catch(exception& e) {
-               errorOut(e, "Libshuff", "randomizeGroups");
+               m->errorOut(e, "Libshuff", "randomizeGroups");
                exit(1);
        }
 }
index 6412f160cdfccd84879de24cb7e04ca551166e87..ef0e1b0655cfd568a9a45dad013b96ea979dcc0f 100644 (file)
@@ -42,6 +42,7 @@ protected:
        float stepSize;
        
        int numGroups;
+       MothurOut* m;
 };
 
 #endif
index cfccdf6514297fe16af59234d94cdfd758b94c43..93db3be8f6142875fdf158519005b994dd8ca2db 100644 (file)
 
 //**********************************************************************************************************************
 
-LibShuffCommand::LibShuffCommand(string option){
+LibShuffCommand::LibShuffCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                Groups.clear();
                
-               
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -53,7 +52,7 @@ LibShuffCommand::LibShuffCommand(string option){
                        
                        //make sure the user has already run the read.dist command
                        if ((globaldata->gMatrix == NULL) || (globaldata->gGroupmap == NULL)) {
-                               mothurOut("You must read in a matrix and groupfile using the read.dist command, before you use the libshuff command. "); mothurOutEndLine(); abort = true;; 
+                               m->mothurOut("You must read in a matrix and groupfile using the read.dist command, before you use the libshuff command. "); m->mothurOutEndLine(); abort = true;; 
                        }
                                                
                        //check for optional parameter and set defaults
@@ -105,7 +104,7 @@ LibShuffCommand::LibShuffCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "LibShuffCommand");
+               m->errorOut(e, "LibShuffCommand", "LibShuffCommand");
                exit(1);
        }
 }
@@ -113,20 +112,20 @@ LibShuffCommand::LibShuffCommand(string option){
 
 void LibShuffCommand::help(){
        try {
-               mothurOut("The libshuff command can only be executed after a successful read.dist command including a groupfile.\n");
-               mothurOut("The libshuff command parameters are groups, iters, step, form and cutoff.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
-               mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random matrices you would like compared to your matrix.\n");
-               mothurOut("The step parameter allows you to specify change in distance you would like between each output if you are using the discrete form.\n");
-               mothurOut("The form parameter allows you to specify if you would like to analyze your matrix using the discrete or integral form. Your options are integral or discrete.\n");
-               mothurOut("The libshuff command should be in the following format: libshuff(groups=yourGroups, iters=yourIters, cutOff=yourCutOff, form=yourForm, step=yourStep).\n");
-               mothurOut("Example libshuff(groups=A-B-C, iters=500, form=discrete, step=0.01, cutOff=2.0).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, iters is 10000, cutoff is 1.0, form is integral and step is 0.01.\n");
-               mothurOut("The libshuff command output two files: .coverage and .slsummary their descriptions are in the manual.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. iters), '=' and parameters (i.e.yourIters).\n\n");
+               m->mothurOut("The libshuff command can only be executed after a successful read.dist command including a groupfile.\n");
+               m->mothurOut("The libshuff command parameters are groups, iters, step, form and cutoff.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
+               m->mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random matrices you would like compared to your matrix.\n");
+               m->mothurOut("The step parameter allows you to specify change in distance you would like between each output if you are using the discrete form.\n");
+               m->mothurOut("The form parameter allows you to specify if you would like to analyze your matrix using the discrete or integral form. Your options are integral or discrete.\n");
+               m->mothurOut("The libshuff command should be in the following format: libshuff(groups=yourGroups, iters=yourIters, cutOff=yourCutOff, form=yourForm, step=yourStep).\n");
+               m->mothurOut("Example libshuff(groups=A-B-C, iters=500, form=discrete, step=0.01, cutOff=2.0).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, iters is 10000, cutoff is 1.0, form is integral and step is 0.01.\n");
+               m->mothurOut("The libshuff command output two files: .coverage and .slsummary their descriptions are in the manual.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. iters), '=' and parameters (i.e.yourIters).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "help");
+               m->errorOut(e, "LibShuffCommand", "help");
                exit(1);
        }
 }
@@ -167,7 +166,7 @@ int LibShuffCommand::execute(){
                reading->finish();
                delete reading;
 
-               mothurOutEndLine();
+               m->mothurOutEndLine();
                printSummaryFile();
                printCoverageFile();
                
@@ -178,10 +177,15 @@ int LibShuffCommand::execute(){
                //delete globaldata's copy of the gmatrix to free up memory
                delete globaldata->gMatrix;  globaldata->gMatrix = NULL;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "execute");
+               m->errorOut(e, "LibShuffCommand", "execute");
                exit(1);
        }
 }
@@ -194,6 +198,7 @@ void LibShuffCommand::printCoverageFile() {
                ofstream outCov;
                summaryFile = outputDir + getRootName(getSimpleName(globaldata->getPhylipFile())) + "libshuff.coverage";
                openOutputFile(summaryFile, outCov);
+               outputNames.push_back(summaryFile);
                outCov.setf(ios::fixed, ios::floatfield); outCov.setf(ios::showpoint);
                //cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint);
                
@@ -268,7 +273,7 @@ void LibShuffCommand::printCoverageFile() {
                outCov.close();
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "printCoverageFile");
+               m->errorOut(e, "LibShuffCommand", "printCoverageFile");
                exit(1);
        }
 } 
@@ -281,12 +286,13 @@ void LibShuffCommand::printSummaryFile() {
                ofstream outSum;
                summaryFile = outputDir + getRootName(getSimpleName(globaldata->getPhylipFile())) + "libshuff.summary";
                openOutputFile(summaryFile, outSum);
+               outputNames.push_back(summaryFile);
 
                outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
                cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint);
                
                cout << setw(20) << left << "Comparison" << '\t' << setprecision(8) << "dCXYScore" << '\t' << "Significance" << endl;
-               mothurOutJustToLog("Comparison\tdCXYScore\tSignificance"); mothurOutEndLine();
+               m->mothurOutJustToLog("Comparison\tdCXYScore\tSignificance"); m->mothurOutEndLine();
                outSum << setw(20) << left << "Comparison" << '\t' << setprecision(8) << "dCXYScore" << '\t' << "Significance" << endl;
        
                int precision = (int)log10(iters);
@@ -297,22 +303,22 @@ void LibShuffCommand::printSummaryFile() {
                                
                                if(pValueCounts[i][j]){
                                        cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((pValueCounts[i][j]/(float)iters))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((pValueCounts[i][j]/(float)iters))); m->mothurOutEndLine();
                                        outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << setprecision(precision) << pValueCounts[i][j]/(float)iters << endl;
                                }
                                else{
                                        cout << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(groupNames[i]+"-"+groupNames[j] + "\t" + toString(savedDXYValues[spoti][spotj]) + "\t" + toString((1/(float)iters))); m->mothurOutEndLine();
                                        outSum << setw(20) << left << groupNames[i]+'-'+groupNames[j] << '\t' << setprecision(8) << savedDXYValues[spoti][spotj] << '\t' << '<' <<setprecision(precision) << 1/(float)iters << endl;
                                }
                                if(pValueCounts[j][i]){
                                        cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((pValueCounts[j][i]/(float)iters))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((pValueCounts[j][i]/(float)iters))); m->mothurOutEndLine();
                                        outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << setprecision (precision) << pValueCounts[j][i]/(float)iters << endl;
                                }
                                else{
                                        cout << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
-                                       mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((1/(float)iters))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(groupNames[j]+"-"+groupNames[i] + "\t" + toString(savedDXYValues[spotj][spoti]) + "\t" + toString((1/(float)iters))); m->mothurOutEndLine();
                                        outSum << setw(20) << left << groupNames[j]+'-'+groupNames[i] << '\t' << setprecision(8) << savedDXYValues[spotj][spoti] << '\t' << '<' <<setprecision (precision) << 1/(float)iters << endl;
                                }
                        }
@@ -321,7 +327,7 @@ void LibShuffCommand::printSummaryFile() {
                outSum.close();
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "printSummaryFile");
+               m->errorOut(e, "LibShuffCommand", "printSummaryFile");
                exit(1);
        }
 } 
@@ -341,7 +347,7 @@ void LibShuffCommand::setGroups() {
                                //check that groups are valid
                                for (int i = 0; i < globaldata->Groups.size(); i++) {
                                        if (globaldata->gGroupmap->isValidGroup(globaldata->Groups[i]) != true) {
-                                               mothurOut(globaldata->Groups[i] + " is not a valid group, and will be disregarded."); mothurOutEndLine();
+                                               m->mothurOut(globaldata->Groups[i] + " is not a valid group, and will be disregarded."); m->mothurOutEndLine();
                                                // erase the invalid group from globaldata->Groups
                                                globaldata->Groups.erase(globaldata->Groups.begin()+i);
                                        }
@@ -353,7 +359,7 @@ void LibShuffCommand::setGroups() {
                                        for (int i=0; i < numGroups; i++) { 
                                                globaldata->Groups.push_back(globaldata->gGroupmap->namesOfGroups[i]);
                                        }
-                                       mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                                       m->mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                                } else { numGroups = globaldata->Groups.size(); }
                        } else { //users wants all groups
                                numGroups = globaldata->gGroupmap->getNumGroups();
@@ -376,7 +382,7 @@ void LibShuffCommand::setGroups() {
 
        }
        catch(exception& e) {
-               errorOut(e, "LibShuffCommand", "setGroups");
+               m->errorOut(e, "LibShuffCommand", "setGroups");
                exit(1);
        }
 }
index da5f9e8c1d3d06cd7ad3812578ec83bf6bff5774..5155cbd7982eada5dc20480067a5c34e051d30dc 100644 (file)
@@ -44,7 +44,7 @@ private:
 
        bool abort;
        string outputFile, groups, userform, savegroups, outputDir;
-       vector<string> Groups; //holds groups to be used
+       vector<string> Groups, outputNames; //holds groups to be used
 };
 
 #endif
index d0b00bd3061d2a14365ee43ef96db1bc04ac1cb0..f3710c9e4d0aabd728c0714d0f8b7d41c0b73c24 100644 (file)
@@ -13,7 +13,7 @@
 
 //**********************************************************************************************************************
 
-ListSeqsCommand::ListSeqsCommand(string option){
+ListSeqsCommand::ListSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -107,17 +107,17 @@ ListSeqsCommand::ListSeqsCommand(string option){
                        else if (listfile == "not found") {  listfile = "";  }
 
                        
-                       if ((fastafile == "") && (namefile == "") && (listfile == "") && (groupfile == "") && (alignfile == ""))  { mothurOut("You must provide a file."); mothurOutEndLine(); abort = true; }
+                       if ((fastafile == "") && (namefile == "") && (listfile == "") && (groupfile == "") && (alignfile == ""))  { m->mothurOut("You must provide a file."); m->mothurOutEndLine(); abort = true; }
                        
                        int okay = 1;
                        if (outputDir != "") { okay++; }
                        
-                       if (parameters.size() > okay) { mothurOut("You may only enter one file."); mothurOutEndLine(); abort = true;  }
+                       if (parameters.size() > okay) { m->mothurOut("You may only enter one file."); m->mothurOutEndLine(); abort = true;  }
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "ListSeqsCommand");
+               m->errorOut(e, "ListSeqsCommand", "ListSeqsCommand");
                exit(1);
        }
 }
@@ -125,14 +125,14 @@ ListSeqsCommand::ListSeqsCommand(string option){
 
 void ListSeqsCommand::help(){
        try {
-               mothurOut("The list.seqs command reads a fasta, name, group, list or alignreport file and outputs a .accnos file containing sequence names.\n");
-               mothurOut("The list.seqs command parameters are fasta, name, group and alignreport.  You must provide one of these parameters.\n");
-               mothurOut("The list.seqs command should be in the following format: list.seqs(fasta=yourFasta).\n");
-               mothurOut("Example list.seqs(fasta=amazon.fasta).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The list.seqs command reads a fasta, name, group, list or alignreport file and outputs a .accnos file containing sequence names.\n");
+               m->mothurOut("The list.seqs command parameters are fasta, name, group and alignreport.  You must provide one of these parameters.\n");
+               m->mothurOut("The list.seqs command should be in the following format: list.seqs(fasta=yourFasta).\n");
+               m->mothurOut("Example list.seqs(fasta=amazon.fasta).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "help");
+               m->errorOut(e, "ListSeqsCommand", "help");
                exit(1);
        }
 }
@@ -167,11 +167,16 @@ int ListSeqsCommand::execute(){
                }
                out.close();
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outputFileName); m->mothurOutEndLine();    
+               m->mothurOutEndLine();
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "execute");
+               m->errorOut(e, "ListSeqsCommand", "execute");
                exit(1);
        }
 }
@@ -196,7 +201,7 @@ void ListSeqsCommand::readFasta(){
 
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "readFasta");
+               m->errorOut(e, "ListSeqsCommand", "readFasta");
                exit(1);
        }
 }
@@ -227,7 +232,7 @@ void ListSeqsCommand::readList(){
                
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "readList");
+               m->errorOut(e, "ListSeqsCommand", "readList");
                exit(1);
        }
 }
@@ -261,7 +266,7 @@ void ListSeqsCommand::readName(){
                
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "readName");
+               m->errorOut(e, "ListSeqsCommand", "readName");
                exit(1);
        }
 }
@@ -287,7 +292,7 @@ void ListSeqsCommand::readGroup(){
 
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "readGroup");
+               m->errorOut(e, "ListSeqsCommand", "readGroup");
                exit(1);
        }
 }
@@ -327,7 +332,7 @@ void ListSeqsCommand::readAlign(){
                
        }
        catch(exception& e) {
-               errorOut(e, "ListSeqsCommand", "readAlign");
+               m->errorOut(e, "ListSeqsCommand", "readAlign");
                exit(1);
        }
 }
index e123298930f706f9bf19d267e0ee17a5ddb41243..94ca02662bc1e59f61312e7c33d2244faa30e3ae 100644 (file)
@@ -36,7 +36,7 @@ ListVector::ListVector(string id, vector<string> lv) : DataVector(id), data(lv){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "ListVector");
+               m->errorOut(e, "ListVector", "ListVector");
                exit(1);
        }
 }
@@ -59,7 +59,7 @@ ListVector::ListVector(ifstream& f) : DataVector(), maxRank(0), numBins(0), numS
                gobble(f);
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "ListVector");
+               m->errorOut(e, "ListVector", "ListVector");
                exit(1);
        }
 }
@@ -79,7 +79,7 @@ void ListVector::set(int binNumber, string seqNames){
                numSeqs += (nNames_new - nNames_old);
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "set");
+               m->errorOut(e, "ListVector", "set");
                exit(1);
        }
 }
@@ -104,7 +104,7 @@ void ListVector::push_back(string seqNames){
                numSeqs += nNames;
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "push_back");
+               m->errorOut(e, "ListVector", "push_back");
                exit(1);
        }
 }
@@ -144,7 +144,7 @@ void ListVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "print");
+               m->errorOut(e, "ListVector", "print");
                exit(1);
        }
 }
@@ -175,7 +175,7 @@ RAbundVector ListVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "getRAbundVector");
+               m->errorOut(e, "ListVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -196,7 +196,7 @@ SAbundVector ListVector::getSAbundVector(){
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "getSAbundVector");
+               m->errorOut(e, "ListVector", "getSAbundVector");
                exit(1);
        }
 }
@@ -238,7 +238,7 @@ OrderVector ListVector::getOrderVector(map<string,int>* orderMap = NULL){
                                        }
                                        else{
                                                if(orderMap->count(seqName) == 0){
-                                                       mothurOut(seqName + " not found, check *.names file\n");
+                                                       m->mothurOut(seqName + " not found, check *.names file\n");
                                                        exit(1);
                                                }
                                        
@@ -248,7 +248,7 @@ OrderVector ListVector::getOrderVector(map<string,int>* orderMap = NULL){
                                }
                        
                                if(orderMap->count(seqName) == 0){
-                                       mothurOut(seqName + " not found, check *.names file\n");
+                                       m->mothurOut(seqName + " not found, check *.names file\n");
                                        exit(1);
                                }
                                ov.set((*orderMap)[seqName], i);        
@@ -261,7 +261,7 @@ OrderVector ListVector::getOrderVector(map<string,int>* orderMap = NULL){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ListVector", "getOrderVector");
+               m->errorOut(e, "ListVector", "getOrderVector");
                exit(1);
        }
 }
index 62faf8eab68c726f9499451ec3207fc66ae2cbd2..009a404222470b655ee7ae9a9e384ec7f2174fc6 100644 (file)
--- a/logsd.cpp
+++ b/logsd.cpp
@@ -85,7 +85,7 @@ EstOutput LogSD::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "LogSD", "getValues");
+               m->errorOut(e, "LogSD", "getValues");
                exit(1);
        }
 }
index 91b0fa78da7510fc2f2313847f0cc1c5347c8223..76689e9f11bf1ab3547ef9a33053830a7b436d14 100644 (file)
@@ -13,7 +13,7 @@
 
 /***********************************************************************/
 Maligner::Maligner(vector<Sequence*> temp, int num, int match, int misMatch, float div, int ms, int minCov, string mode, Database* dataLeft, Database* dataRight) :
-               db(temp), numWanted(num), matchScore(match), misMatchPenalty(misMatch), minDivR(div), minSimilarity(ms), minCoverage(minCov), searchMethod(mode), databaseLeft(dataLeft), databaseRight(dataRight) {}
+               db(temp), numWanted(num), matchScore(match), misMatchPenalty(misMatch), minDivR(div), minSimilarity(ms), minCoverage(minCov), searchMethod(mode), databaseLeft(dataLeft), databaseRight(dataRight) { m = MothurOut::getInstance(); }
 /***********************************************************************/
 string Maligner::getResults(Sequence* q, DeCalculator* decalc) {
        try {
@@ -32,7 +32,7 @@ string Maligner::getResults(Sequence* q, DeCalculator* decalc) {
                        refSeqs = getBlastSeqs(query, numWanted); //fills indexes
                }else if (searchMethod == "kmer") {
                        refSeqs = getKmerSeqs(query, numWanted); //fills indexes
-               }else { mothurOut("not valid search."); exit(1);  } //should never get here
+               }else { m->mothurOut("not valid search."); exit(1);  } //should never get here
                
                refSeqs = minCoverageFilter(refSeqs);
 
@@ -56,7 +56,7 @@ string Maligner::getResults(Sequence* q, DeCalculator* decalc) {
                return chimera;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "getResults");
+               m->errorOut(e, "Maligner", "getResults");
                exit(1);
        }
 }
@@ -130,7 +130,7 @@ string Maligner::chimeraMaligner(int chimeraPenalty, DeCalculator* decalc) {
                return chimera;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "chimeraMaligner");
+               m->errorOut(e, "Maligner", "chimeraMaligner");
                exit(1);
        }
 }
@@ -172,7 +172,7 @@ vector<Sequence*> Maligner::minCoverageFilter(vector<Sequence*> ref){
                return newRefs;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "minCoverageFilter");
+               m->errorOut(e, "Maligner", "minCoverageFilter");
                exit(1);
        }
 }
@@ -189,7 +189,7 @@ int Maligner::computeChimeraPenalty() {
 
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "computeChimeraPenalty");
+               m->errorOut(e, "Maligner", "computeChimeraPenalty");
                exit(1);
        }
 }
@@ -241,7 +241,7 @@ void Maligner::verticalFilter(vector<Sequence*> seqs) {
                spotMap = newMap;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "verticalFilter");
+               m->errorOut(e, "Maligner", "verticalFilter");
                exit(1);
        }
 }
@@ -268,12 +268,12 @@ vector< vector<score_struct> > Maligner::buildScoreMatrix(int cols, int rows) {
                return m;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "buildScoreMatrix");
+               m->errorOut(e, "Maligner", "buildScoreMatrix");
                exit(1);
        }
 }
 //***************************************************************************************************************
-void Maligner::fillScoreMatrix(vector<vector<score_struct> >& m, vector<Sequence*> seqs, int penalty) {
+void Maligner::fillScoreMatrix(vector<vector<score_struct> >& ms, vector<Sequence*> seqs, int penalty) {
        try{
                
                //get matrix dimensions
@@ -287,11 +287,11 @@ void Maligner::fillScoreMatrix(vector<vector<score_struct> >& m, vector<Sequence
                        
                        //are you both gaps?
                        if ((!isalpha(queryAligned[0])) && (!isalpha(subjectAligned[0]))) {
-                               m[i][0].score = 0;
+                               ms[i][0].score = 0;
                        }else if (queryAligned[0] == subjectAligned[0]) {
-                               m[i][0].score = matchScore;
+                               ms[i][0].score = matchScore;
                        }else{
-                               m[i][0].score = 0;
+                               ms[i][0].score = 0;
                        }
                }
                
@@ -317,15 +317,15 @@ void Maligner::fillScoreMatrix(vector<vector<score_struct> >& m, vector<Sequence
                                //compute score based on previous columns scores
                                for (int prevIndex = 0; prevIndex < numRows; prevIndex++) { //iterate through rows
                                        
-                                       int sumScore = matchMisMatchScore + m[prevIndex][j-1].score;
+                                       int sumScore = matchMisMatchScore + ms[prevIndex][j-1].score;
                                        
                                        //you are not at yourself
                                        if (prevIndex != i) {   sumScore += penalty;    }
                                        if (sumScore < 0)       {       sumScore = 0;                   }
                                        
-                                       if (sumScore > m[i][j].score) {
-                                               m[i][j].score = sumScore;
-                                               m[i][j].prev = prevIndex;
+                                       if (sumScore > ms[i][j].score) {
+                                               ms[i][j].score = sumScore;
+                                               ms[i][j].prev = prevIndex;
                                        }
                                }
                        }
@@ -333,17 +333,17 @@ void Maligner::fillScoreMatrix(vector<vector<score_struct> >& m, vector<Sequence
                
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "fillScoreMatrix");
+               m->errorOut(e, "Maligner", "fillScoreMatrix");
                exit(1);
        }
 }
 //***************************************************************************************************************
-vector<score_struct> Maligner::extractHighestPath(vector<vector<score_struct> > m) {
+vector<score_struct> Maligner::extractHighestPath(vector<vector<score_struct> > ms) {
        try {
        
                //get matrix dimensions
                int numCols = query->getAligned().length();
-               int numRows = m.size();
+               int numRows = ms.size();
        
        
                //find highest score scoring matrix
@@ -352,9 +352,9 @@ vector<score_struct> Maligner::extractHighestPath(vector<vector<score_struct> >
                
                for (int i = 0; i < numRows; i++) {
                        for (int j = 0; j < numCols; j++) {
-                               if (m[i][j].score > highestScore) {
-                                       highestScore = m[i][j].score;
-                                       highestStruct = m[i][j];
+                               if (ms[i][j].score > highestScore) {
+                                       highestScore = ms[i][j].score;
+                                       highestStruct = ms[i][j];
                                }
                        }
                }
@@ -366,7 +366,7 @@ vector<score_struct> Maligner::extractHighestPath(vector<vector<score_struct> >
                int score = highestStruct.score;
                
                while (pos >= 0 && score > 0) {
-                       score_struct temp = m[rowIndex][pos];
+                       score_struct temp = ms[rowIndex][pos];
                        score = temp.score;
                        
                        if (score > 0) {        path.push_back(temp);   }
@@ -381,7 +381,7 @@ vector<score_struct> Maligner::extractHighestPath(vector<vector<score_struct> >
                
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "extractHighestPath");
+               m->errorOut(e, "Maligner", "extractHighestPath");
                exit(1);
        }
 }
@@ -424,7 +424,7 @@ vector<trace_struct> Maligner::mapTraceRegionsToAlignment(vector<score_struct> p
                
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "mapTraceRegionsToAlignment");
+               m->errorOut(e, "Maligner", "mapTraceRegionsToAlignment");
                exit(1);
        }
 }
@@ -442,7 +442,7 @@ string Maligner::constructChimericSeq(vector<trace_struct> trace, vector<Sequenc
                return chimera;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "constructChimericSeq");
+               m->errorOut(e, "Maligner", "constructChimericSeq");
                exit(1);
        }
 }
@@ -451,9 +451,9 @@ float Maligner::computePercentID(string queryAlign, string chimera) {
        try {
        
                if (queryAlign.length() != chimera.length()) {
-                       mothurOut("Error, alignment strings are of different lengths: "); mothurOutEndLine();
-                       mothurOut(toString(queryAlign.length())); mothurOutEndLine(); mothurOutEndLine(); mothurOutEndLine(); mothurOutEndLine();
-                       mothurOut(toString(chimera.length())); mothurOutEndLine();
+                       m->mothurOut("Error, alignment strings are of different lengths: "); m->mothurOutEndLine();
+                       m->mothurOut(toString(queryAlign.length())); m->mothurOutEndLine(); m->mothurOutEndLine(); m->mothurOutEndLine(); m->mothurOutEndLine();
+                       m->mothurOut(toString(chimera.length())); m->mothurOutEndLine();
                        return -1.0;
                }
 
@@ -478,7 +478,7 @@ float Maligner::computePercentID(string queryAlign, string chimera) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "computePercentID");
+               m->errorOut(e, "Maligner", "computePercentID");
                exit(1);
        }
 }
@@ -504,7 +504,7 @@ vector<Sequence*> Maligner::getBlastSeqs(Sequence* q, int num) {
                vector<int> tempIndexesRight = database->findClosestMegaBlast(queryRight, num+1);
                vector<int> tempIndexesLeft = database->findClosestMegaBlast(queryLeft, num+1);
                
-               //if ((tempIndexesRight.size() != (num+1)) || (tempIndexesLeft.size() != (num+1)))  {  mothurOut("megablast returned " + toString(tempIndexesRight.size()) + " results for the right end, and " + toString(tempIndexesLeft.size()) + " for the left end. Needed " + toString(num+1) + ". Unable to porcess sequence " + q->getName()); mothurOutEndLine(); return refResults; }
+               //if ((tempIndexesRight.size() != (num+1)) || (tempIndexesLeft.size() != (num+1)))  {  m->mothurOut("megablast returned " + toString(tempIndexesRight.size()) + " results for the right end, and " + toString(tempIndexesLeft.size()) + " for the left end. Needed " + toString(num+1) + ". Unable to porcess sequence " + q->getName()); m->mothurOutEndLine(); return refResults; }
                
                vector<int> smaller;
                vector<int> larger;
@@ -560,7 +560,7 @@ vector<Sequence*> Maligner::getBlastSeqs(Sequence* q, int num) {
                return refResults;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "getBlastSeqs");
+               m->errorOut(e, "Maligner", "getBlastSeqs");
                exit(1);
        }
 }
@@ -616,7 +616,7 @@ vector<Sequence*> Maligner::getKmerSeqs(Sequence* q, int num) {
                return refResults;
        }
        catch(exception& e) {
-               errorOut(e, "Maligner", "getBlastSeqs");
+               m->errorOut(e, "Maligner", "getBlastSeqs");
                exit(1);
        }
 }
index 13aa917afb5b39ac238dda69b6032bb509e1345e..a4c959bb480ae7035b3f74b1f76b5c833bd8138c 100644 (file)
@@ -54,6 +54,7 @@ class Maligner {
                string chimeraMaligner(int, DeCalculator*);
                vector<Sequence*> getBlastSeqs(Sequence*, int);
                vector<Sequence*> getKmerSeqs(Sequence*, int);
+               MothurOut* m;
                
 };
 
index 87e6489a5e4c79010b8d57df7511117e028cc312..078f411d669426daed4dcc1f09f65810644350ad 100644 (file)
@@ -22,7 +22,7 @@
 
 //**********************************************************************************************************************
 
-MatrixOutputCommand::MatrixOutputCommand(string option){
+MatrixOutputCommand::MatrixOutputCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -57,8 +57,8 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
-                               if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the dist.shared command."); mothurOutEndLine(); abort = true; }
-                               else if (globaldata->getGroupFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the dist.shared command."); mothurOutEndLine(); abort = true; }
+                               if (globaldata->getListFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the dist.shared command."); m->mothurOutEndLine(); abort = true; }
+                               else if (globaldata->getGroupFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the dist.shared command."); m->mothurOutEndLine(); abort = true; }
                        }
                        
                        //check for optional parameter and set defaults
@@ -71,7 +71,7 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                        }
                        
                        output = validParameter.validFile(parameters, "output", false);         if(output == "not found"){      output = "lt"; }
-                       if ((output != "lt") && (output != "square")) { mothurOut(output + " is not a valid output form. Options are lt and square. I will use lt."); mothurOutEndLine(); output = "lt"; }
+                       if ((output != "lt") && (output != "square")) { m->mothurOut(output + " is not a valid output form. Options are lt and square. I will use lt."); m->mothurOutEndLine(); output = "lt"; }
                        
                        //if the user has not specified any labels use the ones from read.otu
                        if (label == "") {  
@@ -129,7 +129,7 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "MatrixOutputCommand", "MatrixOutputCommand");
+               m->errorOut(e, "MatrixOutputCommand", "MatrixOutputCommand");
                exit(1);
        }
 }
@@ -138,21 +138,21 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
 
 void MatrixOutputCommand::help(){
        try {
-               mothurOut("The dist.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The dist.shared command parameters are groups, calc, output and label.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
-               mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like distance matrices created for, and is also separated by dashes.\n");
-               mothurOut("The dist.shared command should be in the following format: dist.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n");
-               mothurOut("The output parameter allows you to specify format of your distance matrix. Options are lt, and square. The default is lt.\n");
-               mothurOut("Example dist.shared(groups=A-B-C, calc=jabund-sorabund).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile.\n");
-               mothurOut("The default value for calc is jclass and thetayc.\n");
+               m->mothurOut("The dist.shared command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The dist.shared command parameters are groups, calc, output and label.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
+               m->mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like distance matrices created for, and is also separated by dashes.\n");
+               m->mothurOut("The dist.shared command should be in the following format: dist.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n");
+               m->mothurOut("The output parameter allows you to specify format of your distance matrix. Options are lt, and square. The default is lt.\n");
+               m->mothurOut("Example dist.shared(groups=A-B-C, calc=jabund-sorabund).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The default value for calc is jclass and thetayc.\n");
                validCalculator->printCalc("matrix", cout);
-               mothurOut("The dist.shared command outputs a .dist file for each calculator you specify at each distance you choose.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The dist.shared command outputs a .dist file for each calculator you specify at each distance you choose.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "MatrixOutputCommand", "help");
+               m->errorOut(e, "MatrixOutputCommand", "help");
                exit(1);
        }
 }
@@ -176,7 +176,7 @@ int MatrixOutputCommand::execute(){
                if (abort == true) {    return 0;       }
                        
                //if the users entered no valid calculators don't execute command
-               if (matrixCalculators.size() == 0) { mothurOut("No valid calculators."); mothurOutEndLine();  return 0; }
+               if (matrixCalculators.size() == 0) { m->mothurOut("No valid calculators."); m->mothurOutEndLine();  return 0; }
 
                //you have groups
                read = new ReadOTUFile(globaldata->inputFileName);      
@@ -190,7 +190,7 @@ int MatrixOutputCommand::execute(){
                set<string> processedLabels;
                set<string> userLabels = labels;
                                        
-               if (lookup.size() < 2) { mothurOut("You have not provided enough valid groups.  I cannot run the command."); mothurOutEndLine(); return 0;}
+               if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); return 0;}
                
                numGroups = lookup.size();
                                
@@ -198,7 +198,7 @@ int MatrixOutputCommand::execute(){
                while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -211,7 +211,7 @@ int MatrixOutputCommand::execute(){
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                lookup = input->getSharedRAbundVectors(lastLabel);
 
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -232,12 +232,12 @@ int MatrixOutputCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it);  
+                       m->mothurOut("Your file does not include the label " + *it);  
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -246,7 +246,7 @@ int MatrixOutputCommand::execute(){
                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {  delete lookup[i]; }  } 
                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                        process(lookup);
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                }
@@ -254,11 +254,17 @@ int MatrixOutputCommand::execute(){
                                
                //reset groups parameter
                globaldata->Groups.clear();  
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "MatrixOutputCommand", "execute");
+               m->errorOut(e, "MatrixOutputCommand", "execute");
                exit(1);
        }
 }
@@ -290,7 +296,7 @@ void MatrixOutputCommand::printSims(ostream& out) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "MatrixOutputCommand", "printSims");
+               m->errorOut(e, "MatrixOutputCommand", "printSims");
                exit(1);
        }
 }
@@ -332,6 +338,8 @@ void MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                                        
                                        exportFileName = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + matrixCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + "." + output + ".dist";
                                        openOutputFile(exportFileName, out);
+                                       outputNames.push_back(exportFileName);
+                                       
                                        printSims(out);
                                        out.close();
                                        
@@ -341,7 +349,7 @@ void MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                
        }
        catch(exception& e) {
-               errorOut(e, "MatrixOutputCommand", "process");
+               m->errorOut(e, "MatrixOutputCommand", "process");
                exit(1);
        }
 }
index ff7519ee00751dcad80ebdb9bc04e384f54cd45b..521104c395382d5ce15c61f99510c830ae054f7a 100644 (file)
@@ -49,7 +49,7 @@ private:
        bool abort, allLines;
        set<string> labels; //holds labels to be used
        string outputFile, calc, groups, label, outputDir;
-       vector<string>  Estimators, Groups; //holds estimators to be used
+       vector<string>  Estimators, Groups, outputNames; //holds estimators to be used
        
 
 };
index 0a8c0d8cda62808664a83f46c44cebb770e14f4a..7e17b051305014e2aa58831fddfabaad63f319d4 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-MergeFileCommand::MergeFileCommand(string option){
+MergeFileCommand::MergeFileCommand(string option)  {
        try {
                abort = false;
                
@@ -39,7 +39,7 @@ MergeFileCommand::MergeFileCommand(string option){
                        if (inputDir == "not found"){   inputDir = "";          }
                        
                        string fileList = validParameter.validFile(parameters, "input", false);                 
-                       if(fileList == "not found") { mothurOut("you must enter two or more file names"); mothurOutEndLine();  abort=true;  }
+                       if(fileList == "not found") { m->mothurOut("you must enter two or more file names"); m->mothurOutEndLine();  abort=true;  }
                        else{   splitAtDash(fileList, fileNames);       }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -49,7 +49,7 @@ MergeFileCommand::MergeFileCommand(string option){
                        numInputFiles = fileNames.size();
                        ifstream testFile;
                        if(numInputFiles == 0){
-                               mothurOut("you must enter two or more file names and you entered " + toString(fileNames.size()) +  " file names"); mothurOutEndLine();
+                               m->mothurOut("you must enter two or more file names and you entered " + toString(fileNames.size()) +  " file names"); m->mothurOutEndLine();
                                abort=true;  
                        }
                        else{
@@ -66,13 +66,13 @@ MergeFileCommand::MergeFileCommand(string option){
                        }   
                        
                        outputFileName = validParameter.validFile(parameters, "output", false);                 
-                       if (outputFileName == "not found") { mothurOut("you must enter an output file name"); mothurOutEndLine();  abort=true;  }
+                       if (outputFileName == "not found") { m->mothurOut("you must enter an output file name"); m->mothurOutEndLine();  abort=true;  }
                        else if (outputDir != "") { outputFileName = outputDir + getSimpleName(outputFileName); }
                }
                        
        }
        catch(exception& e) {
-               errorOut(e, "MergeFileCommand", "MergeFileCommand");
+               m->errorOut(e, "MergeFileCommand", "MergeFileCommand");
                exit(1);
        }
 }
@@ -106,10 +106,16 @@ int MergeFileCommand::execute(){
                }
                
                outputFile.close();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outputFileName); m->mothurOutEndLine();    
+               m->mothurOutEndLine();
+
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "MergeFileCommand", "execute");
+               m->errorOut(e, "MergeFileCommand", "execute");
                exit(1);
        }
 }
@@ -118,10 +124,10 @@ int MergeFileCommand::execute(){
 
 void MergeFileCommand::help(){
        try {
-               mothurOut("The merge.file command..."); mothurOutEndLine();
+               m->mothurOut("The merge.file command..."); m->mothurOutEndLine();
        }
        catch(exception& e) {
-               errorOut(e, "MergeFileCommand", "help");
+               m->errorOut(e, "MergeFileCommand", "help");
                exit(1);
        }
 }
index d240de6c73c98a705472e5cb50c689041a7b36dc..bf0b82b3973edce4353325d3364010bdadd20c54 100644 (file)
@@ -10,7 +10,7 @@
 #include "mgclustercommand.h"
 
 //**********************************************************************************************************************
-MGClusterCommand::MGClusterCommand(string option){
+MGClusterCommand::MGClusterCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -72,7 +72,7 @@ MGClusterCommand::MGClusterCommand(string option){
                        if (namefile == "not open") { abort = true; }   
                        else if (namefile == "not found") { namefile = ""; }
                        
-                       if ((blastfile == "")) { mothurOut("When executing a mgcluster command you must provide a blastfile."); mothurOutEndLine(); abort = true; }
+                       if ((blastfile == "")) { m->mothurOut("When executing a mgcluster command you must provide a blastfile."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        string temp;
@@ -88,7 +88,7 @@ MGClusterCommand::MGClusterCommand(string option){
                        if (method == "not found") { method = "furthest"; }
                        
                        if ((method == "furthest") || (method == "nearest") || (method == "average")) { }
-                       else { mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); mothurOutEndLine(); abort = true; }
+                       else { m->mothurOut("Not a valid clustering method.  Valid clustering algorithms are furthest, nearest or average."); m->mothurOutEndLine(); abort = true; }
 
                        temp = validParameter.validFile(parameters, "length", false);                   if (temp == "not found") { temp = "5"; }
                        convert(temp, length); 
@@ -108,7 +108,7 @@ MGClusterCommand::MGClusterCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "MGClusterCommand");
+               m->errorOut(e, "MGClusterCommand", "MGClusterCommand");
                exit(1);
        }
 }
@@ -116,23 +116,23 @@ MGClusterCommand::MGClusterCommand(string option){
 
 void MGClusterCommand::help(){
        try {
-               mothurOut("The mgcluster command parameter options are blast, name, cutoff, precision, method, merge, min, length, penalty and hcluster. The blast parameter is required.\n");
-               mothurOut("The mgcluster command reads a blast and name file and clusters the sequences into OPF units similiar to the OTUs.\n");
-               mothurOut("This command outputs a .list, .rabund and .sabund file that can be used with mothur other commands to estimate richness.\n");
-               mothurOut("The cutoff parameter is used to specify the maximum distance you would like to cluster to. The default is 0.70.\n");
-               mothurOut("The precision parameter's default value is 100. \n");
-               mothurOut("The acceptable mgcluster methods are furthest, nearest and average.  If no method is provided then furthest is assumed.\n\n");       
-               mothurOut("The min parameter allows you to specify is you want the minimum or maximum blast score ratio used in calculating the distance. The default is true, meaning you want the minimum.\n");
-               mothurOut("The length parameter is used to specify the minimum overlap required.  The default is 5.\n");
-               mothurOut("The penalty parameter is used to adjust the error rate.  The default is 0.10.\n");
-               mothurOut("The merge parameter allows you to shut off merging based on overlaps and just cluster.  By default merge is true, meaning you want to merge.\n");
-               mothurOut("The hcluster parameter allows you to use the hcluster algorithm when clustering.  This may be neccessary if your file is too large to fit into RAM. The default is false.\n");
-               mothurOut("The mgcluster command should be in the following format: \n");
-               mothurOut("mgcluster(blast=yourBlastfile, name=yourNameFile, cutoff=yourCutOff).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. balst), '=' and parameters (i.e.yourBlastfile).\n\n");
+               m->mothurOut("The mgcluster command parameter options are blast, name, cutoff, precision, method, merge, min, length, penalty and hcluster. The blast parameter is required.\n");
+               m->mothurOut("The mgcluster command reads a blast and name file and clusters the sequences into OPF units similiar to the OTUs.\n");
+               m->mothurOut("This command outputs a .list, .rabund and .sabund file that can be used with mothur other commands to estimate richness.\n");
+               m->mothurOut("The cutoff parameter is used to specify the maximum distance you would like to cluster to. The default is 0.70.\n");
+               m->mothurOut("The precision parameter's default value is 100. \n");
+               m->mothurOut("The acceptable mgcluster methods are furthest, nearest and average.  If no method is provided then furthest is assumed.\n\n");    
+               m->mothurOut("The min parameter allows you to specify is you want the minimum or maximum blast score ratio used in calculating the distance. The default is true, meaning you want the minimum.\n");
+               m->mothurOut("The length parameter is used to specify the minimum overlap required.  The default is 5.\n");
+               m->mothurOut("The penalty parameter is used to adjust the error rate.  The default is 0.10.\n");
+               m->mothurOut("The merge parameter allows you to shut off merging based on overlaps and just cluster.  By default merge is true, meaning you want to merge.\n");
+               m->mothurOut("The hcluster parameter allows you to use the hcluster algorithm when clustering.  This may be neccessary if your file is too large to fit into RAM. The default is false.\n");
+               m->mothurOut("The mgcluster command should be in the following format: \n");
+               m->mothurOut("mgcluster(blast=yourBlastfile, name=yourNameFile, cutoff=yourCutOff).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. balst), '=' and parameters (i.e.yourBlastfile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "help");
+               m->errorOut(e, "MGClusterCommand", "help");
                exit(1);
        }
 }
@@ -323,13 +323,20 @@ int MGClusterCommand::execute(){
        
                globaldata->setListFile(fileroot+ tag + ".list");
                globaldata->setFormat("list");
-                       
-               mothurOut("It took " + toString(time(NULL) - start) + " seconds to cluster."); mothurOutEndLine();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(fileroot+ tag + ".list"); m->mothurOutEndLine();   
+               m->mothurOut(fileroot+ tag + ".rabund"); m->mothurOutEndLine(); 
+               m->mothurOut(fileroot+ tag + ".sabund"); m->mothurOutEndLine(); 
+               m->mothurOutEndLine();
+               
+               m->mothurOut("It took " + toString(time(NULL) - start) + " seconds to cluster."); m->mothurOutEndLine();
                        
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "execute");
+               m->errorOut(e, "MGClusterCommand", "execute");
                exit(1);
        }
 }
@@ -345,7 +352,7 @@ void MGClusterCommand::printData(ListVector* mergedList){
                sabund.print(sabundFile);
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "printData");
+               m->errorOut(e, "MGClusterCommand", "printData");
                exit(1);
        }
 }
@@ -430,7 +437,7 @@ ListVector* MGClusterCommand::mergeOPFs(map<string, int> binInfo, float dist){
                                
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "mergeOPFs");
+               m->errorOut(e, "MGClusterCommand", "mergeOPFs");
                exit(1);
        }
 }
@@ -448,7 +455,7 @@ void MGClusterCommand::sortHclusterFiles(string unsortedDist, string unsortedOve
                overlapFile = sortedOverlapFile;
        }
        catch(exception& e) {
-               errorOut(e, "MGClusterCommand", "sortHclusterFiles");
+               m->errorOut(e, "MGClusterCommand", "sortHclusterFiles");
                exit(1);
        }
 }
index 7acf3894e150f24a8eaaa5bc72f0e752bab4ecc6..ba058ba3fde6d2dd2d25458f88be358f1c7c0408 100644 (file)
 #include "mothur.h"
 #include "engine.hpp"
 #include "globaldata.hpp"
+#include "mothurout.h"
 
 /**************************************************************************************************/
 
 GlobalData* GlobalData::_uniqueInstance = 0;
 CommandFactory* CommandFactory::_uniqueInstance = 0;
+MothurOut* MothurOut::_uniqueInstance = 0;
 
 int main(int argc, char *argv[]){
+       MothurOut* m = MothurOut::getInstance();
        try {
                
-               string log = "mothur.logFile";
-               remove(log.c_str());
+               //string log = "mothur.logFile";
+               //remove(log.c_str());
                
                time_t ltime = time(NULL); /* calendar time */  
                string logFileName = "mothur." + toString(ltime) + ".logfile";
                
+               m->setFileName(logFileName);
+               
                //version
                #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                        system("clear");
                        #if defined (__APPLE__) || (__MACH__)
-                               mothurOutJustToLog("Mac version");
-                               mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutJustToLog("Mac version");
+                               m->mothurOutEndLine(); m->mothurOutEndLine();
                        #else
-                               mothurOutJustToLog("Linux version");
-                               mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutJustToLog("Linux version");
+                               >m->mothurOutEndLine(); m->mothurOutEndLine();
                        #endif
 
                #else
                        system("CLS");
-                       mothurOutJustToLog("Windows version");
-                       mothurOutEndLine(); mothurOutEndLine();
+                       m->mothurOutJustToLog("Windows version");
+                       m->mothurOutEndLine(); m->mothurOutEndLine();
                #endif          
                
                #ifdef USE_READLINE
-                       mothurOutJustToLog("Using ReadLine");
-                       mothurOutEndLine(); mothurOutEndLine();
+                       m->mothurOutJustToLog("Using ReadLine");
+                       m->mothurOutEndLine(); m->mothurOutEndLine();
                #endif
                
                //header
-               mothurOut("mothur v.1.8");
-               mothurOutEndLine();             
-               mothurOut("Last updated: 2/02/2010");
-               mothurOutEndLine();     
-               mothurOutEndLine();             
-               mothurOut("by");
-               mothurOutEndLine();             
-               mothurOut("Patrick D. Schloss");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Department of Microbiology & Immunology");
-               mothurOutEndLine();     
-               mothurOut("University of Michigan");
-               mothurOutEndLine();                     
-               mothurOut("pschloss@umich.edu");
-               mothurOutEndLine();             
-               mothurOut("http://www.mothur.org");
-               mothurOutEndLine();
-               mothurOutEndLine();
-               mothurOut("When using, please cite:");
-               mothurOutEndLine();
-               mothurOut("Schloss, P.D., et al., Introducing mothur: Open-source, platform-independent, community-supported software for describing and comparing microbial communities. Appl Environ Microbiol, 2009. 75(23):7537-41.");
-               mothurOutEndLine();     
-               mothurOutEndLine();             
-               mothurOut("Distributed under the GNU General Public License");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Type 'help()' for information on the commands that are available");
-               mothurOutEndLine();
-               mothurOutEndLine();                     
-               mothurOut("Type 'quit()' to exit program");
-               mothurOutEndLine();     
+               m->mothurOut("mothur v.1.8");
+               m->mothurOutEndLine();          
+               m->mothurOut("Last updated: 2/02/2010");
+               m->mothurOutEndLine();  
+               m->mothurOutEndLine();          
+               m->mothurOut("by");
+               m->mothurOutEndLine();          
+               m->mothurOut("Patrick D. Schloss");
+               m->mothurOutEndLine();
+               m->mothurOutEndLine();                  
+               m->mothurOut("Department of Microbiology & Immunology");
+               m->mothurOutEndLine();  
+               m->mothurOut("University of Michigan");
+               m->mothurOutEndLine();                  
+               m->mothurOut("pschloss@umich.edu");
+               m->mothurOutEndLine();          
+               m->mothurOut("http://www.mothur.org");
+               m->mothurOutEndLine();
+               m->mothurOutEndLine();
+               m->mothurOut("When using, please cite:");
+               m->mothurOutEndLine();
+               m->mothurOut("Schloss, P.D., et al., Introducing mothur: Open-source, platform-independent, community-supported software for describing and comparing microbial communities. Appl Environ Microbiol, 2009. 75(23):7537-41.");
+               m->mothurOutEndLine();  
+               m->mothurOutEndLine();          
+               m->mothurOut("Distributed under the GNU General Public License");
+               m->mothurOutEndLine();
+               m->mothurOutEndLine();                  
+               m->mothurOut("Type 'help()' for information on the commands that are available");
+               m->mothurOutEndLine();
+               m->mothurOutEndLine();                  
+               m->mothurOut("Type 'quit()' to exit program");
+               m->mothurOutEndLine();  
 
                                
                //srand(54321);
@@ -93,20 +98,20 @@ int main(int argc, char *argv[]){
                        input = argv[1];
 
                        if (input[0] == '#') {
-                               mothurOutJustToLog("Script Mode");
-                               mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutJustToLog("Script Mode");
+                               m->mothurOutEndLine(); m->mothurOutEndLine();
 
                                mothur = new ScriptEngine(argv[0], argv[1]);
                        }else{
-                               mothurOutJustToLog("Batch Mode");
-                               mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutJustToLog("Batch Mode");
+                               m->mothurOutEndLine(); m->mothurOutEndLine();
                                
                                mothur = new BatchEngine(argv[0], argv[1]);
                        }
                }
                else{
-                       mothurOutJustToLog("Interactive Mode");
-                       mothurOutEndLine(); mothurOutEndLine();
+                       m->mothurOutJustToLog("Interactive Mode");
+                       m->mothurOutEndLine(); m->mothurOutEndLine();
                        
                        mothur = new InteractEngine(argv[0]);   
                }
@@ -114,17 +119,17 @@ int main(int argc, char *argv[]){
                while(bail == 0)                {       bail = mothur->getInput();                      }
                
                string outputDir = mothur->getOutputDir();
-               logFileName = outputDir + logFileName;
+               string newlogFileName = outputDir + logFileName;
        
-               //need this because mothur.h makes the logfile, but doesn't know where to put it
-               rename(log.c_str(), logFileName.c_str()); //logfile with timestamp
+               //need this because m->mothurOut makes the logfile, but doesn't know where to put it
+               rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
                
                delete mothur;
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "main");
+               m->errorOut(e, "mothur", "main");
                exit(1);
        }
 }
index 5f8a2fe75b41d57e345d50cb63606921c866ff67..db11ed17238ac25f9fc2979431afbb0bdcbb8ec3 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -198,7 +198,7 @@ inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
        
        fileHandle.open(fileName.c_str(), ios::app);
        if(!fileHandle) {
-               cout << "Error: Could not open " <<  fileName << endl; 
+               cout << "Error: Could not open " << fileName << endl;
                return 1;
        }
        else {
@@ -240,74 +240,6 @@ inline string getline(ifstream& fileHandle) {
        }
 }
 
-/**************************************************************************************************/
-
-inline void mothurOut(string message) {
-       try{
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               cout << message;
-               out << message;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               cout << "Error in mothur class mothurOut" << endl;
-               exit(1);
-       }
-}
-/**************************************************************************************************/
-
-inline void mothurOut(string message, string precision) {
-       try{
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               cout << precision << message;
-               out << precision << message;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               cout << "Error in mothur class mothurOut" << endl;
-               exit(1);
-       }
-}
-
-/**************************************************************************************************/
-
-inline void mothurOutEndLine() {
-       try {
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               cout << endl;  
-               out << endl;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               cout << "error in mothur mothurOutEndLine" << endl;
-               exit(1);
-       }
-}
-
-
-/**************************************************************************************************/
-
-inline void errorOut(exception& e, string object, string function) {
-       
-               mothurOut("Error: ");
-               mothurOut(toString(e.what()));
-               mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
-               mothurOutEndLine();
-       
-}
-
 /***********************************************************************/
 
 inline bool isTrue(string f){
@@ -475,7 +407,7 @@ inline bool isBlank(string fileName){
        ifstream fileHandle;
        fileHandle.open(fileName.c_str());
        if(!fileHandle) {
-               mothurOut("Error: Could not open " + fileName);  mothurOutEndLine();
+               cout << "Error: Could not open " << fileName << endl;
                return false;
        }else {
                //check for blank file
@@ -488,6 +420,7 @@ inline bool isBlank(string fileName){
 
 inline string getFullPathName(string fileName){
        try{
+       
        string path = hasPath(fileName);
        string newFileName;
        int pos;
@@ -535,7 +468,7 @@ inline string getFullPathName(string fileName){
                                }else if (path[(pos-1)] == '/') { //you want the current working dir ./
                                        path = path.substr(0, pos);
                                }else if (pos == 1) { break; 
-                               }else {  mothurOut("cannot resolve path for " + fileName); mothurOutEndLine(); return fileName; }
+                               }else { cout << "cannot resolve path for " <<  fileName << endl; return fileName; }
                        }
                
                        for (int i = index; i >= 0; i--) {
@@ -575,7 +508,7 @@ inline string getFullPathName(string fileName){
                                }else if (path[(pos-1)] == '\\') { //you want the current working dir ./
                                        path = path.substr(0, pos);
                                }else if (pos == 1) { break; 
-                               }else {  mothurOut("cannot resolve path for " + fileName); mothurOutEndLine(); return fileName; }
+                               }else {  cout << "cannot resolve path for " <<  fileName << endl;  return fileName; }
                        }
                
                        for (int i = index; i >= 0; i--) {
@@ -588,11 +521,9 @@ inline string getFullPathName(string fileName){
        }
        }
        catch(exception& e) {
-               errorOut(e, "getFullPathName", "getFullPathName");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function getFullPathName. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
-       
-       
+       }       
 }
 /***********************************************************************/
 
@@ -613,18 +544,19 @@ inline int openInputFile(string fileName, ifstream& fileHandle, string m){
 /***********************************************************************/
 
 inline int openInputFile(string fileName, ifstream& fileHandle){
+       
        //get full path name
        string completeFileName = getFullPathName(fileName);
 
        fileHandle.open(completeFileName.c_str());
        if(!fileHandle) {
-               mothurOut("Error: Could not open " + completeFileName);  mothurOutEndLine();
+               cout << "Error: Could not open " << completeFileName << endl;
                return 1;
        }
        else {
                //check for blank file
                gobble(fileHandle);
-               if (fileHandle.eof()) { mothurOut(completeFileName + " is blank. Please correct."); mothurOutEndLine();  return 1;  }
+               if (fileHandle.eof()) { cout << completeFileName << " is blank. Please correct." << endl;  return 1;  }
                
                return 0;
        }
@@ -656,12 +588,12 @@ inline int renameFile(string oldName, string newName){
 /***********************************************************************/
 
 inline int openOutputFile(string fileName, ofstream& fileHandle){
-
+       
        string completeFileName = getFullPathName(fileName);
        
        fileHandle.open(completeFileName.c_str(), ios::trunc);
        if(!fileHandle) {
-               mothurOut("Error: Could not open " + completeFileName);  mothurOutEndLine();
+               cout << "Error: Could not open " << completeFileName << endl;
                return 1;
        }
        else {
@@ -707,9 +639,9 @@ inline void splitAtDash(string& estim, vector<string>& container) {
                container.push_back(estim);
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtDash");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtDash. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 
 /***********************************************************************/
@@ -729,9 +661,9 @@ inline void splitAtDash(string& estim, set<string>& container) {
                container.insert(estim);
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtDash");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtDash. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /***********************************************************************/
 //This function parses the line options and puts them in a set
@@ -753,9 +685,9 @@ inline void splitAtDash(string& estim, set<int>& container) {
                container.insert(lineNum);
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtDash");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtDash. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /***********************************************************************/
 //This function parses the a string and puts peices in a vector
@@ -774,9 +706,9 @@ inline void splitAtComma(string& estim, vector<string>& container) {
                container.push_back(estim);
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtComma");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtComma. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /***********************************************************************/
 
@@ -793,9 +725,9 @@ inline void splitAtComma(string& prefix, string& suffix){
 
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtComma");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtComma. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /***********************************************************************/
 
@@ -813,9 +745,9 @@ inline void splitAtEquals(string& key, string& value){
                }
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "splitAtEquals");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtEquals. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /**************************************************************************************************/
 
@@ -827,9 +759,9 @@ inline bool inUsersGroups(string groupname, vector<string> Groups) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "inUsersGroups");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function inUsersGroups. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /**************************************************************************************************/
 //returns true if any of the strings in first vector are in second vector
@@ -842,72 +774,17 @@ inline bool inUsersGroups(vector<string> groupnames, vector<string> Groups) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "inUsersGroups");
-               exit(1);
-       }
-}
-
-/**************************************************************************************************/
-
-inline void mothurOutJustToLog(string message) {
-       try {
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               out << message;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               errorOut(e, "mothur", "mothurOutJustToLog");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function inUsersGroups. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
-}
-
-
-/**************************************************************************************************/
-
-inline void mothurOut(float num) {
-       try {
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               cout << num;  
-               out << num;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               cout << "Error in mothur class mothurOut float" << endl;
-               exit(1);
-       }
-}
-/***********************************************************************/
-inline void mothurOut(double value) {
-       try {
-               ofstream out;
-               string logFileName = "mothur.logFile";
-               openOutputFileAppend(logFileName, out);
-               
-               cout << value;  
-               out << value;
-               
-               out.close();
-       }
-       catch(exception& e) {
-               cout << "Error in mothur class mothurOut double" << endl;
-               exit(1);
-       }
+       }       
 }
-
 /***********************************************************************/
 //this function determines if the user has given us labels that are smaller than the given label.
 //if so then it returns true so that the calling function can run the previous valid distance.
 //it's a "smart" distance function.  It also checks for invalid labels.
 inline bool anyLabelsToProcess(string label, set<string>& userLabels, string errorOff) {
        try {
+               
                set<string>::iterator it;
                vector<float> orderFloat;
                map<string, float> userMap;  //the conversion process removes trailing 0's which we need to put back
@@ -931,7 +808,7 @@ inline bool anyLabelsToProcess(string label, set<string>& userLabels, string err
                                orderFloat.push_back(-1.0);
                                userMap["unique"] = -1.0;
                        }else {
-                               if (errorOff == "") {  mothurOut(*it + " is not a valid label."); mothurOutEndLine();  }
+                               if (errorOff == "") {  cout << *it << " is not a valid label." << endl;  }
                                userLabels.erase(*it); 
                                it--;
                        }
@@ -949,11 +826,11 @@ inline bool anyLabelsToProcess(string label, set<string>& userLabels, string err
                        if (orderFloat[i] < labelFloat) {
                                smaller = true;
                                if (orderFloat[i] == -1) { 
-                                       if (errorOff == "") { mothurOut("Your file does not include the label unique."); mothurOutEndLine(); }
+                                       if (errorOff == "") { cout << "Your file does not include the label unique." << endl; }
                                        userLabels.erase("unique");
                                }
                                else {  
-                                       if (errorOff == "") { mothurOut("Your file does not include the label "); mothurOutEndLine(); }
+                                       if (errorOff == "") { cout << "Your file does not include the label " << endl; }
                                        string s = "";
                                        for (it2 = userMap.begin(); it2!= userMap.end(); it2++) {  
                                                if (it2->second == orderFloat[i]) {  
@@ -963,7 +840,7 @@ inline bool anyLabelsToProcess(string label, set<string>& userLabels, string err
                                                        break;
                                                }
                                        }
-                                       if (errorOff == "") { mothurOut(s + ". I will use the next smallest distance. "); mothurOutEndLine(); }
+                                       if (errorOff == "") {cout << s <<  ". I will use the next smallest distance. " << endl; }
                                }
                        //since they are sorted once you find a bigger one stop looking
                        }else { break; }
@@ -973,9 +850,9 @@ inline bool anyLabelsToProcess(string label, set<string>& userLabels, string err
                                                
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "anyLabelsToProcess");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function anyLabelsToProcess. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 
 /**************************************************************************************************/
@@ -997,9 +874,9 @@ inline void appendFiles(string temp, string filename) {
                output.close();
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "appendFiles");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function appendFiles. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 
 /**************************************************************************************************/
@@ -1060,9 +937,9 @@ inline string sortFile(string distFile){
                return outfile;
        }
        catch(exception& e) {
-               errorOut(e, "mothur", "sortFile");
+               cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function sortfile. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n";
                exit(1);
-       }
+       }       
 }
 /**************************************************************************************************/
 #endif
index bc088f45924f4af9db951e81882376cd64fbc8f0..42d374d0b9e74842e4d3f289c75ae61645556ebd 100644 (file)
@@ -5,7 +5,7 @@
 //**********************************************************************************************************************
 
 NameAssignment::NameAssignment(string nameMapFile){
-       
+       m = MothurOut::getInstance();
        openInputFile(nameMapFile, fileHandle);
        
 }
@@ -36,7 +36,7 @@ void NameAssignment::readMap(){
        
        }
        catch(exception& e) {
-               errorOut(e, "NameAssignment", "readMap");
+               m->errorOut(e, "NameAssignment", "readMap");
                exit(1);
        }
 }
@@ -51,7 +51,7 @@ void NameAssignment::push_back(string name) {
                list.push_back(name);
        }
        catch(exception& e) {
-               errorOut(e, "NameAssignment", "push_back");
+               m->errorOut(e, "NameAssignment", "push_back");
                exit(1);
        }
 }
@@ -75,7 +75,7 @@ void NameAssignment::print(ostream& out){
                }
        }
        catch(exception& e) {
-               errorOut(e, "NameAssignment", "print");
+               m->errorOut(e, "NameAssignment", "print");
                exit(1);
        }
 }
index 3ccb4256524eb67434b0d98fcc1c9d9bf3471935..758a080b9d01ffea80e3b19076a7e0ce8121de0c 100644 (file)
@@ -18,6 +18,7 @@ private:
        ifstream fileHandle;
        ListVector list;
        map<int, string> reverse;
+       MothurOut* m;
 };
 
 
index c91c9fab537172b3e02808b700af881affffc368..4a0b74aa412873b6bf98ee1b9e30e28a9cc8c21f 100644 (file)
--- a/nast.cpp
+++ b/nast.cpp
 
 Nast::Nast(Alignment* method, Sequence* cand, Sequence* temp) : alignment(method), candidateSeq(cand), templateSeq(temp) {
        try {
+               m = MothurOut::getInstance();
                maxInsertLength = 0;
                pairwiseAlignSeqs();    //      This is part A in Fig. 2 of DeSantis et al.
                regapSequences();               //      This is parts B-F in Fig. 2 of DeSantis et al.
        }
        catch(exception& e) {
-               errorOut(e, "Nast", "Nast");
+               m->errorOut(e, "Nast", "Nast");
                exit(1);
        }
 }
@@ -78,7 +79,7 @@ void Nast::pairwiseAlignSeqs(){       //      Here we call one of the pairwise alignment me
                templateSeq->setPairwise(tempAln);                                      //      the candidate and template sequences
        }
        catch(exception& e) {
-               errorOut(e, "Nast", "pairwiseAlignSeqs");
+               m->errorOut(e, "Nast", "pairwiseAlignSeqs");
                exit(1);
        }       
 }
@@ -199,7 +200,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl
                }
        }
        catch(exception& e) {
-               errorOut(e, "Nast", "removeExtraGaps");
+               m->errorOut(e, "Nast", "removeExtraGaps");
                exit(1);
        }       
 }
@@ -302,14 +303,14 @@ void Nast::regapSequences(){      //This is essentially part B in Fig 2. of DeSantis
                                //      would skip the gaps and not progress through full alignment sequence
                                //      not tested yet
                                
-                               mothurOut("We're into D " + toString(fullAlignIndex) + " " +  toString(pairwiseAlignIndex)); mothurOutEndLine();
+                               m->mothurOut("We're into D " + toString(fullAlignIndex) + " " +  toString(pairwiseAlignIndex)); m->mothurOutEndLine();
                                pairwiseAlignIndex++;
                        }
                        else{
                                //      everything has a gap - not possible
                                //      not tested yet
                                
-                               mothurOut("We're into F " +  toString(fullAlignIndex) + " " +  toString(pairwiseAlignIndex)); mothurOutEndLine();
+                               m->mothurOut("We're into F " +  toString(fullAlignIndex) + " " +  toString(pairwiseAlignIndex)); m->mothurOutEndLine();
                                pairwiseAlignIndex++;
                                fullAlignIndex++;                       
                        }               
@@ -345,7 +346,7 @@ void Nast::regapSequences(){        //This is essentially part B in Fig 2. of DeSantis
                candidateSeq->setAligned(candAln);
        }
        catch(exception& e) {
-               errorOut(e, "Nast", "regapSequences");
+               m->errorOut(e, "Nast", "regapSequences");
                exit(1);
        }       
 }
@@ -380,7 +381,7 @@ float Nast::getSimilarityScore(){
                
        }
        catch(exception& e) {
-               errorOut(e, "Nast", "getSimilarityScore");
+               m->errorOut(e, "Nast", "getSimilarityScore");
                exit(1);
        }       
 }
index bc2467f13c3d65fe41309ffb6de13ffdbaafd7c4..9428aed0446ce1236d23342467c80950cf64ab7f 100644 (file)
--- a/nast.hpp
+++ b/nast.hpp
@@ -19,6 +19,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 class Alignment;
 class Sequence;
@@ -43,6 +44,7 @@ private:
        Sequence* templateSeq;
        
        int maxInsertLength;
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index 80ba4ca0aec06ea796a5a9bd7fbe7522f362157a..d13925e3cff9f54c61df9435b7f9cb36f9468e34 100644 (file)
@@ -24,8 +24,8 @@
 
 /**************************************************************************************************/
 
-NeedlemanOverlap::NeedlemanOverlap(float gO, float m, float mm, int r) ://     note that we don't have a gap extend
-gap(gO), match(m), mismatch(mm), Alignment(r) {                                                        //      the gap openning penalty is assessed for
+NeedlemanOverlap::NeedlemanOverlap(float gO, float f, float mm, int r) ://     note that we don't have a gap extend
+gap(gO), match(f), mismatch(mm), Alignment(r) {                                                        //      the gap openning penalty is assessed for
        try {                                                                                                                                   //      every gapped position
                for(int i=1;i<nCols;i++){
                        alignment[0][i].prevCell = 'l';                                 //      initialize first row by pointing all poiters to the left
@@ -39,7 +39,7 @@ gap(gO), match(m), mismatch(mm), Alignment(r) {                                                       //      the gap openning penalt
        
        }
        catch(exception& e) {
-               errorOut(e, "NeedlemanOverlap", "NeedlemanOverlap");
+               m->errorOut(e, "NeedlemanOverlap", "NeedlemanOverlap");
                exit(1);
        }
 }
@@ -54,7 +54,7 @@ void NeedlemanOverlap::align(string A, string B){
                seqA = ' ' + A; lA = seqA.length();             //      algorithm requires a dummy space at the beginning of each string
                seqB = ' ' + B; lB = seqB.length();             //      algorithm requires a dummy space at the beginning of each string
 
-               if (lA > nRows) { mothurOut("One of your candidate sequences is longer than you longest template sequence. Your longest template sequence is " + toString(nRows) + ". Your candidate is " + toString(lA) + "."); mothurOutEndLine();  }
+               if (lA > nRows) { m->mothurOut("One of your candidate sequences is longer than you longest template sequence. Your longest template sequence is " + toString(nRows) + ". Your candidate is " + toString(lA) + "."); m->mothurOutEndLine();  }
                
                for(int i=1;i<lB;i++){                                  //      This code was largely translated from Perl code provided in Ex 3.1 
                        for(int j=1;j<lA;j++){                          //      of the O'Reilly BLAST book.  I found that the example output had a
@@ -95,7 +95,7 @@ void NeedlemanOverlap::align(string A, string B){
        
        }
        catch(exception& e) {
-               errorOut(e, "NeedlemanOverlap", "align");
+               m->errorOut(e, "NeedlemanOverlap", "align");
                exit(1);
        }
 
index b519d77459e984020ba94a3331ba8851b076e0ae..459ac5cfe8d0d79ff86569c4c090a0ae84d6c52c 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-NoCommand::NoCommand(string option){}
+NoCommand::NoCommand(string option)  {}
 
 //**********************************************************************************************************************
 
@@ -21,7 +21,7 @@ NoCommand::~NoCommand(){}
 
 int NoCommand::execute(){
        //Could choose to give more help here?fdsah
-       mothurOut("Invalid command.\n");
+       cout << "Invalid command.\n";
        
        CommandFactory* valid =  CommandFactory::getInstance();
        valid->printCommands(cout);
index fda649cda2ecd9b6d4c00e4baab3c0f052bd80ad..f14f92276d3d2f770364dcd7c4953f1d7f3b67a4 100644 (file)
@@ -43,7 +43,7 @@ EstOutput NPShannon::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "NPShannon", "getValues");
+               m->errorOut(e, "NPShannon", "getValues");
                exit(1);
        }
 }
index 8f0e29d2deee52f5996da965f12e58dc66572d95..c50d5a3107bb8c88f7dc251831873cfdd0d68e2b 100644 (file)
@@ -13,7 +13,7 @@
 
 OptionParser::OptionParser(string option) {
        try {
-               
+               m = MothurOut::getInstance();
                if (option != "") {
                        
                        string key, value;              
@@ -30,7 +30,7 @@ OptionParser::OptionParser(string option) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "OptionParser", "parse");
+               m->errorOut(e, "OptionParser", "parse");
                exit(1);
        }
 }
index dab14debe385472c35f5f405aa8e12b8b1dabcf0..7707e739ce15d7e0dd6657bc08a288222dfbdbb0 100644 (file)
@@ -13,6 +13,7 @@
 
 
 #include "mothur.h"
+#include "mothurout.h"
 
 
 /***********************************************************************/
@@ -24,6 +25,7 @@ public:
        map<string, string> getParameters();
 private:
        map<string, string> parameters;
+       MothurOut* m;
 };
 
 /***********************************************************************/
index 360c898259f8742446c3488289cf4231221c0703..27c1e934fa8a70c18e84235365a78231bf8ce6e9 100644 (file)
@@ -47,7 +47,7 @@ OrderVector::OrderVector(ifstream& f) : DataVector() {
                updateStats();
        }
        catch(exception& e) {
-               errorOut(e, "OrderVector", "OrderVector");
+               m->errorOut(e, "OrderVector", "OrderVector");
                exit(1);
        }
 }
@@ -112,7 +112,7 @@ void OrderVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "OrderVector", "print");
+               m->errorOut(e, "OrderVector", "print");
                exit(1);
        }
 }
@@ -129,7 +129,7 @@ void OrderVector::print(string prefix, ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "OrderVector", "print");
+               m->errorOut(e, "OrderVector", "print");
                exit(1);
        }
 }
@@ -137,7 +137,7 @@ void OrderVector::print(string prefix, ostream& output){
 /***********************************************************************/
 
 void OrderVector::resize(int){
-       mothurOut("resize() did nothing in class OrderVector");
+       m->mothurOut("resize() did nothing in class OrderVector");
 }
 
 /***********************************************************************/
@@ -179,7 +179,7 @@ RAbundVector OrderVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "OrderVector", "getRAbundVector");
+               m->errorOut(e, "OrderVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -228,7 +228,7 @@ void OrderVector::updateStats(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "OrderVector", "updateStats");
+               m->errorOut(e, "OrderVector", "updateStats");
                exit(1);
        }
 }
index c39a638cf11375644a82e4d56c3c5659c56b35ee..a8a3531a67e97dd8669bbc24b83d2e930356e98c 100644 (file)
 #include "otuhierarchycommand.h"
 
 //**********************************************************************************************************************
-OtuHierarchyCommand::OtuHierarchyCommand(string option){
+OtuHierarchyCommand::OtuHierarchyCommand(string option) {
        try {
                abort = false;
+               
                //allow user to run help
                if(option == "help") {  help(); abort = true; }
                
@@ -47,7 +48,7 @@ OtuHierarchyCommand::OtuHierarchyCommand(string option){
                        }
 
                        listFile = validParameter.validFile(parameters, "list", true);
-                       if (listFile == "not found") { mothurOut("list is a required parameter for the otu.hierarchy command."); mothurOutEndLine(); abort = true; }
+                       if (listFile == "not found") { m->mothurOut("list is a required parameter for the otu.hierarchy command."); m->mothurOutEndLine(); abort = true; }
                        else if (listFile == "not open") { abort = true; }      
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -59,20 +60,20 @@ OtuHierarchyCommand::OtuHierarchyCommand(string option){
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
                        label = validParameter.validFile(parameters, "label", false);                   
-                       if (label == "not found") { mothurOut("label is a required parameter for the otu.hierarchy command."); mothurOutEndLine(); abort = true; }
+                       if (label == "not found") { m->mothurOut("label is a required parameter for the otu.hierarchy command."); m->mothurOutEndLine(); abort = true; }
                        else { 
                                splitAtDash(label, labels);
-                               if (labels.size() != 2) { mothurOut("You must provide 2 labels."); mothurOutEndLine(); abort = true; }
+                               if (labels.size() != 2) { m->mothurOut("You must provide 2 labels."); m->mothurOutEndLine(); abort = true; }
                        }       
                        
                        output = validParameter.validFile(parameters, "output", false);                 if (output == "not found") { output = "name"; }
                        
-                       if ((output != "name") && (output != "number")) { mothurOut("output options are name and number. I will use name."); mothurOutEndLine(); output = "name"; }
+                       if ((output != "name") && (output != "number")) { m->mothurOut("output options are name and number. I will use name."); m->mothurOutEndLine(); output = "name"; }
                }
                
        }
        catch(exception& e) {
-               errorOut(e, "OtuHierarchyCommand", "OtuHierarchyCommand");
+               m->errorOut(e, "OtuHierarchyCommand", "OtuHierarchyCommand");
                exit(1);
        }                       
 }
@@ -80,17 +81,17 @@ OtuHierarchyCommand::OtuHierarchyCommand(string option){
 
 void OtuHierarchyCommand::help(){
        try {
-               mothurOut("The otu.hierarchy command is used to see how otus relate at two distances. \n");
-               mothurOut("The otu.hierarchy command parameters are list, label and output.  list and label parameters are required. \n");
-               mothurOut("The output parameter allows you to output the names of the sequence in the OTUs or the OTU numbers. Options are name and number, default is name. \n");
-               mothurOut("The otu.hierarchy command should be in the following format: \n");
-               mothurOut("otu.hierarchy(list=yourListFile, label=yourLabels).\n");
-               mothurOut("Example otu.hierarchy(list=amazon.fn.list, label=0.01-0.03).\n");
-               mothurOut("The otu.hierarchy command outputs a .otu.hierarchy file which is described on the wiki.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n");
+               m->mothurOut("The otu.hierarchy command is used to see how otus relate at two distances. \n");
+               m->mothurOut("The otu.hierarchy command parameters are list, label and output.  list and label parameters are required. \n");
+               m->mothurOut("The output parameter allows you to output the names of the sequence in the OTUs or the OTU numbers. Options are name and number, default is name. \n");
+               m->mothurOut("The otu.hierarchy command should be in the following format: \n");
+               m->mothurOut("otu.hierarchy(list=yourListFile, label=yourLabels).\n");
+               m->mothurOut("Example otu.hierarchy(list=amazon.fn.list, label=0.01-0.03).\n");
+               m->mothurOut("The otu.hierarchy command outputs a .otu.hierarchy file which is described on the wiki.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "OtuHierarchyCommand", "help");
+               m->errorOut(e, "OtuHierarchyCommand", "help");
                exit(1);
        }
 }
@@ -116,7 +117,7 @@ int OtuHierarchyCommand::execute(){
                                reverse(lists.begin(), lists.end());
                        }
                }else{
-                       mothurOut("error getting listvectors, unable to read 2 different vectors, check your label inputs."); mothurOutEndLine(); return 0;
+                       m->mothurOut("error getting listvectors, unable to read 2 different vectors, check your label inputs."); m->mothurOutEndLine(); return 0;
                }
                
                //map sequences to bin number in the "little" otu
@@ -173,10 +174,15 @@ int OtuHierarchyCommand::execute(){
                
                out.close();
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outputFileName); m->mothurOutEndLine();    
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "OtuHierarchyCommand", "execute");
+               m->errorOut(e, "OtuHierarchyCommand", "execute");
                exit(1);
        }
 }
@@ -264,12 +270,12 @@ vector<ListVector> OtuHierarchyCommand::getListVectors() {
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -293,7 +299,7 @@ vector<ListVector> OtuHierarchyCommand::getListVectors() {
                return lists;
        }
        catch(exception& e) {
-               errorOut(e, "OtuHierarchyCommand", "getListVectors");
+               m->errorOut(e, "OtuHierarchyCommand", "getListVectors");
                exit(1);
        }
 }
index ce014fcaf439d2d838cd630cbb5b012f2c8b8efe..4838988346bb962d7ef91d32c483cf2e379f5895 100644 (file)
@@ -14,7 +14,7 @@ ParseListCommand::ParseListCommand(string option)  {
        try {
                abort = false;
                allLines = 1;
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -76,7 +76,7 @@ ParseListCommand::ParseListCommand(string option)  {
                        }
                        
                        //do you have all files needed
-                       if ((listfile == "") || (groupfile == "")) { mothurOut("You must enter both a listfile and groupfile for the parse.list command. "); mothurOutEndLine(); abort = true;  }
+                       if ((listfile == "") || (groupfile == "")) { m->mothurOut("You must enter both a listfile and groupfile for the parse.list command. "); m->mothurOutEndLine(); abort = true;  }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -90,24 +90,24 @@ ParseListCommand::ParseListCommand(string option)  {
 
        }
        catch(exception& e) {
-               errorOut(e, "ParseListCommand", "ParseListCommand");
+               m->errorOut(e, "ParseListCommand", "ParseListCommand");
                exit(1);
        }
 }
 //**********************************************************************************************************************
 void ParseListCommand::help(){
        try {
-               mothurOut("The parse.list command reads a list and group file and generates a list file for each group in the groupfile \n");
-               mothurOut("The parse.list command parameters are list, group and label.\n");
-               mothurOut("The list and group parameters are required.\n");
-               mothurOut("The label parameter is used to read specific labels in your input you want to use.\n");
-               mothurOut("The parse.list command should be used in the following format: parse.list(list=yourListFile, group=yourGroupFile, label=yourLabels).\n");
-               mothurOut("Example: parse.list(list=abrecovery.fn.list, group=abrecovery.groups, label=0.03).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
+               m->mothurOut("The parse.list command reads a list and group file and generates a list file for each group in the groupfile \n");
+               m->mothurOut("The parse.list command parameters are list, group and label.\n");
+               m->mothurOut("The list and group parameters are required.\n");
+               m->mothurOut("The label parameter is used to read specific labels in your input you want to use.\n");
+               m->mothurOut("The parse.list command should be used in the following format: parse.list(list=yourListFile, group=yourGroupFile, label=yourLabels).\n");
+               m->mothurOut("Example: parse.list(list=abrecovery.fn.list, group=abrecovery.groups, label=0.03).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "ParseListCommand", "help");
+               m->errorOut(e, "ParseListCommand", "help");
                exit(1);
        }
 }
@@ -121,6 +121,7 @@ int ParseListCommand::execute(){
                
                //set fileroot
                string fileroot = outputDir + getRootName(getSimpleName(listfile));
+               vector<string> outputNames;
                
                //fill filehandles with neccessary ofstreams
                int i;
@@ -130,6 +131,7 @@ int ParseListCommand::execute(){
                        filehandles[groupMap->namesOfGroups[i]] = temp;
                        
                        string filename = fileroot +  groupMap->namesOfGroups[i] + ".list";
+                       outputNames.push_back(filename);
                        openOutputFile(filename, *temp);
                }
                
@@ -146,7 +148,7 @@ int ParseListCommand::execute(){
                        if(allLines == 1 || labels.count(list->getLabel()) == 1){
                                        
                                        parse(list);
-                                       mothurOut(list->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                                        
                                        processedLabels.insert(list->getLabel());
                                        userLabels.erase(list->getLabel());
@@ -159,7 +161,7 @@ int ParseListCommand::execute(){
                                        list = input->getListVector(lastLabel); //get new list vector to process
                                        
                                        parse(list);
-                                       mothurOut(list->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                                        
                                        processedLabels.insert(list->getLabel());
                                        userLabels.erase(list->getLabel());
@@ -179,12 +181,12 @@ int ParseListCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
 
                }
@@ -195,7 +197,7 @@ int ParseListCommand::execute(){
                        list = input->getListVector(lastLabel); //get new list vector to process
                        
                        parse(list);            
-                       mothurOut(list->getLabel()); mothurOutEndLine();
+                       m->mothurOut(list->getLabel()); m->mothurOutEndLine();
                        
                        delete list;
                }
@@ -207,10 +209,15 @@ int ParseListCommand::execute(){
                
                delete groupMap;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ParseListCommand", "execute");
+               m->errorOut(e, "ParseListCommand", "execute");
                exit(1);
        }
 }
@@ -241,7 +248,7 @@ void ParseListCommand::parse(ListVector* thisList) {
                        for (int j = 0; j < names.size(); j++) {
                                string group = groupMap->getGroup(names[j]);
                                
-                               if (group == "not found") { mothurOut(names[j] + " is not in your groupfile. please correct."); mothurOutEndLine(); exit(1); }
+                               if (group == "not found") { m->mothurOut(names[j] + " is not in your groupfile. please correct."); m->mothurOutEndLine(); exit(1); }
                                
                                itGroup = groupBins.find(group);
                                if(itGroup == groupBins.end()) {
@@ -267,7 +274,7 @@ void ParseListCommand::parse(ListVector* thisList) {
 
        }
        catch(exception& e) {
-               errorOut(e, "ParseListCommand", "parse");
+               m->errorOut(e, "ParseListCommand", "parse");
                exit(1);
        }
 }
index db6ed1d862d4ee3d9a4037b672ee63cdcacd03a6..16c7748e76a50337df471e414543ac982a19a6b0 100644 (file)
@@ -123,7 +123,7 @@ EstOutput Parsimony::getValues(Tree* t) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Parsimony", "getValues");
+               m->errorOut(e, "Parsimony", "getValues");
                exit(1);
        }
 }
index da997c13b0c150369e15d94ccabb95f8dc3b8d26..393c0f8930eac7649ba18f0dc7db344ed9ebed56 100644 (file)
 #include "parsimonycommand.h"
 
 /***********************************************************/
-ParsimonyCommand::ParsimonyCommand(string option) {
+ParsimonyCommand::ParsimonyCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                Groups.clear();
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -39,7 +39,7 @@ ParsimonyCommand::ParsimonyCommand(string option) {
                        //are you trying to use parsimony without reading a tree or saying you want random distribution
                        if (randomtree == "")  {
                                if (globaldata->gTree.size() == 0) {
-                                       mothurOut("You must read a treefile and a groupfile or set the randomtree parameter to the output filename you wish, before you may execute the parsimony command."); mothurOutEndLine(); abort = true;  }
+                                       m->mothurOut("You must read a treefile and a groupfile or set the randomtree parameter to the output filename you wish, before you may execute the parsimony command."); m->mothurOutEndLine(); abort = true;  }
                        }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -66,15 +66,18 @@ ParsimonyCommand::ParsimonyCommand(string option) {
                                        
                                        if(outputDir == "") { outputDir += hasPath(globaldata->getTreeFile()); }
                                        output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile())  +  ".parsimony", itersString);
+                                       outputNames.push_back(outputDir + getSimpleName(globaldata->getTreeFile())  +  ".parsimony");
                                        
                                        sumFile = outputDir + getSimpleName(globaldata->getTreeFile()) + ".psummary";
                                        openOutputFile(sumFile, outSum);
+                                       outputNames.push_back(sumFile);
                                }else { //user wants random distribution
                                        savetmap = globaldata->gTreemap;
                                        getUserInput();
                                        
                                        if(outputDir == "") { outputDir += hasPath(randomtree); }
                                        output = new ColumnFile(outputDir+ getSimpleName(randomtree), itersString);
+                                       outputNames.push_back(outputDir+ getSimpleName(randomtree));
                                }
                                
                                //set users groups to analyze
@@ -93,7 +96,7 @@ ParsimonyCommand::ParsimonyCommand(string option) {
 
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "ParsimonyCommand");
+               m->errorOut(e, "ParsimonyCommand", "ParsimonyCommand");
                exit(1);
        }
 }
@@ -102,18 +105,18 @@ ParsimonyCommand::ParsimonyCommand(string option) {
 
 void ParsimonyCommand::help(){
        try {
-               mothurOut("The parsimony command can only be executed after a successful read.tree command, unless you use the random parameter.\n");
-               mothurOut("The parsimony command parameters are random, groups and iters.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 1 valid group.\n");
-               mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
-               mothurOut("The parsimony command should be in the following format: parsimony(random=yourOutputFilename, groups=yourGroups, iters=yourIters).\n");
-               mothurOut("Example parsimony(random=out, iters=500).\n");
-               mothurOut("The default value for random is "" (meaning you want to use the trees in your inputfile, randomtree=out means you just want the random distribution of trees outputted to out.rd_parsimony),\n");
-               mothurOut("and iters is 1000.  The parsimony command output two files: .parsimony and .psummary their descriptions are in the manual.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. random), '=' and parameters (i.e.yourOutputFilename).\n\n");
+               m->mothurOut("The parsimony command can only be executed after a successful read.tree command, unless you use the random parameter.\n");
+               m->mothurOut("The parsimony command parameters are random, groups and iters.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 1 valid group.\n");
+               m->mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
+               m->mothurOut("The parsimony command should be in the following format: parsimony(random=yourOutputFilename, groups=yourGroups, iters=yourIters).\n");
+               m->mothurOut("Example parsimony(random=out, iters=500).\n");
+               m->mothurOut("The default value for random is "" (meaning you want to use the trees in your inputfile, randomtree=out means you just want the random distribution of trees outputted to out.rd_parsimony),\n");
+               m->mothurOut("and iters is 1000.  The parsimony command output two files: .parsimony and .psummary their descriptions are in the manual.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. random), '=' and parameters (i.e.yourOutputFilename).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "help");
+               m->errorOut(e, "ParsimonyCommand", "help");
                exit(1);
        }
 }
@@ -268,11 +271,17 @@ int ParsimonyCommand::execute() {
                //reset groups parameter
                globaldata->Groups.clear(); 
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
+               
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "execute");
+               m->errorOut(e, "ParsimonyCommand", "execute");
                exit(1);
        }
 }
@@ -305,7 +314,7 @@ void ParsimonyCommand::printParsimonyFile() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "printParsimonyFile");
+               m->errorOut(e, "ParsimonyCommand", "printParsimonyFile");
                exit(1);
        }
 }
@@ -314,7 +323,7 @@ void ParsimonyCommand::printUSummaryFile() {
        try {
                //column headers
                outSum << "Tree#" << '\t' << "Groups" << '\t'  <<  "ParsScore" << '\t' << "ParsSig" <<  endl;
-               mothurOut("Tree#\tGroups\tParsScore\tParsSig"); mothurOutEndLine();
+               m->mothurOut("Tree#\tGroups\tParsScore\tParsSig"); m->mothurOutEndLine();
                
                //format output
                outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
@@ -326,11 +335,11 @@ void ParsimonyCommand::printUSummaryFile() {
                                if (UScoreSig[a][i] > (1/(float)iters)) {
                                        outSum << setprecision(6) << i+1 << '\t' << groupComb[a]  << '\t' << userTreeScores[a][i] << setprecision(itersString.length()) << '\t' << UScoreSig[a][i] << endl;
                                        cout << setprecision(6) << i+1 << '\t' << groupComb[a]  << '\t' << userTreeScores[a][i] << setprecision(itersString.length()) << '\t' << UScoreSig[a][i] << endl;
-                                       mothurOutJustToLog(toString(i+1) + "\t" + groupComb[a] + "\t" + toString(userTreeScores[a][i]) + "\t" + toString(UScoreSig[a][i])); mothurOutEndLine();
+                                       m->mothurOutJustToLog(toString(i+1) + "\t" + groupComb[a] + "\t" + toString(userTreeScores[a][i]) + "\t" + toString(UScoreSig[a][i])); m->mothurOutEndLine();
                                }else {
                                        outSum << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(itersString.length())  << '\t' << "<" << (1/float(iters)) << endl;
                                        cout << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(itersString.length()) << '\t' << "<" << (1/float(iters)) << endl;
-                                       mothurOutJustToLog(toString(i+1) + "\t" + groupComb[a] + "\t" + toString(userTreeScores[a][i]) + "\t" + toString((1/float(iters)))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(toString(i+1) + "\t" + groupComb[a] + "\t" + toString(userTreeScores[a][i]) + "\t" + toString((1/float(iters)))); m->mothurOutEndLine();
                                }
                        }
                }
@@ -338,7 +347,7 @@ void ParsimonyCommand::printUSummaryFile() {
                outSum.close();
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "printUSummaryFile");
+               m->errorOut(e, "ParsimonyCommand", "printUSummaryFile");
                exit(1);
        }
 }
@@ -350,18 +359,18 @@ void ParsimonyCommand::getUserInput() {
                //create treemap
                tmap = new TreeMap();
 
-               mothurOut("Please enter the number of groups you would like to analyze: ");
+               m->mothurOut("Please enter the number of groups you would like to analyze: ");
                cin >> numGroups;
-               mothurOutJustToLog(toString(numGroups)); mothurOutEndLine();
+               m->mothurOutJustToLog(toString(numGroups)); m->mothurOutEndLine();
                                
                int num, count;
                count = 1;
                numEachGroup.resize(numGroups, 0);  
                
                for (int i = 1; i <= numGroups; i++) {
-                       mothurOut("Please enter the number of sequences in group " + toString(i) +  ": ");
+                       m->mothurOut("Please enter the number of sequences in group " + toString(i) +  ": ");
                        cin >> num;
-                       mothurOutJustToLog(toString(num)); mothurOutEndLine();
+                       m->mothurOutJustToLog(toString(num)); m->mothurOutEndLine();
                                
                        //set tmaps seqsPerGroup
                        tmap->seqsPerGroup[toString(i)] = num;
@@ -387,7 +396,7 @@ void ParsimonyCommand::getUserInput() {
                
        }
        catch(exception& e) {
-               errorOut(e, "ParsimonyCommand", "getUserInput");
+               m->errorOut(e, "ParsimonyCommand", "getUserInput");
                exit(1);
        }
 }
index f855d86497fa0447cb4ef5b17e454bbe0a116628..071aea8fa742d5fb3172f4ac7dcf61125ae73b90 100644 (file)
@@ -56,7 +56,7 @@ private:
 
        bool abort;
        string groups, itersString;
-       vector<string> Groups; //holds groups to be used
+       vector<string> Groups, outputNames; //holds groups to be used
 
        void printParsimonyFile();  
        void printUSummaryFile();
index c17053e29cb31812f681333078199c9abaea02fa..644473a8baa2b86253118e7b766b0e965fcb80a8 100644 (file)
@@ -12,7 +12,7 @@
 
 //**********************************************************************************************************************
 
-PCACommand::PCACommand(string option){
+PCACommand::PCACommand(string option)  {
        try {
                abort = false;
                
@@ -61,12 +61,12 @@ PCACommand::PCACommand(string option){
                        }
                        
                        //error checking on files       
-                       if (phylipfile == "")   { mothurOut("You must provide a distance file before running the pca command."); mothurOutEndLine(); abort = true; }            
+                       if (phylipfile == "")   { m->mothurOut("You must provide a distance file before running the pca command."); m->mothurOutEndLine(); abort = true; }              
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "PCACommand");
+               m->errorOut(e, "PCACommand", "PCACommand");
                exit(1);
        }
 }
@@ -74,10 +74,10 @@ PCACommand::PCACommand(string option){
 void PCACommand::help(){
        try {
        
-               mothurOut("The pca command..."); mothurOutEndLine();
+               m->mothurOut("The pca command..."); m->mothurOutEndLine();
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "help");
+               m->errorOut(e, "PCACommand", "help");
                exit(1);
        }
 }
@@ -129,10 +129,15 @@ int PCACommand::execute(){
                
                output(fbase, names, G, d);
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "execute");
+               m->errorOut(e, "PCACommand", "execute");
                exit(1);
        }
 }
@@ -152,7 +157,7 @@ void PCACommand::get_comment(istream& f, char begin, char end){
                d = f.peek();
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "get_comment");
+               m->errorOut(e, "PCACommand", "get_comment");
                exit(1);
        }
 }      
@@ -201,7 +206,7 @@ void PCACommand::read_phylip(istream& f, int square_m, vector<string>& name_list
                }
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "read_phylip");
+               m->errorOut(e, "PCACommand", "read_phylip");
                exit(1);
        }
 
@@ -243,7 +248,7 @@ void PCACommand::read(string fname, vector<string>& names, vector<vector<double>
                read_phylip(f, m, names, D);
        }
                catch(exception& e) {
-               errorOut(e, "PCACommand", "read");
+               m->errorOut(e, "PCACommand", "read");
                exit(1);
        }
 }
@@ -275,7 +280,7 @@ void PCACommand::matrix_mult(vector<vector<double> > first, vector<vector<double
                }
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "matrix_mult");
+               m->errorOut(e, "PCACommand", "matrix_mult");
                exit(1);
        }
 
@@ -309,7 +314,7 @@ void PCACommand::recenter(double offset, vector<vector<double> > D, vector<vecto
                matrix_mult(A,C,G);
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "recenter");
+               m->errorOut(e, "PCACommand", "recenter");
                exit(1);
        }
 
@@ -402,7 +407,7 @@ void PCACommand::tred2(vector<vector<double> >& a, vector<double>& d, vector<dou
                }
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "tred2");
+               m->errorOut(e, "PCACommand", "tred2");
                exit(1);
        }
 
@@ -486,7 +491,7 @@ void PCACommand::qtli(vector<double>& d, vector<double>& e, vector<vector<double
                }
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "qtli");
+               m->errorOut(e, "PCACommand", "qtli");
                exit(1);
        }
 }
@@ -508,10 +513,12 @@ void PCACommand::output(string fnameRoot, vector<string> name_list, vector<vecto
                ofstream pcaData((fnameRoot+"pca").c_str(), ios::trunc);
                pcaData.setf(ios::fixed, ios::floatfield);
                pcaData.setf(ios::showpoint);   
+               outputNames.push_back(fnameRoot+"pca");
                
                ofstream pcaLoadings((fnameRoot+"pca.loadings").c_str(), ios::trunc);
                pcaLoadings.setf(ios::fixed, ios::floatfield);
-               pcaLoadings.setf(ios::showpoint);       
+               pcaLoadings.setf(ios::showpoint);
+               outputNames.push_back(fnameRoot+"pca.loadings");        
                
                pcaLoadings << "axis\tloading\n";
                for(int i=0;i<rank;i++){
@@ -533,7 +540,7 @@ void PCACommand::output(string fnameRoot, vector<string> name_list, vector<vecto
                }
        }
        catch(exception& e) {
-               errorOut(e, "PCACommand", "output");
+               m->errorOut(e, "PCACommand", "output");
                exit(1);
        }
 }
index 8a36323582b6ca42f153110c48f012148d59cd2b..220e91f162e75b9b5d5f9d75ecfc6e3474e50549 100644 (file)
@@ -27,6 +27,7 @@ private:
        bool abort;
        string phylipfile, columnfile, namefile, format, filename, fbase, outputDir;
        float cutoff, precision;
+       vector<string> outputNames;
        
        void get_comment(istream&, char, char);
        void read_phylip(istream&, int, vector<string>&, vector<vector<double> >&);
index a07cfde3b20aefe619b6c4638383c31655f82745..1001542ea36548742a2c92b809875fd4e7ec4f89 100644 (file)
@@ -13,6 +13,7 @@
 
 PhyloTree::PhyloTree(){
        try {
+               m = MothurOut::getInstance();
                numNodes = 1;
                numSeqs = 0;
                tree.push_back(TaxNode("Root"));
@@ -20,7 +21,7 @@ PhyloTree::PhyloTree(){
                maxLevel = 0;
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "PhyloTree");
+               m->errorOut(e, "PhyloTree", "PhyloTree");
                exit(1);
        }
 }
@@ -49,7 +50,7 @@ PhyloTree::PhyloTree(string tfile){
                assignHeirarchyIDs(0);
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "PhyloTree");
+               m->errorOut(e, "PhyloTree", "PhyloTree");
                exit(1);
        }
 }
@@ -66,7 +67,7 @@ string PhyloTree::getNextTaxon(string& heirarchy){
                return currentLevel;
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "getNextTaxon");
+               m->errorOut(e, "PhyloTree", "getNextTaxon");
                exit(1);
        }
 }
@@ -123,7 +124,7 @@ void PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
 
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "addSeqToTree");
+               m->errorOut(e, "PhyloTree", "addSeqToTree");
                exit(1);
        }
 }
@@ -138,7 +139,7 @@ vector<int> PhyloTree::getGenusNodes()      {
                return genusIndex;
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "getGenusNodes");
+               m->errorOut(e, "PhyloTree", "getGenusNodes");
                exit(1);
        }
 }
@@ -161,7 +162,7 @@ void PhyloTree::assignHeirarchyIDs(int index){
                }
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "assignHeirarchyIDs");
+               m->errorOut(e, "PhyloTree", "assignHeirarchyIDs");
                exit(1);
        }
 }
@@ -215,7 +216,7 @@ void PhyloTree::binUnclassified(){
                
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "binUnclassified");
+               m->errorOut(e, "PhyloTree", "binUnclassified");
                exit(1);
        }
 }
@@ -234,7 +235,7 @@ string PhyloTree::getFullTaxonomy(string seqName) {
                return tax;
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "getFullTaxonomy");
+               m->errorOut(e, "PhyloTree", "getFullTaxonomy");
                exit(1);
        }
 }
@@ -246,7 +247,7 @@ void PhyloTree::print(ofstream& out){
                print(0, out);
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "print");
+               m->errorOut(e, "PhyloTree", "print");
                exit(1);
        }
 }
@@ -264,7 +265,7 @@ void PhyloTree::print(int i, ofstream& out){
                
        }
        catch(exception& e) {
-               errorOut(e, "PhyloTree", "print");
+               m->errorOut(e, "PhyloTree", "print");
                exit(1);
        }
 }
index cae0a0893f3939842f948627af481953e393f87d..345e2e72228d711942e2f0d036eed0bda8c8fa67 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 /**************************************************************************************************/
 
@@ -55,6 +56,7 @@ private:
        int numNodes;
        int numSeqs;
        int maxLevel;
+       MothurOut* m;
 };
 
 /**************************************************************************************************/
index 2dbd53a5dad36477279961d76d547fff3d8e83d3..e3b47d863f3803b4d6d1ae7355a863b540f776c5 100644 (file)
@@ -14,7 +14,7 @@
 #include "sabundvector.hpp"
 
 /**********************************************************************************************************************/
-PhylotypeCommand::PhylotypeCommand(string option){
+PhylotypeCommand::PhylotypeCommand(string option)  {
        try {
                abort = false;
                
@@ -54,8 +54,8 @@ PhylotypeCommand::PhylotypeCommand(string option){
 
                        taxonomyFileName = validParameter.validFile(parameters, "taxonomy", true);
                        if (taxonomyFileName == "not found") { 
-                               mothurOut("taxonomy is a required parameter for the phylotype command."); 
-                               mothurOutEndLine();
+                               m->mothurOut("taxonomy is a required parameter for the phylotype command."); 
+                               m->mothurOutEndLine();
                                abort = true; 
                        }else if (taxonomyFileName == "not open") { abort = true; }     
                        
@@ -79,7 +79,7 @@ PhylotypeCommand::PhylotypeCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "PhylotypeCommand", "PhylotypeCommand");
+               m->errorOut(e, "PhylotypeCommand", "PhylotypeCommand");
                exit(1);
        }
 }
@@ -87,19 +87,19 @@ PhylotypeCommand::PhylotypeCommand(string option){
 
 void PhylotypeCommand::help(){
        try {
-               mothurOut("The phylotype command reads a taxonomy file and outputs a .list, .rabund and .sabund file. \n");
-               mothurOut("The phylotype command parameter options are taxonomy, cutoff and label. The taxonomy parameter is required.\n");
-               mothurOut("The cutoff parameter allows you to specify the level you want to stop at.  The default is the highest level in your taxonomy file. \n");
-               mothurOut("For example: taxonomy = Bacteria;Bacteroidetes-Chlorobi;Bacteroidetes; - cutoff=2, would truncate the taxonomy to Bacteria;Bacteroidetes-Chlorobi; \n");
-               mothurOut("For the cutoff parameter levels count up from the root of the phylotree. This enables you to look at the grouping down to a specific resolution, say the genus level.\n");
-               mothurOut("The label parameter allows you to specify which level you would like, and are separated by dashes.  The default all levels in your taxonomy file. \n");
-               mothurOut("For the label parameter, levels count down from the root to keep the output similiar to mothur's other commands which report information from finer resolution to coarser resolutions.\n");
-               mothurOut("The phylotype command should be in the following format: \n");
-               mothurOut("phylotype(taxonomy=yourTaxonomyFile, cutoff=yourCutoff, label=yourLabels) \n");
-               mothurOut("Eaxample: phylotype(taxonomy=amazon.taxonomy, cutoff=5, label=1-3-5).\n\n");
+               m->mothurOut("The phylotype command reads a taxonomy file and outputs a .list, .rabund and .sabund file. \n");
+               m->mothurOut("The phylotype command parameter options are taxonomy, cutoff and label. The taxonomy parameter is required.\n");
+               m->mothurOut("The cutoff parameter allows you to specify the level you want to stop at.  The default is the highest level in your taxonomy file. \n");
+               m->mothurOut("For example: taxonomy = Bacteria;Bacteroidetes-Chlorobi;Bacteroidetes; - cutoff=2, would truncate the taxonomy to Bacteria;Bacteroidetes-Chlorobi; \n");
+               m->mothurOut("For the cutoff parameter levels count up from the root of the phylotree. This enables you to look at the grouping down to a specific resolution, say the genus level.\n");
+               m->mothurOut("The label parameter allows you to specify which level you would like, and are separated by dashes.  The default all levels in your taxonomy file. \n");
+               m->mothurOut("For the label parameter, levels count down from the root to keep the output similiar to mothur's other commands which report information from finer resolution to coarser resolutions.\n");
+               m->mothurOut("The phylotype command should be in the following format: \n");
+               m->mothurOut("phylotype(taxonomy=yourTaxonomyFile, cutoff=yourCutoff, label=yourLabels) \n");
+               m->mothurOut("Eaxample: phylotype(taxonomy=amazon.taxonomy, cutoff=5, label=1-3-5).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "PhylotypeCommand", "help");
+               m->errorOut(e, "PhylotypeCommand", "help");
                exit(1);
        }
 }
@@ -114,6 +114,8 @@ int PhylotypeCommand::execute(){
        
                if (abort == true) { return 0; }
                
+               vector<string> outputNames;
+               
                //reads in taxonomy file and makes all the taxonomies the same length 
                //by appending the last taxon to a given taxonomy as many times as needed to 
                //make it as long as the longest taxonomy in the file 
@@ -131,7 +133,7 @@ int PhylotypeCommand::execute(){
                for (int i = 0; i < leaves.size(); i++)         {       currentNodes[leaves[i]] = leaves[i];    }
                
                bool done = false;
-               if (tree->get(leaves[0]).parent == -1) {  mothurOut("Empty Tree"); mothurOutEndLine();  done = true;    }
+               if (tree->get(leaves[0]).parent == -1) {  m->mothurOut("Empty Tree"); m->mothurOutEndLine();    done = true;    }
                
                string fileroot = outputDir + getRootName(getSimpleName(taxonomyFileName));
                
@@ -145,6 +147,10 @@ int PhylotypeCommand::execute(){
                string outputRabundFile = fileroot + "tx.rabund";
                openOutputFile(outputRabundFile, outRabund);
                
+               outputNames.push_back(outputListFile);
+               outputNames.push_back(outputSabundFile);
+               outputNames.push_back(outputRabundFile);
+               
                int count = 1;          
                //start at leaves of tree and work towards root, processing the labels the user wants
                while((!done) && ((allLines == 1) || (labels.size() != 0))) {
@@ -156,7 +162,7 @@ int PhylotypeCommand::execute(){
                        if(allLines == 1 || labels.count(level) == 1){  
                                
                                //output level
-                               mothurOut(level); mothurOutEndLine();
+                               m->mothurOut(level); m->mothurOutEndLine();
                                
                                ListVector list;
                                list.setLabel(level);
@@ -210,11 +216,16 @@ int PhylotypeCommand::execute(){
                
                delete tree;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "PhylotypeCommand", "execute");
+               m->errorOut(e, "PhylotypeCommand", "execute");
                exit(1);
        }
 }
index 90c97c5e77d50f478aeb1b4bb7b1fa28713ee468..a2c72702cc7f766501f705226fe4441abcf7ed24 100644 (file)
@@ -32,7 +32,7 @@ Pintail::~Pintail() {
                delete decalc; 
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "~Pintail");
+               m->errorOut(e, "Pintail", "~Pintail");
                exit(1);
        }
 }
@@ -66,13 +66,13 @@ void Pintail::doPrep() {
                #endif
 
                
-               mothurOut("Getting conservation... "); cout.flush();
+               m->mothurOut("Getting conservation... "); cout.flush();
                if (consfile == "") { 
-                       mothurOut("Calculating probability of conservation for your template sequences.  This can take a while...  I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command.  Providing the .freq file will improve speed.    "); cout.flush();
+                       m->mothurOut("Calculating probability of conservation for your template sequences.  This can take a while...  I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command.  Providing the .freq file will improve speed.    "); cout.flush();
                        probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + getSimpleName(templateFileName)); 
-                       mothurOut("Done."); mothurOutEndLine();
-               }else                           {   probabilityProfile = readFreq();    mothurOut("Done.");               }
-               mothurOutEndLine();
+                       m->mothurOut("Done."); m->mothurOutEndLine();
+               }else                           {   probabilityProfile = readFreq();    m->mothurOut("Done.");            }
+               m->mothurOutEndLine();
                
                //make P into Q
                for (int i = 0; i < probabilityProfile.size(); i++)  {  probabilityProfile[i] = 1 - probabilityProfile[i];  }  //cout << i << '\t' << probabilityProfile[i] << endl;
@@ -135,7 +135,7 @@ void Pintail::doPrep() {
                                }
                        }
                        
-                       mothurOut("Calculating quantiles for your template.  This can take a while...  I will output the quantiles to a .quan file that you can input them using the quantiles parameter next time you run this command.  Providing the .quan file will dramatically improve speed.    "); cout.flush();
+                       m->mothurOut("Calculating quantiles for your template.  This can take a while...  I will output the quantiles to a .quan file that you can input them using the quantiles parameter next time you run this command.  Providing the .quan file will dramatically improve speed.    "); cout.flush();
                        if (processors == 1) { 
                                quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size());
                        }else {         createProcessesQuan();          }
@@ -197,7 +197,7 @@ void Pintail::doPrep() {
                                
                        }
 
-                       mothurOut("Done."); mothurOutEndLine();
+                       m->mothurOut("Done."); m->mothurOutEndLine();
                }
                
                if (reRead) {
@@ -212,7 +212,7 @@ void Pintail::doPrep() {
                
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "doPrep");
+               m->errorOut(e, "Pintail", "doPrep");
                exit(1);
        }
 }
@@ -234,7 +234,7 @@ void Pintail::print(ostream& out, ostream& outAcc) {
                
                out << querySeq->getName() << '\t' << "div: " << deviation << "\tstDev: " << DE << "\tchimera flag: " << chimera << endl;
                if (chimera == "Yes") {
-                       mothurOut(querySeq->getName() + "\tdiv: " + toString(deviation) + "\tstDev: " + toString(DE) + "\tchimera flag: " + chimera); mothurOutEndLine();
+                       m->mothurOut(querySeq->getName() + "\tdiv: " + toString(deviation) + "\tstDev: " + toString(DE) + "\tchimera flag: " + chimera); m->mothurOutEndLine();
                        outAcc << querySeq->getName() << endl;
                }
                out << "Observed\t";
@@ -250,7 +250,7 @@ void Pintail::print(ostream& out, ostream& outAcc) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "print");
+               m->errorOut(e, "Pintail", "print");
                exit(1);
        }
 }
@@ -307,7 +307,7 @@ int Pintail::getChimeras(Sequence* query) {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "getChimeras");
+               m->errorOut(e, "Pintail", "getChimeras");
                exit(1);
        }
 }
@@ -349,7 +349,7 @@ vector<float> Pintail::readFreq() {
                
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "readFreq");
+               m->errorOut(e, "Pintail", "readFreq");
                exit(1);
        }
 }
@@ -366,7 +366,7 @@ Sequence* Pintail::findPairs(Sequence* q) {
        
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "findPairs");
+               m->errorOut(e, "Pintail", "findPairs");
                exit(1);
        }
 }
@@ -406,7 +406,7 @@ void Pintail::createProcessesQuan() {
                                out.close();
                                
                                exit(0);
-                       }else { mothurOut("unable to spawn the necessary processes."); mothurOutEndLine(); exit(0); }
+                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
                
                //force parent to wait until all the processes are done
@@ -461,7 +461,7 @@ void Pintail::createProcessesQuan() {
 #endif         
        }
        catch(exception& e) {
-               errorOut(e, "Pintail", "createProcessesQuan");
+               m->errorOut(e, "Pintail", "createProcessesQuan");
                exit(1);
        }
 }
index fa5329b1e4094b4c87d60b5b4dfbd211f1bc1aeb..66efd469fcf8631d8537b6c7e90ea066ef72c028 100644 (file)
@@ -13,7 +13,7 @@
 inline bool comparePriority(seqPNode first, seqPNode second) {  return (first.numIdentical > second.numIdentical); }
 //**********************************************************************************************************************
 
-PreClusterCommand::PreClusterCommand(string option){
+PreClusterCommand::PreClusterCommand(string option) {
        try {
                abort = false;
                
@@ -60,7 +60,7 @@ PreClusterCommand::PreClusterCommand(string option){
 
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the pre.cluster command."); mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the pre.cluster command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -82,7 +82,7 @@ PreClusterCommand::PreClusterCommand(string option){
                                
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "PreClusterCommand");
+               m->errorOut(e, "PreClusterCommand", "PreClusterCommand");
                exit(1);
        }
 }
@@ -93,18 +93,18 @@ PreClusterCommand::~PreClusterCommand(){}
 
 void PreClusterCommand::help(){
        try {
-               mothurOut("The pre.cluster command groups sequences that are within a given number of base mismatches.\n");
-               mothurOut("The pre.cluster command outputs a new fasta and name file.\n");
-               mothurOut("The pre.cluster command parameters are fasta, names and diffs. The fasta parameter is required. \n");
-               mothurOut("The names parameter allows you to give a list of seqs that are identical. This file is 2 columns, first column is name or representative sequence, second column is a list of its identical sequences separated by commas.\n");
-               mothurOut("The diffs parameter allows you to specify maximum number of mismatched bases allowed between sequences in a grouping. The default is 1.\n");
-               mothurOut("The pre.cluster command should be in the following format: \n");
-               mothurOut("pre.cluster(fasta=yourFastaFile, names=yourNamesFile, diffs=yourMaxDiffs) \n");
-               mothurOut("Example pre.cluster(fasta=amazon.fasta, diffs=2).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The pre.cluster command groups sequences that are within a given number of base mismatches.\n");
+               m->mothurOut("The pre.cluster command outputs a new fasta and name file.\n");
+               m->mothurOut("The pre.cluster command parameters are fasta, names and diffs. The fasta parameter is required. \n");
+               m->mothurOut("The names parameter allows you to give a list of seqs that are identical. This file is 2 columns, first column is name or representative sequence, second column is a list of its identical sequences separated by commas.\n");
+               m->mothurOut("The diffs parameter allows you to specify maximum number of mismatched bases allowed between sequences in a grouping. The default is 1.\n");
+               m->mothurOut("The pre.cluster command should be in the following format: \n");
+               m->mothurOut("pre.cluster(fasta=yourFastaFile, names=yourNamesFile, diffs=yourMaxDiffs) \n");
+               m->mothurOut("Example pre.cluster(fasta=amazon.fasta, diffs=2).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "help");
+               m->errorOut(e, "PreClusterCommand", "help");
                exit(1);
        }
 }
@@ -118,8 +118,8 @@ int PreClusterCommand::execute(){
                //reads fasta file and return number of seqs
                int numSeqs = readFASTA(); //fills alignSeqs and makes all seqs active
        
-               if (numSeqs == 0) { mothurOut("Error reading fasta file...please correct."); mothurOutEndLine(); return 0;  }
-               if (diffs > length) { mothurOut("Error: diffs is greater than your sequence length."); mothurOutEndLine(); return 0;  }
+               if (numSeqs == 0) { m->mothurOut("Error reading fasta file...please correct."); m->mothurOutEndLine(); return 0;  }
+               if (diffs > length) { m->mothurOut("Error: diffs is greater than your sequence length."); m->mothurOutEndLine(); return 0;  }
                
                //clear sizes since you only needed this info to build the alignSeqs seqPNode structs
 //             sizes.clear();
@@ -167,15 +167,21 @@ int PreClusterCommand::execute(){
                string newNamesFile = fileroot + "precluster.names";
                
                
-               mothurOut("Total number of sequences before precluster was " + toString(alignSeqs.size()) + "."); mothurOutEndLine();
-               mothurOut("pre.cluster removed " + toString(count) + " sequences."); mothurOutEndLine(); 
+               m->mothurOut("Total number of sequences before precluster was " + toString(alignSeqs.size()) + "."); m->mothurOutEndLine();
+               m->mothurOut("pre.cluster removed " + toString(count) + " sequences."); m->mothurOutEndLine(); 
                printData(newFastaFile, newNamesFile);
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(newFastaFile); m->mothurOutEndLine();      
+               m->mothurOut(newNamesFile); m->mothurOutEndLine();      
+               m->mothurOutEndLine();
 
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "execute");
+               m->errorOut(e, "PreClusterCommand", "execute");
                exit(1);
        }
 }
@@ -213,7 +219,7 @@ int PreClusterCommand::readFASTA(){
                                if (namefile != "") {
                                        itSize = sizes.find(seq.getName());
                                        
-                                       if (itSize == sizes.end()) { mothurOut(seq.getName() + " is not in your names file, please correct."); mothurOutEndLine(); exit(1); }
+                                       if (itSize == sizes.end()) { m->mothurOut(seq.getName() + " is not in your names file, please correct."); m->mothurOutEndLine(); exit(1); }
                                        else{
                                                seqPNode tempNode(itSize->second, seq, names[seq.getName()]);
                                                alignSeqs.push_back(tempNode);
@@ -232,7 +238,7 @@ int PreClusterCommand::readFASTA(){
        }
        
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "readFASTA");
+               m->errorOut(e, "PreClusterCommand", "readFASTA");
                exit(1);
        }
 }
@@ -252,7 +258,7 @@ int PreClusterCommand::calcMisMatches(string seq1, string seq2){
                return numBad;
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "calcMisMatches");
+               m->errorOut(e, "PreClusterCommand", "calcMisMatches");
                exit(1);
        }
 }
@@ -280,7 +286,7 @@ void PreClusterCommand::printData(string newfasta, string newname){
                
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "printData");
+               m->errorOut(e, "PreClusterCommand", "printData");
                exit(1);
        }
 }
@@ -306,7 +312,7 @@ void PreClusterCommand::readNameFile(){
                in.close();
        }
        catch(exception& e) {
-               errorOut(e, "PreClusterCommand", "readNameFile");
+               m->errorOut(e, "PreClusterCommand", "readNameFile");
                exit(1);
        }
 }
index 643a36783594cf6d0716e2e4b79fedf3413a6861..de6a5727575a7f35d2605239968a37435faa388f 100644 (file)
@@ -30,7 +30,7 @@ struct seqPNode {
 class PreClusterCommand : public Command {
        
 public:
-       PreClusterCommand(string);      
+       PreClusterCommand(string);
        ~PreClusterCommand();
        int execute();  
        void help();
index 6899e76e1940e2408567ce0e7212a7315266f143..186a86edf2329ed75a5edb30f88a96528f79436d 100644 (file)
@@ -18,13 +18,14 @@ const char marker = '|';
 
 Progress::Progress(){
        try {
-               mothurOut("********************#****#****#****#****#****#****#****#****#****#****#");
+               m = MothurOut::getInstance();
+               m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#");
                
                nTicks = 0;
                finalPos = 0;
        }
        catch(exception& e) {
-               errorOut(e, "Progress", "Progress");
+               m->errorOut(e, "Progress", "Progress");
                exit(1);
        }
 }
@@ -33,17 +34,17 @@ Progress::Progress(){
 
 Progress::Progress(string job, int end){
        try {
-               mothurOut("********************#****#****#****#****#****#****#****#****#****#****#\n");
+               m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#\n");
                cout << setw(20) << left << job << setw(1) << marker;
-               mothurOutJustToLog(job);
-               mothurOut(toString(marker));
+               m->mothurOutJustToLog(job);
+               m->mothurOut(toString(marker));
                cout.flush();
 
                nTicks = 0;
                finalPos = end;
        }
        catch(exception& e) {
-               errorOut(e, "Progress", "Progress");
+               m->errorOut(e, "Progress", "Progress");
                exit(1);
        }
 }
@@ -52,17 +53,17 @@ Progress::Progress(string job, int end){
 
 void Progress::newLine(string job, int end){
        try {
-               mothurOutEndLine();
+               m->mothurOutEndLine();
                cout << setw(20) << left << job << setw(1) << marker;
-               mothurOutJustToLog(job);
-               mothurOut(toString(marker));
+               m->mothurOutJustToLog(job);
+               m->mothurOut(toString(marker));
                cout.flush();
                
                nTicks = 0;
                finalPos = end;
        }
        catch(exception& e) {
-               errorOut(e, "Progress", "newLine");
+               m->errorOut(e, "Progress", "newLine");
                exit(1);
        }
 }
@@ -75,14 +76,14 @@ void Progress::update(const int currentPos){
        
                if(ratio > nTicks){
                        for(int i=nTicks;i<ratio;i++){
-                               mothurOut(toString(marker));
+                               m->mothurOut(toString(marker));
                                cout.flush();
                        }
                        nTicks = ratio;
                }
        }
        catch(exception& e) {
-               errorOut(e, "Progress", "update");
+               m->errorOut(e, "Progress", "update");
                exit(1);
        }
 }
@@ -92,17 +93,17 @@ void Progress::update(const int currentPos){
 void Progress::finish(){
        try {
                for(int i=nTicks;i<totalTicks;i++){
-                       mothurOut(toString(marker));
+                       m->mothurOut(toString(marker));
                        cout.flush();
                }
        
        
-               mothurOutEndLine();
-               mothurOut("***********************************************************************\n");
+               m->mothurOutEndLine();
+               m->mothurOut("***********************************************************************\n");
                cout.flush();
        }
        catch(exception& e) {
-               errorOut(e, "Progress", "finish");
+               m->errorOut(e, "Progress", "finish");
                exit(1);
        }
 }
index fba393ebb6315c31aceb45fdc049eb39382a63fb..f4d4fc39eadeb36d44475757b8caf487534e01b9 100644 (file)
@@ -2,6 +2,7 @@
 #define PROGRESS_H
 
 #include "mothur.h"
+#include "mothurout.h"
 
 class Progress {
        
@@ -14,7 +15,8 @@ public:
        
 private:
        int nTicks;
-       int finalPos;   
+       int finalPos;
+       MothurOut* m;   
 };
 
 #endif
index 60e6629b96e1c501a8f3fa2ffabde3fd14fefbb9..44da363845b87a7c164562e5ecffc590035329e1 100644 (file)
--- a/qstat.cpp
+++ b/qstat.cpp
@@ -59,7 +59,7 @@ EstOutput QStat::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "QStat", "getValues");
+               m->errorOut(e, "QStat", "getValues");
                exit(1);
        }
 }
index 05e2758a2778505858283a450dbfb0b270cf77ca..8e6fd15412167f9b2ae26eec7b9d93a8e19c6bd2 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-QuitCommand::QuitCommand(string option){
+QuitCommand::QuitCommand(string option) {
                abort = false;
                
                //allow user to run help
@@ -22,11 +22,11 @@ QuitCommand::QuitCommand(string option){
 
 void QuitCommand::help(){
        try {
-                mothurOut("The quit command will terminate mothur and should be in the following format: \n"); 
-                mothurOut("quit() or quit\n\n");
+                m->mothurOut("The quit command will terminate mothur and should be in the following format: \n"); 
+                m->mothurOut("quit() or quit\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "QuitCommand", "help");
+               m->errorOut(e, "QuitCommand", "help");
                exit(1);
        }
 }
index e01063dad484f2328a714b0cbf8cff15c445b169..43dbfacc78b845b5d247ba44484b464fd612d590 100644 (file)
@@ -41,7 +41,7 @@ RAbundVector::RAbundVector(string id, vector<int> rav) : DataVector(id), data(ra
                }
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "RAbundVector");
+               m->errorOut(e, "RAbundVector", "RAbundVector");
                exit(1);
        }
 }
@@ -56,7 +56,7 @@ RAbundVector::RAbundVector(vector<int> rav, int mr, int nb, int ns) {
                data = rav;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "RAbundVector");
+               m->errorOut(e, "RAbundVector", "RAbundVector");
                exit(1);
        }
 }
@@ -78,7 +78,7 @@ RAbundVector::RAbundVector(ifstream& f) : DataVector(), maxRank(0), numBins(0),
                }
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "RAbundVector");
+               m->errorOut(e, "RAbundVector", "RAbundVector");
                exit(1);
        }
 }
@@ -103,7 +103,7 @@ void RAbundVector::set(int binNumber, int newBinSize){
                numSeqs += (newBinSize - oldBinSize);
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "set");
+               m->errorOut(e, "RAbundVector", "set");
                exit(1);
        }
 }
@@ -129,7 +129,7 @@ void RAbundVector::push_back(int binSize){
                numSeqs += binSize;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "push_back");
+               m->errorOut(e, "RAbundVector", "push_back");
                exit(1);
        }
 }
@@ -202,7 +202,7 @@ void RAbundVector::nonSortedPrint(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "nonSortedPrint");
+               m->errorOut(e, "RAbundVector", "nonSortedPrint");
                exit(1);
        }
 }
@@ -218,7 +218,7 @@ void RAbundVector::print(string prefix, ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "print");
+               m->errorOut(e, "RAbundVector", "print");
                exit(1);
        }
 }
@@ -236,7 +236,7 @@ void RAbundVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "print");
+               m->errorOut(e, "RAbundVector", "print");
                exit(1);
        }
 }
@@ -279,7 +279,7 @@ SAbundVector RAbundVector::getSAbundVector() {
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "getSAbundVector");
+               m->errorOut(e, "RAbundVector", "getSAbundVector");
                exit(1);
        }
 }
@@ -302,7 +302,7 @@ OrderVector RAbundVector::getOrderVector(map<string,int>* nameMap = NULL) {
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "RAbundVector", "getOrderVector");
+               m->errorOut(e, "RAbundVector", "getOrderVector");
                exit(1);
        }
 }
index 8f1d3073cf93ace3e42f2f4e3eb7a8515890ea61..9145061255d415eb7a48749bdbaaa405b78425fd 100644 (file)
@@ -45,7 +45,7 @@ EstOutput RareCalc::getValues(int n){
                return output;
        }
        catch(exception& e) {
-               errorOut(e, "RareCalc", "getValues");
+               m->errorOut(e, "RareCalc", "getValues");
                exit(1);
        }
 }
index a7ad2b733b133bd65a62977c33c4a1e7cc691bb1..d30fa16ba5a75dd190d65b9e887702eba8af27df 100644 (file)
 class RareCalc {
 
 public:
-       RareCalc(RAbundVector* b) : bins(b), numSeqs(b->getNumSeqs()), maxRank(b->getMaxRank()), numBins(b->getNumBins()) {     bMatrix = binomial(numSeqs+1);  };
+       RareCalc(RAbundVector* b) : bins(b), numSeqs(b->getNumSeqs()), maxRank(b->getMaxRank()), numBins(b->getNumBins()) {     bMatrix = binomial(numSeqs+1); m = MothurOut::getInstance();    }
        EstOutput getValues(int);
        string getName()        {       return "rarecalc";      }
 private:
        RAbundVector* bins;
        vector<vector<double> > bMatrix;
        int numSeqs, maxRank, numBins;
+       MothurOut* m;
 };
 
 /***********************************************************************/
index 6c5a5e5f6d5c22a08d609681d88f5539460881ac..5922822d57a5e0245129e63f30844cf746a88b41 100644 (file)
@@ -16,7 +16,7 @@ void RareDisplay::init(string label){
                this->label = label;
        }
        catch(exception& e) {
-               errorOut(e, "RareDisplay", "init");
+               m->errorOut(e, "RareDisplay", "init");
                exit(1);
        }
 }
@@ -49,7 +49,7 @@ void RareDisplay::update(SAbundVector* rank){
                }
        }
        catch(exception& e) {
-               errorOut(e, "RareDisplay", "update");
+               m->errorOut(e, "RareDisplay", "update");
                exit(1);
        }
 }
@@ -82,7 +82,7 @@ void RareDisplay::update(vector<SharedRAbundVector*> shared, int numSeqs, int nu
                }
        }
        catch(exception& e) {
-               errorOut(e, "RareDisplay", "update");
+               m->errorOut(e, "RareDisplay", "update");
                exit(1);
        }
 }
@@ -95,7 +95,7 @@ void RareDisplay::reset(){
                index = 0;
        }
        catch(exception& e) {
-               errorOut(e, "RareDisplay", "reset");
+               m->errorOut(e, "RareDisplay", "reset");
                exit(1);
        }
 }
@@ -131,7 +131,7 @@ void RareDisplay::close(){
                output->resetFile();
        }
        catch(exception& e) {
-               errorOut(e, "RareDisplay", "close");
+               m->errorOut(e, "RareDisplay", "close");
                exit(1);
        }
 }
index 5cd9b99c5051be03b00757df6a99bfb479adabfe..6acc24ce9df500338873829216e5c1b3754d7df7 100644 (file)
@@ -63,7 +63,7 @@ void Rarefact::getCurve(int increment = 1, int nIters = 1000){
                delete rcd;
        }
        catch(exception& e) {
-               errorOut(e, "Rarefact", "getCurve");
+               m->errorOut(e, "Rarefact", "getCurve");
                exit(1);
        }
 }
@@ -129,7 +129,7 @@ try {
                delete rcd;
        }
        catch(exception& e) {
-               errorOut(e, "Rarefact", "getSharedCurve");
+               m->errorOut(e, "Rarefact", "getSharedCurve");
                exit(1);
        }
 }
@@ -143,7 +143,7 @@ void Rarefact::mergeVectors(SharedRAbundVector* shared1, SharedRAbundVector* sha
                }
        }
        catch(exception& e) {
-               errorOut(e, "Rarefact", "mergeVectors");
+               m->errorOut(e, "Rarefact", "mergeVectors");
                exit(1);
        }
 }
index 9507d5af84eeadec5046a4fe1967eda508913968..9e903ea759094dfa0f76453801f63111be92315b 100644 (file)
@@ -12,9 +12,9 @@ class Rarefact {
        
 public:
        Rarefact(OrderVector* o, vector<Display*> disp) :
-                       numSeqs(o->getNumSeqs()), order(o), displays(disp), label(o->getLabel())  {};
+                       numSeqs(o->getNumSeqs()), order(o), displays(disp), label(o->getLabel())  { m = MothurOut::getInstance(); }
        Rarefact(vector<SharedRAbundVector*> shared, vector<Display*> disp) :
-                                        lookup(shared), displays(disp) {  globaldata = GlobalData::getInstance();  };
+                                        lookup(shared), displays(disp) {  globaldata = GlobalData::getInstance(); m = MothurOut::getInstance(); }
 
        ~Rarefact(){};
        void getCurve(int, int);
@@ -28,6 +28,7 @@ private:
        string label;
        void mergeVectors(SharedRAbundVector*, SharedRAbundVector*);
        vector<SharedRAbundVector*> lookup; 
+       MothurOut* m;
 
 };
 
index 97d633278f4d43dc8b30a5e95298d2897bdabca7..c98b833ffcb1e70d9d24e9c18f1eec638c75c127 100644 (file)
 //**********************************************************************************************************************
 
 
-RareFactCommand::RareFactCommand(string option){
+RareFactCommand::RareFactCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                allLines = 1;
                labels.clear();
                Estimators.clear();
-               
+                               
                //allow user to run help
                if(option == "help") { validCalculator = new ValidCalculators(); help(); delete validCalculator; abort = true; }
                
@@ -55,7 +55,7 @@ RareFactCommand::RareFactCommand(string option){
                        }
 
                        //make sure the user has already run the read.otu command
-                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund, rabund or shared file before you can use the rarefact.single command."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund, rabund or shared file before you can use the rarefact.single command."); m->mothurOutEndLine(); abort = true; }
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -92,7 +92,7 @@ RareFactCommand::RareFactCommand(string option){
                
        }
        catch(exception& e) {
-               errorOut(e, "RareFactCommand", "RareFactCommand");
+               m->errorOut(e, "RareFactCommand", "RareFactCommand");
                exit(1);
        }
 }
@@ -100,19 +100,19 @@ RareFactCommand::RareFactCommand(string option){
 
 void RareFactCommand::help(){
        try {
-               mothurOut("The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
-               mothurOut("The rarefaction.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
-               mothurOut("The rarefaction.single command parameters are label, iters, freq, calc and abund.  No parameters are required. \n");
-               mothurOut("The rarefaction.single command should be in the following format: \n");
-               mothurOut("rarefaction.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
-               mothurOut("Example rarefaction.single(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n");
-               mothurOut("The default values for iters is 1000, freq is 100, and calc is rarefaction which calculates the rarefaction curve for the observed richness.\n");
+               m->mothurOut("The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
+               m->mothurOut("The rarefaction.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
+               m->mothurOut("The rarefaction.single command parameters are label, iters, freq, calc and abund.  No parameters are required. \n");
+               m->mothurOut("The rarefaction.single command should be in the following format: \n");
+               m->mothurOut("rarefaction.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
+               m->mothurOut("Example rarefaction.single(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n");
+               m->mothurOut("The default values for iters is 1000, freq is 100, and calc is rarefaction which calculates the rarefaction curve for the observed richness.\n");
                validCalculator->printCalc("rarefaction", cout);
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "RareFactCommand", "help");
+               m->errorOut(e, "RareFactCommand", "help");
                exit(1);
        }
 }
@@ -128,6 +128,8 @@ int RareFactCommand::execute(){
        
                if (abort == true) { return 0; }
                
+               vector<string> outputNames;
+               
                if ((globaldata->getFormat() != "sharedfile")) { inputFileNames.push_back(globaldata->inputFileName);  }
                else {  inputFileNames = parseSharedFile(globaldata->getSharedFile());  globaldata->setFormat("rabund");  }
                
@@ -137,7 +139,7 @@ int RareFactCommand::execute(){
                        globaldata->inputFileName = inputFileNames[p];
                        
                        if (inputFileNames.size() > 1) {
-                               mothurOutEndLine(); mothurOut("Processing group " + groups[p]); mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
                        }
                        int i;
                        validCalculator = new ValidCalculators();
@@ -147,26 +149,36 @@ int RareFactCommand::execute(){
                                if (validCalculator->isValidCalculator("rarefaction", Estimators[i]) == true) { 
                                        if (Estimators[i] == "sobs") { 
                                                rDisplays.push_back(new RareDisplay(new Sobs(), new ThreeColumnFile(fileNameRoot+"rarefaction")));
+                                               outputNames.push_back(fileNameRoot+"rarefaction");
                                        }else if (Estimators[i] == "chao") { 
                                                rDisplays.push_back(new RareDisplay(new Chao1(), new ThreeColumnFile(fileNameRoot+"r_chao")));
+                                               outputNames.push_back(fileNameRoot+"r_chao");
                                        }else if (Estimators[i] == "ace") { 
                                                if(abund < 5)
                                                        abund = 10;
                                                rDisplays.push_back(new RareDisplay(new Ace(abund), new ThreeColumnFile(fileNameRoot+"r_ace")));
+                                               outputNames.push_back(fileNameRoot+"r_ace");
                                        }else if (Estimators[i] == "jack") { 
                                                rDisplays.push_back(new RareDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"r_jack")));
+                                               outputNames.push_back(fileNameRoot+"r_jack");
                                        }else if (Estimators[i] == "shannon") { 
                                                rDisplays.push_back(new RareDisplay(new Shannon(), new ThreeColumnFile(fileNameRoot+"r_shannon")));
+                                               outputNames.push_back(fileNameRoot+"r_shannon");
                                        }else if (Estimators[i] == "npshannon") { 
                                                rDisplays.push_back(new RareDisplay(new NPShannon(), new ThreeColumnFile(fileNameRoot+"r_npshannon")));
+                                               outputNames.push_back(fileNameRoot+"r_npshannon");
                                        }else if (Estimators[i] == "simpson") { 
                                                rDisplays.push_back(new RareDisplay(new Simpson(), new ThreeColumnFile(fileNameRoot+"r_simpson")));
+                                               outputNames.push_back(fileNameRoot+"r_simpson");
                                        }else if (Estimators[i] == "bootstrap") { 
                                                rDisplays.push_back(new RareDisplay(new Bootstrap(), new ThreeColumnFile(fileNameRoot+"r_bootstrap")));
+                                               outputNames.push_back(fileNameRoot+"r_bootstrap");
                                        }else if (Estimators[i] == "coverage") { 
                                                rDisplays.push_back(new RareDisplay(new Coverage(), new ThreeColumnFile(fileNameRoot+"r_coverage")));
+                                               outputNames.push_back(fileNameRoot+"r_coverage");
                                        }else if (Estimators[i] == "nseqs") { 
                                                rDisplays.push_back(new RareDisplay(new NSeqs(), new ThreeColumnFile(fileNameRoot+"r_nseqs")));
+                                               outputNames.push_back(fileNameRoot+"r_nseqs");
                                        }
                                }
                        }
@@ -195,7 +207,7 @@ int RareFactCommand::execute(){
                                        rCurve->getCurve(freq, nIters);
                                        delete rCurve;
                                        
-                                       mothurOut(order->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(order->getLabel());
                                        userLabels.erase(order->getLabel());
                                }
@@ -210,7 +222,7 @@ int RareFactCommand::execute(){
                                        rCurve->getCurve(freq, nIters);
                                        delete rCurve;
                                        
-                                       mothurOut(order->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(order->getLabel());
                                        userLabels.erase(order->getLabel());
                                        
@@ -228,12 +240,12 @@ int RareFactCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it);
+                               m->mothurOut("Your file does not include the label " + *it);
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                        
@@ -246,7 +258,7 @@ int RareFactCommand::execute(){
                                rCurve->getCurve(freq, nIters);
                                delete rCurve;
                                
-                               mothurOut(order->getLabel()); mothurOutEndLine();
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                delete order;
                        }
                        
@@ -260,10 +272,16 @@ int RareFactCommand::execute(){
                        
                }
                
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "RareFactCommand", "execute");
+               m->errorOut(e, "RareFactCommand", "execute");
                exit(1);
        }
 }
@@ -322,7 +340,7 @@ vector<string> RareFactCommand::parseSharedFile(string filename) {
                return filenames;
        }
        catch(exception& e) {
-               errorOut(e, "RareFactCommand", "parseSharedFile");
+               m->errorOut(e, "RareFactCommand", "parseSharedFile");
                exit(1);
        }
 }
index 1d13a569c2026fd800283ad3b8bfc3dd5cd48a93..b53e87dceb21cb87ec26e88828479808feddb69a 100644 (file)
@@ -13,7 +13,7 @@
 
 //**********************************************************************************************************************
 
-RareFactSharedCommand::RareFactSharedCommand(string option){
+RareFactSharedCommand::RareFactSharedCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                
@@ -43,8 +43,8 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
-                               if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
-                               else if (globaldata->getGroupFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
+                               if (globaldata->getListFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); m->mothurOutEndLine(); abort = true; }
+                               else if (globaldata->getGroupFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); m->mothurOutEndLine(); abort = true; }
                        }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -104,8 +104,10 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                                        if (validCalculator->isValidCalculator("sharedrarefaction", Estimators[i]) == true) { 
                                                if (Estimators[i] == "sharedobserved") { 
                                                        rDisplays.push_back(new RareDisplay(new SharedSobs(), new SharedThreeColumnFile(fileNameRoot+"shared.rarefaction", "")));
+                                                       outputNames.push_back(fileNameRoot+"shared.rarefaction");
                                                }else if (Estimators[i] == "sharednseqs") { 
                                                        rDisplays.push_back(new RareDisplay(new SharedNSeqs(), new SharedThreeColumnFile(fileNameRoot+"shared.r_nseqs", "")));
+                                                       outputNames.push_back(fileNameRoot+"shared.r_nseqs");
                                                }
                                        }
                                }
@@ -115,7 +117,7 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "RareFactSharedCommand", "RareFactSharedCommand");
+               m->errorOut(e, "RareFactSharedCommand", "RareFactSharedCommand");
                exit(1);
        }
 }
@@ -124,20 +126,20 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
 
 void RareFactSharedCommand::help(){
        try {
-               mothurOut("The rarefaction.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc.  No parameters are required.\n");
-               mothurOut("The rarefaction command should be in the following format: \n");
-               mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
-               mothurOut("Example rarefaction.shared(label=unique-0.01-0.03,  iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
-               mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n");
+               m->mothurOut("The rarefaction.shared command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc.  No parameters are required.\n");
+               m->mothurOut("The rarefaction command should be in the following format: \n");
+               m->mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
+               m->mothurOut("Example rarefaction.shared(label=unique-0.01-0.03,  iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
+               m->mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n");
                validCalculator->printCalc("sharedrarefaction", cout);
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "RareFactSharedCommand", "help");
+               m->errorOut(e, "RareFactSharedCommand", "help");
                exit(1);
        }
 }
@@ -170,7 +172,7 @@ int RareFactSharedCommand::execute(){
                string lastLabel = lookup[0]->getLabel();
 
                if (lookup.size() < 2) { 
-                       mothurOut("I cannot run the command without at least 2 valid groups."); 
+                       m->mothurOut("I cannot run the command without at least 2 valid groups."); 
                        for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
                        return 0;
                }
@@ -188,7 +190,7 @@ int RareFactSharedCommand::execute(){
                                rCurve->getSharedCurve(freq, nIters);
                                delete rCurve;
                        
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                processedLabels.insert(lookup[0]->getLabel());
                                userLabels.erase(lookup[0]->getLabel());
                        }
@@ -199,7 +201,7 @@ int RareFactSharedCommand::execute(){
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        rCurve = new Rarefact(lookup, rDisplays);
                                        rCurve->getSharedCurve(freq, nIters);
                                        delete rCurve;
@@ -223,12 +225,12 @@ int RareFactSharedCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -237,7 +239,7 @@ int RareFactSharedCommand::execute(){
                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {     delete lookup[i]; }  } 
                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                        rCurve = new Rarefact(lookup, rDisplays);
                        rCurve->getSharedCurve(freq, nIters);
                        delete rCurve;
@@ -248,11 +250,16 @@ int RareFactSharedCommand::execute(){
                
                //reset groups parameter
                globaldata->Groups.clear();  
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "RareFactSharedCommand", "execute");
+               m->errorOut(e, "RareFactSharedCommand", "execute");
                exit(1);
        }
 }
index aa321e84e7d7115c7a000403da3bcd39959dbab2..da26d174ca3c3cc9da41027f5252aa8f58288f20 100644 (file)
@@ -21,7 +21,7 @@ class GlobalData;
 class RareFactSharedCommand : public Command {
        
 public:
-       RareFactSharedCommand(string);  
+       RareFactSharedCommand(string);
        ~RareFactSharedCommand();
        int execute();  
        void help();
@@ -40,7 +40,7 @@ private:
        bool abort, allLines, jumble;
        set<string> labels; //holds labels to be used
        string label, calc, groups, outputDir;
-       vector<string>  Estimators, Groups;
+       vector<string>  Estimators, Groups, outputNames;
 
 
 };
index a6d23e95bfddf71afb20a2d4c2b2d8d1377db71d..616d4f7824c0bc3458d55a3e7eb18aa82751d75d 100644 (file)
@@ -16,12 +16,13 @@ inline bool compareOverlap(seqDist left, seqDist right){
        return (left.dist < right.dist);        
 } 
 /*********************************************************************************************/
-ReadBlast::ReadBlast(string file, float c, float p, int l, bool m, bool h) : blastfile(file), cutoff(c), penalty(p), length(l), minWanted(m), hclusterWanted(h) {
+ReadBlast::ReadBlast(string file, float c, float p, int l, bool ms, bool h) : blastfile(file), cutoff(c), penalty(p), length(l), minWanted(ms), hclusterWanted(h) {
        try {
+               m = MothurOut::getInstance();
                matrix = NULL;
        }
        catch(exception& e) {
-               errorOut(e, "ReadBlast", "ReadBlast");
+               m->errorOut(e, "ReadBlast", "ReadBlast");
                exit(1);
        }
 } 
@@ -98,7 +99,7 @@ void ReadBlast::read(NameAssignment* nameMap) {
                                        }
                                }
                        }
-               }else { mothurOut("Error in your blast file, cannot read."); mothurOutEndLine(); exit(1); }
+               }else { m->mothurOut("Error in your blast file, cannot read."); m->mothurOutEndLine(); exit(1); }
 
                                
                //read file
@@ -260,14 +261,14 @@ void ReadBlast::read(NameAssignment* nameMap) {
                fileHandle.close();
        }
        catch(exception& e) {
-               errorOut(e, "ReadBlast", "read");
+               m->errorOut(e, "ReadBlast", "read");
                exit(1);
        }
 } 
 /*********************************************************************************************/
 void ReadBlast::readNames(NameAssignment* nameMap) {
        try {
-               mothurOut("Reading names... "); cout.flush();
+               m->mothurOut("Reading names... "); cout.flush();
                
                string name, hold, prevName;
                int num = 1;
@@ -307,11 +308,11 @@ void ReadBlast::readNames(NameAssignment* nameMap) {
                //nameMap->print(out);
                //out.close();
                
-               mothurOut(toString(num) + " names read."); mothurOutEndLine();
+               m->mothurOut(toString(num) + " names read."); m->mothurOutEndLine();
                
        }
        catch(exception& e) {
-               errorOut(e, "ReadBlast", "readNames");
+               m->errorOut(e, "ReadBlast", "readNames");
                exit(1);
        }
 } 
index 128c144fc3d29109453331c059b478c18f7a6bfe..536d1af05db87dce20deaf344bd6410b952a61cb 100644 (file)
@@ -40,6 +40,7 @@ private:
        
        SparseMatrix* matrix;
        vector<seqDist> overlap;
+       MothurOut* m;
        
        void readNames(NameAssignment*);
 };
index 11b8d012a22e592d99bb71e3063c0c89a710252a..1cf9fc325b0ecdc5d222ded20346f79134f3b6b7 100644 (file)
@@ -13,6 +13,7 @@
 
 ReadCluster::ReadCluster(string distfile, float c){
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
         distFile = distfile;
                cutoff = c;
 }
@@ -29,7 +30,7 @@ void ReadCluster::read(NameAssignment* nameMap){
                        
        }
        catch(exception& e) {
-               errorOut(e, "ReadCluster", "read");
+               m->errorOut(e, "ReadCluster", "read");
                exit(1);
        }
 }
@@ -63,7 +64,7 @@ void ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                }
                else{
                        list = new ListVector(nameMap->getListVector());
-                       if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                       if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                }
         
                char d;
@@ -106,7 +107,7 @@ void ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                                        
                                }
                                else{
-                                       if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                                       if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                                        
                                        for(int j=0;j<i;j++){
                                                in >> distance;
@@ -139,7 +140,7 @@ void ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                                        }
                                }
                                else{
-                                       if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                                       if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                                        
                                        for(int j=0;j<nseqs;j++){
                                                in >> distance;
@@ -190,7 +191,7 @@ void ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                distFile = outputFile;
        }
        catch(exception& e) {
-               errorOut(e, "ReadCluster", "convertPhylip2Column");
+               m->errorOut(e, "ReadCluster", "convertPhylip2Column");
                exit(1);
        }
 }
index bcd910cb1c032e06df74aae9acfd55e7b3be2142..d578a0fe76b025d03431446cf74f426814bc9c46 100644 (file)
@@ -34,6 +34,7 @@ private:
        string OutPutFile, format;
        ListVector* list;
        float cutoff;
+       MothurOut* m;
        
        void convertPhylip2Column(NameAssignment*);
 };
index 6b8892b6eb1068563e8cf69e30b0274e07e0b15a..12a38c22b6ca045a2f5b1aa7e2ffdeb11cee4201 100644 (file)
@@ -127,7 +127,7 @@ void ReadColumnMatrix::read(NameAssignment* nameMap){
 \r
        }\r
        catch(exception& e) {\r
-               errorOut(e, "ReadColumnMatrix", "read");\r
+               m->errorOut(e, "ReadColumnMatrix", "read");\r
                exit(1);\r
        }\r
 }\r
index 9cb2046139ba7d275aa31cb1e9024bf9a729cbf2..c83ed8a9a6031663869176a3dda21923229da03a 100644 (file)
@@ -12,7 +12,7 @@
 #include "readcolumn.h"
 #include "readmatrix.hpp"
 
-ReadDistCommand::ReadDistCommand(string option){
+ReadDistCommand::ReadDistCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -108,8 +108,8 @@ ReadDistCommand::ReadDistCommand(string option){
                        if ((phylipfile != "") && (groupfile != "")) { 
                        globaldata->setFormat("matrix"); }
                        
-                       if ((phylipfile == "") && (columnfile == "")) { mothurOut("When executing a read.dist command you must enter a phylip or a column."); mothurOutEndLine(); abort = true; }
-                       else if ((phylipfile != "") && (columnfile != "")) { mothurOut("When executing a read.dist command you must enter ONLY ONE of the following: phylip or column."); mothurOutEndLine(); abort = true; }
+                       if ((phylipfile == "") && (columnfile == "")) { m->mothurOut("When executing a read.dist command you must enter a phylip or a column."); m->mothurOutEndLine(); abort = true; }
+                       else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When executing a read.dist command you must enter ONLY ONE of the following: phylip or column."); m->mothurOutEndLine(); abort = true; }
                
                        if (columnfile != "") {
                                if (namefile == "") {  cout << "You need to provide a namefile if you are going to use the column format." << endl; abort = true; }
@@ -158,7 +158,7 @@ ReadDistCommand::ReadDistCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "ReadDistCommand", "ReadDistCommand");
+               m->errorOut(e, "ReadDistCommand", "ReadDistCommand");
                exit(1);
        }
 }
@@ -166,19 +166,19 @@ ReadDistCommand::ReadDistCommand(string option){
 
 void ReadDistCommand::help(){
        try {
-               mothurOut("The read.dist command parameter options are phylip or column, group, name, cutoff and precision\n");
-               mothurOut("The read.dist command can be used in two ways.  The first is to read a phylip or column and run the cluster command\n");
-               mothurOut("For this use the read.dist command should be in the following format: \n");
-               mothurOut("read.dist(phylip=yourDistFile, name=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) \n");
-               mothurOut("The phylip or column parameter is required, but only one may be used.  If you use a column file the name filename is required. \n");
-               mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
-               mothurOut("The second way to use the read.dist command is to read a phylip or column and a group, so you can use the libshuff command.\n");
-               mothurOut("For this use the read.dist command should be in the following format: \n");
-               mothurOut("read.dist(phylip=yourPhylipfile, group=yourGroupFile). The cutoff and precision parameters are not valid with this use.  \n");
-               mothurOut("Note: No spaces between parameter labels (i.e. phylip), '=' and parameters (i.e.yourPhylipfile).\n\n");
+               m->mothurOut("The read.dist command parameter options are phylip or column, group, name, cutoff and precision\n");
+               m->mothurOut("The read.dist command can be used in two ways.  The first is to read a phylip or column and run the cluster command\n");
+               m->mothurOut("For this use the read.dist command should be in the following format: \n");
+               m->mothurOut("read.dist(phylip=yourDistFile, name=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) \n");
+               m->mothurOut("The phylip or column parameter is required, but only one may be used.  If you use a column file the name filename is required. \n");
+               m->mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
+               m->mothurOut("The second way to use the read.dist command is to read a phylip or column and a group, so you can use the libshuff command.\n");
+               m->mothurOut("For this use the read.dist command should be in the following format: \n");
+               m->mothurOut("read.dist(phylip=yourPhylipfile, group=yourGroupFile). The cutoff and precision parameters are not valid with this use.  \n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. phylip), '=' and parameters (i.e.yourPhylipfile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "ReadDistCommand", "help");
+               m->errorOut(e, "ReadDistCommand", "help");
                exit(1);
        }
 }
@@ -203,6 +203,8 @@ int ReadDistCommand::execute(){
                time_t start = time(NULL);
                size_t numDists = 0;
                
+               vector<string> outputNames;
+               
                if (format == "matrix") {
                        ifstream in;
                        openInputFile(distFileName, in);
@@ -211,11 +213,12 @@ int ReadDistCommand::execute(){
                        
                        //if files don't match...
                        if (matrix->getNumSeqs() < groupMap->getNumSeqs()) {  
-                               mothurOut("Your distance file contains " + toString(matrix->getNumSeqs()) + " sequences, and your group file contains " + toString(groupMap->getNumSeqs()) + " sequences.");  mothurOutEndLine();                               
+                               m->mothurOut("Your distance file contains " + toString(matrix->getNumSeqs()) + " sequences, and your group file contains " + toString(groupMap->getNumSeqs()) + " sequences.");  m->mothurOutEndLine();                         
                                //create new group file
                                if(outputDir == "") { outputDir += hasPath(groupfile); }
                                
                                string newGroupFile = outputDir + getRootName(getSimpleName(groupfile)) + "editted.groups";
+                               outputNames.push_back(newGroupFile);
                                ofstream outGroups;
                                openOutputFile(newGroupFile, outGroups);
                                
@@ -225,7 +228,7 @@ int ReadDistCommand::execute(){
                                }
                                outGroups.close();
                                
-                               mothurOut(newGroupFile + " is a new group file containing only the sequence that are in your distance file. I will read this file instead."); mothurOutEndLine();
+                               m->mothurOut(newGroupFile + " is a new group file containing only the sequence that are in your distance file. I will read this file instead."); m->mothurOutEndLine();
                                
                                //read new groupfile
                                delete groupMap; groupMap = NULL;
@@ -277,14 +280,22 @@ int ReadDistCommand::execute(){
        //dist_string = dist_string.append("\t").append(toString(dist_cutoff[i]));
       //       count_string = count_string.append("\t").append(toString(dist_count[i]));
                //      }
-      //mothurOut(dist_string); mothurOutEndLine(); mothurOut(count_string); mothurOutEndLine();
+      //m->mothurOut(dist_string); m->mothurOutEndLine(); m->mothurOut(count_string); m->mothurOutEndLine();
+               }
+               
+               if (outputNames.size() != 0) {
+                       m->mothurOutEndLine();
+                       m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+                       m->mothurOutEndLine();
                }
-               mothurOut("It took " + toString(time(NULL) - start) + " secs to read "); mothurOutEndLine();
+               
+               m->mothurOut("It took " + toString(time(NULL) - start) + " secs to read "); m->mothurOutEndLine();
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "ReadDistCommand", "execute");
+               m->errorOut(e, "ReadDistCommand", "execute");
                exit(1);
        }
 }
index d8f9bd11eff62b07593c29e728c35c5ddcf2ac2f..2c47832f166ea0df47a7b5f5a8760c73f9ce2dfe 100644 (file)
@@ -21,7 +21,7 @@ class SparseMatrix;
 class ReadMatrix {
 
 public:
-       ReadMatrix(){   D = new SparseMatrix(); }
+       ReadMatrix(){   D = new SparseMatrix();  m = MothurOut::getInstance();  }
        virtual ~ReadMatrix() {}
        virtual void read(NameAssignment*){};
        virtual void read(GlobalData* globaldata){};
@@ -37,6 +37,7 @@ protected:
        ListVector* list;
        GlobalData* globaldata;
        float cutoff;
+       MothurOut* m;
 };
 
 
index 84132ae5bdecda6f1e967dffdbeb284cfd281f23..98a63f05cdbea47c62c9dc07d7fd8c65dec35319 100644 (file)
@@ -12,7 +12,7 @@
 /***********************************************************************/
 
 ReadOTUFile::ReadOTUFile(string pf): philFile(pf){
-       
+       m = MothurOut::getInstance();
        //openInputFile(philFile, fileHandle);
 }
 
@@ -70,7 +70,7 @@ void ReadOTUFile::read(GlobalData* globaldata){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ReadOTUFile", "read");
+               m->errorOut(e, "ReadOTUFile", "read");
                exit(1);
        }
 }
index 399316de394f1daea988aaeed19fb8c826ba7e36..6c8d67cd5e9af9508bd91e4ab5e07e9ea5a061e1 100644 (file)
--- a/readotu.h
+++ b/readotu.h
@@ -39,6 +39,7 @@ private:
        SAbundVector* sabund;
        RAbundVector* rabund;
        GlobalData* globaldata;
+       MothurOut* m;
        // InputData* getInput()                        {       return input;   }
 };
 
index 89013e68bfd0235678ac6664838e3259596956f3..4ad63da5655b4bb6118d09b339f3be0f3651dd04 100644 (file)
@@ -10,7 +10,7 @@
 #include "readotucommand.h"
 
 //**********************************************************************************************************************
-ReadOtuCommand::ReadOtuCommand(string option){
+ReadOtuCommand::ReadOtuCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -142,7 +142,7 @@ ReadOtuCommand::ReadOtuCommand(string option){
                        
                        //you have not given a file
                        if ((listfile == "") && (sharedfile == "") && (rabundfile == "") && (sabundfile == "")) {
-                               mothurOut("You must enter either a listfile, rabundfile, sabundfile or a sharedfile with the read.otu command. "); mothurOutEndLine(); abort = true; 
+                               m->mothurOut("You must enter either a listfile, rabundfile, sabundfile or a sharedfile with the read.otu command. "); m->mothurOutEndLine(); abort = true; 
                        }
                
                        //check for optional parameter and set defaults
@@ -172,7 +172,7 @@ ReadOtuCommand::ReadOtuCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "ReadOtuCommand", "ReadOtuCommand");
+               m->errorOut(e, "ReadOtuCommand", "ReadOtuCommand");
                exit(1);
        }
 }
@@ -180,23 +180,23 @@ ReadOtuCommand::ReadOtuCommand(string option){
 
 void ReadOtuCommand::help(){
        try {
-               mothurOut("The read.otu command must be run before you execute a collect.single, rarefaction.single, summary.single, \n");
-               mothurOut("collect.shared, rarefaction.shared or summary.shared command.   Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command \n");
-               mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, label and groups.\n");
-               mothurOut("The read.otu command can be used in two ways.  The first is to read a list, rabund or sabund and run the collect.single, rarefaction.single or summary.single.\n");
-               mothurOut("For this use the read.otu command should be in the following format: read.otu(list=yourListFile, order=yourOrderFile, label=yourLabels).\n");
-               mothurOut("The list, rabund or sabund parameter is required, but you may only use one of them.\n");
-               mothurOut("The label parameter is used to read specific labels in your input.\n");
-               mothurOut("The second way to use the read.otu command is to read a list and a group, or a shared so you can use the collect.shared, rarefaction.shared or summary.shared commands.\n");
-               mothurOut("In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile) or read.otu(shared=yourSharedFile).  \n");
-               mothurOut("The list parameter and group paramaters or the shared paremeter is required. When using the command the second way with a list and group file read.otu command parses the .list file\n");
-               mothurOut("and separates it into groups.  It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .rabund file for each group. \n");
-               mothurOut("You can use the groups parameter to choose only specific groups to be used in the .shared and .rabund files. \n");
-               mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
+               m->mothurOut("The read.otu command must be run before you execute a collect.single, rarefaction.single, summary.single, \n");
+               m->mothurOut("collect.shared, rarefaction.shared or summary.shared command.   Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command \n");
+               m->mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, label and groups.\n");
+               m->mothurOut("The read.otu command can be used in two ways.  The first is to read a list, rabund or sabund and run the collect.single, rarefaction.single or summary.single.\n");
+               m->mothurOut("For this use the read.otu command should be in the following format: read.otu(list=yourListFile, order=yourOrderFile, label=yourLabels).\n");
+               m->mothurOut("The list, rabund or sabund parameter is required, but you may only use one of them.\n");
+               m->mothurOut("The label parameter is used to read specific labels in your input.\n");
+               m->mothurOut("The second way to use the read.otu command is to read a list and a group, or a shared so you can use the collect.shared, rarefaction.shared or summary.shared commands.\n");
+               m->mothurOut("In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile) or read.otu(shared=yourSharedFile).  \n");
+               m->mothurOut("The list parameter and group paramaters or the shared paremeter is required. When using the command the second way with a list and group file read.otu command parses the .list file\n");
+               m->mothurOut("and separates it into groups.  It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .rabund file for each group. \n");
+               m->mothurOut("You can use the groups parameter to choose only specific groups to be used in the .shared and .rabund files. \n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "ReadOtuCommand", "help");
+               m->errorOut(e, "ReadOtuCommand", "help");
                exit(1);
        }
 }
@@ -225,6 +225,11 @@ int ReadOtuCommand::execute(){
                                globaldata->setListFile("");
                                globaldata->setGroupFile("");
                                globaldata->setSharedFile("");
+                       }else {
+                               m->mothurOutEndLine();
+                               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+                               m->mothurOut(globaldata->getSharedFile()); m->mothurOutEndLine();       
+                               m->mothurOutEndLine();
                        }
                        
                        delete shared;
@@ -232,7 +237,7 @@ int ReadOtuCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ReadOtuCommand", "execute");
+               m->errorOut(e, "ReadOtuCommand", "execute");
                exit(1);
        }
 }
index 5f92275eb9e6d4c8e3ee21241bbd6f626a295bc1..6d7d4d0d7e322fc006a9e5ade0dcddbe453eee44 100644 (file)
@@ -38,7 +38,7 @@ void ReadPhylipMatrix::read(NameAssignment* nameMap){
                         }
                         else{
                                 list = new ListVector(nameMap->getListVector());
-                                if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                                if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                         }
         
                         char d;
@@ -89,7 +89,7 @@ void ReadPhylipMatrix::read(NameAssignment* nameMap){
                                 
                                         }
                                         else{
-                                                if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                                                if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                                 
                                                 for(int j=0;j<i;j++){
                                                         fileHandle >> distance;
@@ -133,7 +133,7 @@ void ReadPhylipMatrix::read(NameAssignment* nameMap){
                                         
                                         }
                                         else{
-                                                if(nameMap->count(name)==0){        mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); mothurOutEndLine(); }
+                                                if(nameMap->count(name)==0){        m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
                                 
                                                 for(int j=0;j<nseqs;j++){
                                                         fileHandle >> distance;
@@ -162,13 +162,13 @@ void ReadPhylipMatrix::read(NameAssignment* nameMap){
                                 }
                                 if(nameMap->size() > 0){
                                         //should probably tell them what is missing if we missed something
-                                        mothurOut("missed something\t" + toString(nameMap->size())); mothurOutEndLine();
+                                        m->mothurOut("missed something\t" + toString(nameMap->size())); m->mothurOutEndLine();
                                 }
                         } */
 
                 }
         catch(exception& e) {
-               errorOut(e, "ReadPhylipMatrix", "read");
+               m->errorOut(e, "ReadPhylipMatrix", "read");
                 exit(1);
         }
        }
index cdaa38701e0593817d5af7b415e308429fe2e6a1..661a5a92583b7077a8e3b5c987f30c72c6f50a84 100644 (file)
 ReadTree::ReadTree() {
        try {
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
                globaldata->gTree.clear();
        }
        catch(exception& e) {
-               errorOut(e, "ReadTree", "ReadTree");
+               m->errorOut(e, "ReadTree", "ReadTree");
                exit(1);
        }
 }
@@ -28,11 +29,11 @@ int ReadTree::readSpecialChar(istream& f, char c, string name) {
                char d = f.get();
        
                if(d == EOF){
-                       mothurOut("Error: Input file ends prematurely, expecting a " + name + "\n");
+                       m->mothurOut("Error: Input file ends prematurely, expecting a " + name + "\n");
                        exit(1);
                }
                if(d != c){
-                       mothurOut("Error: Expected " + name + " in input file.  Found " + toString(d) + ".\n");
+                       m->mothurOut("Error: Expected " + name + " in input file.  Found " + toString(d) + ".\n");
                        exit(1);
                }
                if(d == ')' && f.peek() == '\n'){
@@ -41,7 +42,7 @@ int ReadTree::readSpecialChar(istream& f, char c, string name) {
                return d;
        }
        catch(exception& e) {
-               errorOut(e, "ReadTree", "readSpecialChar");
+               m->errorOut(e, "ReadTree", "readSpecialChar");
                exit(1);
        }
 }
@@ -54,13 +55,13 @@ int ReadTree::readNodeChar(istream& f) {
                char d = f.get();
 
                if(d == EOF){
-                       mothurOut("Error: Input file ends prematurely, expecting a left parenthesis\n");
+                       m->mothurOut("Error: Input file ends prematurely, expecting a left parenthesis\n");
                        exit(1);
                }
                return d;
        }
        catch(exception& e) {
-               errorOut(e, "ReadTree", "readNodeChar");
+               m->errorOut(e, "ReadTree", "readNodeChar");
                exit(1);
        }
 }
@@ -72,14 +73,14 @@ float ReadTree::readBranchLength(istream& f) {
                float b;
        
                if(!(f >> b)){
-                       mothurOut("Error: Missing branch length in input tree.\n");
+                       m->mothurOut("Error: Missing branch length in input tree.\n");
                        exit(1);
                }
                gobble(f);
                return b;
        }
        catch(exception& e) {
-               errorOut(e, "ReadTree", "readBranchLength");
+               m->errorOut(e, "ReadTree", "readBranchLength");
                exit(1);
        }
 }
@@ -167,7 +168,7 @@ int ReadNewickTree::read() {
                return readOk;
        }
        catch(exception& e) {
-               errorOut(e, "ReadNewickTree", "read");
+               m->errorOut(e, "ReadNewickTree", "read");
                exit(1);
        }
 }
@@ -208,7 +209,7 @@ void ReadNewickTree::nexusTranslation() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "ReadNewickTree", "nexusTranslation");
+               m->errorOut(e, "ReadNewickTree", "nexusTranslation");
                exit(1);
        }
 }
@@ -228,7 +229,7 @@ int ReadNewickTree::readTreeString() {
                        n = numLeaves;  //number of leaves / sequences, we want node 1 to start where the leaves left off
 
                        lc = readNewickInt(filehandle, n, T);
-                       if (lc == -1) { mothurOut("error with lc"); mothurOutEndLine(); return -1; } //reports an error in reading
+                       if (lc == -1) { m->mothurOut("error with lc"); m->mothurOutEndLine(); return -1; } //reports an error in reading
                
                        if(filehandle.peek()==','){                                                     
                                readSpecialChar(filehandle,',',"comma");
@@ -239,7 +240,7 @@ int ReadNewickTree::readTreeString() {
                        }                                                                                               
                        if(rooted != 1){                                                                
                                rc = readNewickInt(filehandle, n, T);
-                               if (rc == -1) { mothurOut("error with rc"); mothurOutEndLine(); return -1; } //reports an error in reading
+                               if (rc == -1) { m->mothurOut("error with rc"); m->mothurOutEndLine(); return -1; } //reports an error in reading
                                if(filehandle.peek() == ')'){                                   
                                        readSpecialChar(filehandle,')',"right parenthesis");
                                }                                                                                       
@@ -255,7 +256,7 @@ int ReadNewickTree::readTreeString() {
                        n = T->getIndex(name);
 
                        if(n!=0){
-                               mothurOut("Internal error: The only taxon is not taxon 0.\n");
+                               m->mothurOut("Internal error: The only taxon is not taxon 0.\n");
                                //exit(1);
                                readOk = -1; return -1;
                        }
@@ -274,7 +275,7 @@ int ReadNewickTree::readTreeString() {
        
        }
        catch(exception& e) {
-               errorOut(e, "ReadNewickTree", "readTreeString");
+               m->errorOut(e, "ReadNewickTree", "readTreeString");
                exit(1);
        }
 }
@@ -303,7 +304,7 @@ int ReadNewickTree::readNewickInt(istream& f, int& n, Tree* T) {
                        if(f.peek() == ':'){                                                                          
                                readSpecialChar(f,':',"colon"); 
                                                                                
-                               if(n >= numNodes){      mothurOut("Error: Too many nodes in input tree\n");  readOk = -1; return -1; }
+                               if(n >= numNodes){      m->mothurOut("Error: Too many nodes in input tree\n");  readOk = -1; return -1; }
                                
                                T->tree[n].setBranchLength(readBranchLength(f));
                        }else{
@@ -337,7 +338,7 @@ int ReadNewickTree::readNewickInt(istream& f, int& n, Tree* T) {
                        
                        //adds sequence names that are not in group file to the "xxx" group
                        if(group == "not found") {
-                               mothurOut("Name: " + name + " is not in your groupfile, and will be disregarded. \n");  //readOk = -1; return n1;
+                               m->mothurOut("Name: " + name + " is not in your groupfile, and will be disregarded. \n");  //readOk = -1; return n1;
                                
                                globaldata->gTreemap->namesOfSeqs.push_back(name);
                                globaldata->gTreemap->treemap[name].groupname = "xxx";
@@ -373,7 +374,7 @@ int ReadNewickTree::readNewickInt(istream& f, int& n, Tree* T) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "ReadNewickTree", "readNewickInt");
+               m->errorOut(e, "ReadNewickTree", "readNewickInt");
                exit(1);
        }
 }
index 0cdf8b1fb8b426f6e358143e492a7c6cae64146e..540f80cfa731ab2102fa0a8908737321f73a5cba 100644 (file)
@@ -33,6 +33,7 @@ class ReadTree {
        protected:
                GlobalData* globaldata;
                int numNodes, numLeaves;
+               MothurOut* m;
                
                
 };
index a11465d669a55de0c5555f616c36f51caef74ea2..da66ee1eb0971362e8f19ff62155c26239da5615 100644 (file)
 #include "readtreecommand.h"
 
 //**********************************************************************************************************************
-ReadTreeCommand::ReadTreeCommand(string option){
+ReadTreeCommand::ReadTreeCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
-               
+                               
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -71,12 +71,12 @@ ReadTreeCommand::ReadTreeCommand(string option){
                        //check for required parameters
                        treefile = validParameter.validFile(parameters, "tree", true);
                        if (treefile == "not open") { abort = true; }
-                       else if (treefile == "not found") { treefile = ""; mothurOut("tree is a required parameter for the read.tree command."); mothurOutEndLine(); abort = true;  }   
+                       else if (treefile == "not found") { treefile = ""; m->mothurOut("tree is a required parameter for the read.tree command."); m->mothurOutEndLine(); abort = true;  }     
                        else {  globaldata->setTreeFile(treefile);  globaldata->setFormat("tree");      }
                        
                        groupfile = validParameter.validFile(parameters, "group", true);
                        if (groupfile == "not open") { abort = true; }  
-                       else if (groupfile == "not found") { groupfile = ""; mothurOut("group is a required parameter for the read.tree command."); mothurOutEndLine(); abort = true;   }
+                       else if (groupfile == "not found") { groupfile = ""; m->mothurOut("group is a required parameter for the read.tree command."); m->mothurOutEndLine(); abort = true;     }
                        else {  
                                globaldata->setGroupFile(groupfile); 
                                //read in group map info.
@@ -98,7 +98,7 @@ ReadTreeCommand::ReadTreeCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ReadTreeCommand", "ReadTreeCommand");              
+               m->errorOut(e, "ReadTreeCommand", "ReadTreeCommand");           
                exit(1);
        }
 }
@@ -106,14 +106,14 @@ ReadTreeCommand::ReadTreeCommand(string option){
 
 void ReadTreeCommand::help(){
        try {
-               mothurOut("The read.tree command must be run before you execute a unifrac.weighted, unifrac.unweighted. \n");
-               mothurOut("It also must be run before using the parsimony command, unless you are using the randomtree parameter.\n");
-               mothurOut("The read.tree command should be in the following format: read.tree(tree=yourTreeFile, group=yourGroupFile).\n");
-               mothurOut("The tree and group parameters are both required.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. tree), '=' and parameters (i.e.yourTreefile).\n\n");
+               m->mothurOut("The read.tree command must be run before you execute a unifrac.weighted, unifrac.unweighted. \n");
+               m->mothurOut("It also must be run before using the parsimony command, unless you are using the randomtree parameter.\n");
+               m->mothurOut("The read.tree command should be in the following format: read.tree(tree=yourTreeFile, group=yourGroupFile).\n");
+               m->mothurOut("The tree and group parameters are both required.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. tree), '=' and parameters (i.e.yourTreefile).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "ReadTreeCommand", "help"); 
+               m->errorOut(e, "ReadTreeCommand", "help");      
                exit(1);
        }
 }
@@ -135,7 +135,7 @@ int ReadTreeCommand::execute(){
                
                readOk = read->read(); 
                
-               if (readOk != 0) { mothurOut("Read Terminated."); mothurOutEndLine(); globaldata->gTree.clear(); delete globaldata->gTreemap; return 0; }
+               if (readOk != 0) { m->mothurOut("Read Terminated."); m->mothurOutEndLine(); globaldata->gTree.clear(); delete globaldata->gTreemap; return 0; }
                
                vector<Tree*> T = globaldata->gTree;
 
@@ -160,7 +160,7 @@ int ReadTreeCommand::execute(){
                                        map<string, string>::iterator it = nameMap.find(treeMap->namesOfSeqs[i]);
                                        
                                        if (it == nameMap.end()) {
-                                               mothurOut(treeMap->namesOfSeqs[i] + " is in your groupfile and not in your tree. It will be disregarded."); mothurOutEndLine();
+                                               m->mothurOut(treeMap->namesOfSeqs[i] + " is in your groupfile and not in your tree. It will be disregarded."); m->mothurOutEndLine();
                                                treeMap->removeSeq(treeMap->namesOfSeqs[i]);
                                                i--; //need this because removeSeq removes name from namesOfSeqs
                                        }
@@ -171,7 +171,7 @@ int ReadTreeCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ReadTreeCommand", "execute");      
+               m->errorOut(e, "ReadTreeCommand", "execute");   
                exit(1);
        }
 }
@@ -198,14 +198,14 @@ int ReadTreeCommand::readNamesFile() {
                                splitAtComma(second, dupNames);
                                
                                for (int i = 0; i < dupNames.size(); i++) {     nameMap[dupNames[i]] = dupNames[i];  }
-                       }else {  mothurOut(first + " has already been seen in namefile, disregarding names file."); mothurOutEndLine(); in.close(); globaldata->names.clear(); return 1; }                      
+                       }else {  m->mothurOut(first + " has already been seen in namefile, disregarding names file."); m->mothurOutEndLine(); in.close(); globaldata->names.clear(); return 1; }                        
                }
                in.close();
                
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ReadTreeCommand", "readNamesFile");
+               m->errorOut(e, "ReadTreeCommand", "readNamesFile");
                exit(1);
        }
 }
index 19a4bc032abbcd1a5a7c9f53cdeac1b1be2c5715..c76c7113f237c45df86a91faa523f93163fc6ff8 100644 (file)
@@ -13,7 +13,7 @@
 
 //**********************************************************************************************************************
 
-RemoveSeqsCommand::RemoveSeqsCommand(string option){
+RemoveSeqsCommand::RemoveSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -97,7 +97,7 @@ RemoveSeqsCommand::RemoveSeqsCommand(string option){
                        //check for required parameters
                        accnosfile = validParameter.validFile(parameters, "accnos", true);
                        if (accnosfile == "not open") { abort = true; }
-                       else if (accnosfile == "not found") {  accnosfile = "";  mothurOut("You must provide an accnos file."); mothurOutEndLine(); abort = true; }     
+                       else if (accnosfile == "not found") {  accnosfile = "";  m->mothurOut("You must provide an accnos file."); m->mothurOutEndLine(); abort = true; }       
                        
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
@@ -123,20 +123,20 @@ RemoveSeqsCommand::RemoveSeqsCommand(string option){
                        string temp = validParameter.validFile(parameters, "dups", false);      if (temp == "not found") { temp = "false"; usedDups = ""; }
                        dups = isTrue(temp);
                        
-                       if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == ""))  { mothurOut("You must provide one of the following: fasta, name, group, alignreport or list."); mothurOutEndLine(); abort = true; }
+                       if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == ""))  { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport or list."); m->mothurOutEndLine(); abort = true; }
                        
                        int okay = 2;
                        if (outputDir != "") { okay++; }
                        if (usedDups != "") { okay++;  }
                        
-                       if ((usedDups != "") && (namefile == "")) {  mothurOut("You may only use dups with the name option."); mothurOutEndLine();  abort = true; }
+                       if ((usedDups != "") && (namefile == "")) {  m->mothurOut("You may only use dups with the name option."); m->mothurOutEndLine();  abort = true; }
                        
-                       if (parameters.size() > okay) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport, or list."); mothurOutEndLine(); abort = true;  }
+                       if (parameters.size() > okay) { m->mothurOut("You may only enter one of the following: fasta, name, group, alignreport, or list."); m->mothurOutEndLine(); abort = true;  }
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "RemoveSeqsCommand");
+               m->errorOut(e, "RemoveSeqsCommand", "RemoveSeqsCommand");
                exit(1);
        }
 }
@@ -144,16 +144,16 @@ RemoveSeqsCommand::RemoveSeqsCommand(string option){
 
 void RemoveSeqsCommand::help(){
        try {
-               mothurOut("The remove.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
-               mothurOut("It outputs a file containing the sequences NOT in the .accnos file.\n");
-               mothurOut("The remove.seqs command parameters are accnos, fasta, name, group, list, alignreport and dups.  You must provide accnos and one of the file parameters.\n");
-               mothurOut("The dups parameter allows you to remove the entire line from a name file if you remove any name from the line. default=false. If dups=true, then remove.seqs outputs a new .accnos file containing all the sequences removed. \n");
-               mothurOut("The remove.seqs command should be in the following format: remove.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
-               mothurOut("Example remove.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The remove.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
+               m->mothurOut("It outputs a file containing the sequences NOT in the .accnos file.\n");
+               m->mothurOut("The remove.seqs command parameters are accnos, fasta, name, group, list, alignreport and dups.  You must provide accnos and one of the file parameters.\n");
+               m->mothurOut("The dups parameter allows you to remove the entire line from a name file if you remove any name from the line. default=false. If dups=true, then remove.seqs outputs a new .accnos file containing all the sequences removed. \n");
+               m->mothurOut("The remove.seqs command should be in the following format: remove.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
+               m->mothurOut("Example remove.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "help");
+               m->errorOut(e, "RemoveSeqsCommand", "help");
                exit(1);
        }
 }
@@ -175,11 +175,18 @@ int RemoveSeqsCommand::execute(){
                else if (alignfile != "")       {               readAlign();    }
                else if (listfile != "")        {               readList();             }
                
+               if (outputNames.size() != 0) {
+                       m->mothurOutEndLine();
+                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+                       m->mothurOutEndLine();
+               }
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "execute");
+               m->errorOut(e, "RemoveSeqsCommand", "execute");
                exit(1);
        }
 }
@@ -216,13 +223,13 @@ void RemoveSeqsCommand::readFasta(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readFasta");
+               m->errorOut(e, "RemoveSeqsCommand", "readFasta");
                exit(1);
        }
 }
@@ -281,13 +288,13 @@ void RemoveSeqsCommand::readList(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readList");
+               m->errorOut(e, "RemoveSeqsCommand", "readList");
                exit(1);
        }
 }
@@ -374,16 +381,16 @@ void RemoveSeqsCommand::readName(){
                if (dups) { out2.close();  }
                if (wroteDups == false) {
                        remove(outputFileName2.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName2); }
                
                if (wroteSomething == false) {
-                       mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName); }
                
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readName");
+               m->errorOut(e, "RemoveSeqsCommand", "readName");
                exit(1);
        }
 }
@@ -419,13 +426,13 @@ void RemoveSeqsCommand::readGroup(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName); }
 
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readGroup");
+               m->errorOut(e, "RemoveSeqsCommand", "readGroup");
                exit(1);
        }
 }
@@ -485,13 +492,13 @@ void RemoveSeqsCommand::readAlign(){
                out.close();
                
                if (wroteSomething == false) {
-                       mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
                        remove(outputFileName.c_str()); 
-               }
+               }else { outputNames.push_back(outputFileName); }
                
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readAlign");
+               m->errorOut(e, "RemoveSeqsCommand", "readAlign");
                exit(1);
        }
 }
@@ -514,7 +521,7 @@ void RemoveSeqsCommand::readAccnos(){
 
        }
        catch(exception& e) {
-               errorOut(e, "RemoveSeqsCommand", "readAccnos");
+               m->errorOut(e, "RemoveSeqsCommand", "readAccnos");
                exit(1);
        }
 }
index 647cb765f0e75781862d0fa74305d55573c85872..ddda08ce9bbfe7f4bc1e6a5aa55e8028667ade37 100644 (file)
@@ -25,6 +25,7 @@ class RemoveSeqsCommand : public Command {
                set<string> names;
                string accnosfile, fastafile, namefile, groupfile, alignfile, listfile, outputDir;
                bool abort, dups;
+               vector<string> outputNames;
                
                void readFasta();
                void readName();
index 274240158068655fcbbc501d81e335238966edfa..4efcbcce17e7daeb102a3c3c98d4baedbc185093 100644 (file)
@@ -13,7 +13,7 @@
 
 //***************************************************************************************************************
 
-ReverseSeqsCommand::ReverseSeqsCommand(string option){
+ReverseSeqsCommand::ReverseSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -53,7 +53,7 @@ ReverseSeqsCommand::ReverseSeqsCommand(string option){
                        //check for required parameters
                        fasta = validParameter.validFile(parameters, "fasta", true);
                        if (fasta == "not open") { abort = true; }
-                       else if (fasta == "not found") { fasta = ""; mothurOut("fasta is a required parameter for the reverse.seqs command."); mothurOutEndLine(); abort = true;  }     
+                       else if (fasta == "not found") { fasta = ""; m->mothurOut("fasta is a required parameter for the reverse.seqs command."); m->mothurOutEndLine(); abort = true;  }       
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -64,7 +64,7 @@ ReverseSeqsCommand::ReverseSeqsCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "ReverseSeqsCommand", "ReverseSeqsCommand");
+               m->errorOut(e, "ReverseSeqsCommand", "ReverseSeqsCommand");
                exit(1);
        }
 }
@@ -72,13 +72,13 @@ ReverseSeqsCommand::ReverseSeqsCommand(string option){
 
 void ReverseSeqsCommand::help(){
        try {
-               mothurOut("The reverse.seqs command reads a fastafile and ....\n");
-               mothurOut("The reverse.seqs command parameter is fasta and it is required.\n");
-               mothurOut("The reverse.seqs command should be in the following format: \n");
-               mothurOut("reverse.seqs(fasta=yourFastaFile) \n");      
+               m->mothurOut("The reverse.seqs command reads a fastafile and ....\n");
+               m->mothurOut("The reverse.seqs command parameter is fasta and it is required.\n");
+               m->mothurOut("The reverse.seqs command should be in the following format: \n");
+               m->mothurOut("reverse.seqs(fasta=yourFastaFile) \n");   
        }
        catch(exception& e) {
-               errorOut(e, "ReverseSeqsCommand", "help");
+               m->errorOut(e, "ReverseSeqsCommand", "help");
                exit(1);
        }
 }
@@ -112,11 +112,17 @@ int ReverseSeqsCommand::execute(){
                inFASTA.close();
                outFASTA.close();
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(reverseFile); m->mothurOutEndLine();       
+               m->mothurOutEndLine();
+
+               
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "ReverseSeqsCommand", "execute");
+               m->errorOut(e, "ReverseSeqsCommand", "execute");
                exit(1);
        }
 }
index 2bb8d69a02614a9ad386062f05f9eda7673bbfa2..6e4401bab964db2755e7ce1bb9f39c67703bf864 100644 (file)
@@ -29,7 +29,7 @@ SAbundVector::SAbundVector(string id, vector<int> sav) : DataVector(id), data(sa
                }
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "SAbundVector");
+               m->errorOut(e, "SAbundVector", "SAbundVector");
                exit(1);
        }
 }
@@ -44,7 +44,7 @@ SAbundVector::SAbundVector(vector <int> dataVec, int mr, int nb, int ns) {
                numSeqs = ns;
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "SAbundVector");
+               m->errorOut(e, "SAbundVector", "SAbundVector");
                exit(1);
        }
 }
@@ -66,7 +66,7 @@ SAbundVector::SAbundVector(ifstream& f): DataVector(), maxRank(0), numBins(0), n
 
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "SAbundVector");
+               m->errorOut(e, "SAbundVector", "SAbundVector");
                exit(1);
        }
 }
@@ -89,7 +89,7 @@ void SAbundVector::set(int sabund, int abundance){
                if(sabund > maxRank)    {       maxRank = sabund;               }
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "set");
+               m->errorOut(e, "SAbundVector", "set");
                exit(1);
        }
 }
@@ -114,7 +114,7 @@ void SAbundVector::push_back(int abundance){
                numSeqs += (maxRank * abundance);
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "push_back");
+               m->errorOut(e, "SAbundVector", "push_back");
                exit(1);
        }
 }
@@ -165,7 +165,7 @@ void SAbundVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "print");
+               m->errorOut(e, "SAbundVector", "print");
                exit(1);
        }
 }
@@ -205,7 +205,7 @@ RAbundVector SAbundVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "getRAbundVector");
+               m->errorOut(e, "SAbundVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -240,7 +240,7 @@ OrderVector SAbundVector::getOrderVector(map<string,int>* hold = NULL){
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SAbundVector", "getOrderVector");
+               m->errorOut(e, "SAbundVector", "getOrderVector");
                exit(1);
        }
 }
index 48bf17119c98d832b0176dcab78675a94ecf80e8..bb8d1f53714e3d953eb0f6c9c7bd4a829b3cb833 100644 (file)
@@ -12,7 +12,7 @@
 
 //***************************************************************************************************************
 
-ScreenSeqsCommand::ScreenSeqsCommand(string option){
+ScreenSeqsCommand::ScreenSeqsCommand(string option)  {
        try {
                abort = false;
                
@@ -76,7 +76,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option){
 
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not found") { mothurOut("fasta is a required parameter for the screen.seqs command."); mothurOutEndLine(); abort = true; }
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the screen.seqs command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastafile == "not open") { abort = true; }     
        
                        groupfile = validParameter.validFile(parameters, "group", true);
@@ -121,7 +121,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "ScreenSeqsCommand", "ScreenSeqsCommand");
+               m->errorOut(e, "ScreenSeqsCommand", "ScreenSeqsCommand");
                exit(1);
        }
 }
@@ -129,25 +129,25 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option){
 
 void ScreenSeqsCommand::help(){
        try {
-               mothurOut("The screen.seqs command reads a fastafile and creates .....\n");
-               mothurOut("The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, and group.\n");
-               mothurOut("The fasta parameter is required.\n");
-               mothurOut("The start parameter .... The default is -1.\n");
-               mothurOut("The end parameter .... The default is -1.\n");
-               mothurOut("The maxambig parameter .... The default is -1.\n");
-               mothurOut("The maxhomop parameter .... The default is -1.\n");
-               mothurOut("The minlength parameter .... The default is -1.\n");
-               mothurOut("The maxlength parameter .... The default is -1.\n");
-               mothurOut("The name parameter allows you to provide a namesfile, and the group parameter allows you to provide a groupfile.\n");
-               mothurOut("The screen.seqs command should be in the following format: \n");
-               mothurOut("screen.seqs(fasta=yourFastaFile, name=youNameFile, group=yourGroupFIle, start=yourStart, end=yourEnd, maxambig=yourMaxambig,  \n");
-               mothurOut("maxhomop=yourMaxhomop, minlength=youMinlength, maxlength=yourMaxlength)  \n");       
-               mothurOut("Example screen.seqs(fasta=abrecovery.fasta, name=abrecovery.names, group=abrecovery.groups, start=..., end=..., maxambig=..., maxhomop=..., minlength=..., maxlength=...).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The screen.seqs command reads a fastafile and creates .....\n");
+               m->mothurOut("The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, and group.\n");
+               m->mothurOut("The fasta parameter is required.\n");
+               m->mothurOut("The start parameter .... The default is -1.\n");
+               m->mothurOut("The end parameter .... The default is -1.\n");
+               m->mothurOut("The maxambig parameter .... The default is -1.\n");
+               m->mothurOut("The maxhomop parameter .... The default is -1.\n");
+               m->mothurOut("The minlength parameter .... The default is -1.\n");
+               m->mothurOut("The maxlength parameter .... The default is -1.\n");
+               m->mothurOut("The name parameter allows you to provide a namesfile, and the group parameter allows you to provide a groupfile.\n");
+               m->mothurOut("The screen.seqs command should be in the following format: \n");
+               m->mothurOut("screen.seqs(fasta=yourFastaFile, name=youNameFile, group=yourGroupFIle, start=yourStart, end=yourEnd, maxambig=yourMaxambig,  \n");
+               m->mothurOut("maxhomop=yourMaxhomop, minlength=youMinlength, maxlength=yourMaxlength)  \n");    
+               m->mothurOut("Example screen.seqs(fasta=abrecovery.fasta, name=abrecovery.names, group=abrecovery.groups, start=..., end=..., maxambig=..., maxhomop=..., minlength=..., maxlength=...).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "ScreenSeqsCommand", "help");
+               m->errorOut(e, "ScreenSeqsCommand", "help");
                exit(1);
        }
 }
@@ -203,10 +203,18 @@ int ScreenSeqsCommand::execute(){
                goodSeqOut.close();
                badSeqOut.close();
                inFASTA.close();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(goodSeqFile); m->mothurOutEndLine();       
+               m->mothurOut(badSeqFile); m->mothurOutEndLine();        
+               m->mothurOutEndLine();
+
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "ScreenSeqsCommand", "execute");
+               m->errorOut(e, "ScreenSeqsCommand", "execute");
                exit(1);
        }
 }
@@ -257,8 +265,8 @@ void ScreenSeqsCommand::screenNameGroupFile(set<string> badSeqNames){
        //we were unable to remove some of the bad sequences
        if (badSeqNames.size() != 0) {
                for (it = badSeqNames.begin(); it != badSeqNames.end(); it++) {  
-                       mothurOut("Your namefile does not include the sequence " + *it + " please correct."); 
-                       mothurOutEndLine();
+                       m->mothurOut("Your namefile does not include the sequence " + *it + " please correct."); 
+                       m->mothurOutEndLine();
                }
        }
 
@@ -294,8 +302,8 @@ void ScreenSeqsCommand::screenNameGroupFile(set<string> badSeqNames){
                //we were unable to remove some of the bad sequences
                if (badSeqGroups.size() != 0) {
                        for (it = badSeqGroups.begin(); it != badSeqGroups.end(); it++) {  
-                               mothurOut("Your namefile does not include the sequence " + *it + " please correct."); 
-                               mothurOutEndLine();
+                               m->mothurOut("Your namefile does not include the sequence " + *it + " please correct."); 
+                               m->mothurOutEndLine();
                        }
                }
        }
@@ -333,8 +341,8 @@ void ScreenSeqsCommand::screenGroupFile(set<string> badSeqNames){
        //we were unable to remove some of the bad sequences
        if (badSeqNames.size() != 0) {
                for (it = badSeqNames.begin(); it != badSeqNames.end(); it++) {  
-                       mothurOut("Your groupfile does not include the sequence " + *it + " please correct."); 
-                       mothurOutEndLine();
+                       m->mothurOut("Your groupfile does not include the sequence " + *it + " please correct."); 
+                       m->mothurOutEndLine();
                }
        }
        
@@ -389,8 +397,8 @@ void ScreenSeqsCommand::screenAlignReport(set<string> badSeqNames){
        //we were unable to remove some of the bad sequences
        if (badSeqNames.size() != 0) {
                for (it = badSeqNames.begin(); it != badSeqNames.end(); it++) {  
-                       mothurOut("Your file does not include the sequence " + *it + " please correct."); 
-                       mothurOutEndLine();
+                       m->mothurOut("Your file does not include the sequence " + *it + " please correct."); 
+                       m->mothurOutEndLine();
                }
        }
 
index 8acd696406c288303128a3c36aef3e6d816f2fbe..e23a0ac6a431ad14cdab21fb0bfa4276f4afd8c6 100644 (file)
 
 //**********************************************************************************************************************
 
-AlignCheckCommand::AlignCheckCommand(string option){
+AlignCheckCommand::AlignCheckCommand(string option)  {
        try {
                abort = false;
                haderror = 0;
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -61,11 +61,11 @@ AlignCheckCommand::AlignCheckCommand(string option){
                        //check for required parameters
                        mapfile = validParameter.validFile(parameters, "map", true);
                        if (mapfile == "not open") { abort = true; }
-                       else if (mapfile == "not found") {  mapfile = "";  mothurOut("You must provide an map file."); mothurOutEndLine(); abort = true; }      
+                       else if (mapfile == "not found") {  mapfile = "";  m->mothurOut("You must provide an map file."); m->mothurOutEndLine(); abort = true; }        
                        
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
-                       else if (fastafile == "not found") {  fastafile = "";  mothurOut("You must provide an fasta file."); mothurOutEndLine(); abort = true;  }       
+                       else if (fastafile == "not found") {  fastafile = "";  m->mothurOut("You must provide an fasta file."); m->mothurOutEndLine(); abort = true;  } 
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -77,7 +77,7 @@ AlignCheckCommand::AlignCheckCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "AlignCheckCommand", "RemoveSeqsCommand");
+               m->errorOut(e, "AlignCheckCommand", "RemoveSeqsCommand");
                exit(1);
        }
 }
@@ -85,15 +85,15 @@ AlignCheckCommand::AlignCheckCommand(string option){
 
 void AlignCheckCommand::help(){
        try {
-               mothurOut("The align.check command reads a fasta file and map file.\n");
-               mothurOut("It outputs a file containing the secondary structure matches in the .align.check file.\n");
-               mothurOut("The align.check command parameters are fasta and map, both are required.\n");
-               mothurOut("The align.check command should be in the following format: align.check(fasta=yourFasta, map=yourMap).\n");
-               mothurOut("Example align.check(map=silva.ss.map, fasta=amazon.fasta).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+               m->mothurOut("The align.check command reads a fasta file and map file.\n");
+               m->mothurOut("It outputs a file containing the secondary structure matches in the .align.check file.\n");
+               m->mothurOut("The align.check command parameters are fasta and map, both are required.\n");
+               m->mothurOut("The align.check command should be in the following format: align.check(fasta=yourFasta, map=yourMap).\n");
+               m->mothurOut("Example align.check(map=silva.ss.map, fasta=amazon.fasta).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "AlignCheckCommand", "help");
+               m->errorOut(e, "AlignCheckCommand", "help");
                exit(1);
        }
 }
@@ -135,11 +135,16 @@ int AlignCheckCommand::execute(){
                in.close();
                out.close();
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(outfile); m->mothurOutEndLine();   
+               m->mothurOutEndLine();
+               
                return 0;               
        }
 
        catch(exception& e) {
-               errorOut(e, "AlignCheckCommand", "execute");
+               m->errorOut(e, "AlignCheckCommand", "execute");
                exit(1);
        }
 }
@@ -167,7 +172,7 @@ void AlignCheckCommand::readMap(){
                for(int i=0;i<seqLength;i++){
                        if(structMap[i] != 0){
                                if(structMap[structMap[i]] != i){
-                                       mothurOut("Your map file contains an error:  line " + toString(i) + " does not match line " + toString(structMap[i]) + "."); mothurOutEndLine();
+                                       m->mothurOut("Your map file contains an error:  line " + toString(i) + " does not match line " + toString(structMap[i]) + "."); m->mothurOutEndLine();
                                }
                        }
                }
@@ -175,7 +180,7 @@ void AlignCheckCommand::readMap(){
                
        }
        catch(exception& e) {
-               errorOut(e, "AlignCheckCommand", "readMap");
+               m->errorOut(e, "AlignCheckCommand", "readMap");
                exit(1);
        }
 }
@@ -189,7 +194,7 @@ statData AlignCheckCommand::getStats(string sequence){
                
                int length = sequence.length();
                
-               if (length != seqLength) { mothurOut("your sequences are " + toString(length) + " long, but your map file only contains " + toString(seqLength) + " entries. please correct."); mothurOutEndLine(); haderror = 1; return data;  }
+               if (length != seqLength) { m->mothurOut("your sequences are " + toString(length) + " long, but your map file only contains " + toString(seqLength) + " entries. please correct."); m->mothurOutEndLine(); haderror = 1; return data;  }
                
                for(int i=1;i<length;i++){
                        if(structMap[i] != 0){
@@ -242,7 +247,7 @@ statData AlignCheckCommand::getStats(string sequence){
                
        }
        catch(exception& e) {
-               errorOut(e, "AlignCheckCommand", "getStats");
+               m->errorOut(e, "AlignCheckCommand", "getStats");
                exit(1);
        }
 }
index 8b07b857c73930bb24265c58da93b7702dccf42d..49edc36f8e7c3d94d32b7995f08c14e955cd232a 100644 (file)
@@ -12,7 +12,7 @@
 
 //***************************************************************************************************************
 
-SeqSummaryCommand::SeqSummaryCommand(string option){
+SeqSummaryCommand::SeqSummaryCommand(string option)  {
        try {
                abort = false;
                
@@ -52,7 +52,7 @@ SeqSummaryCommand::SeqSummaryCommand(string option){
                        //check for required parameters
                        fastafile = validParameter.validFile(parameters, "fasta", true);
                        if (fastafile == "not open") { abort = true; }
-                       else if (fastafile == "not found") { fastafile = ""; mothurOut("fasta is a required parameter for the summary.seqs command."); mothurOutEndLine(); abort = true;  }     
+                       else if (fastafile == "not found") { fastafile = ""; m->mothurOut("fasta is a required parameter for the summary.seqs command."); m->mothurOutEndLine(); abort = true;  }       
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -63,7 +63,7 @@ SeqSummaryCommand::SeqSummaryCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SeqSummaryCommand", "SeqSummaryCommand");
+               m->errorOut(e, "SeqSummaryCommand", "SeqSummaryCommand");
                exit(1);
        }
 }
@@ -71,14 +71,14 @@ SeqSummaryCommand::SeqSummaryCommand(string option){
 
 void SeqSummaryCommand::help(){
        try {
-               mothurOut("The summary.seqs command reads a fastafile and ....\n");
-               mothurOut("The summary.seqs command parameter is fasta and it is required.\n");
-               mothurOut("The summary.seqs command should be in the following format: \n");
-               mothurOut("summary.seqs(fasta=yourFastaFile) \n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");        
+               m->mothurOut("The summary.seqs command reads a fastafile and ....\n");
+               m->mothurOut("The summary.seqs command parameter is fasta and it is required.\n");
+               m->mothurOut("The summary.seqs command should be in the following format: \n");
+               m->mothurOut("summary.seqs(fasta=yourFastaFile) \n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n");     
        }
        catch(exception& e) {
-               errorOut(e, "SeqSummaryCommand", "help");
+               m->errorOut(e, "SeqSummaryCommand", "help");
                exit(1);
        }
 }
@@ -147,22 +147,28 @@ int SeqSummaryCommand::execute(){
                if (startPosition[0] == -1) {  startPosition[0] = 0;    }
                if (endPosition[0] == -1)       {  endPosition[0] = 0;          }
                
-               mothurOutEndLine();
-               mothurOut("\t\tStart\tEnd\tNBases\tAmbigs\tPolymer"); mothurOutEndLine();
-               mothurOut("Minimum:\t" + toString(startPosition[0]) + "\t" + toString(endPosition[0]) + "\t" + toString(seqLength[0]) + "\t" + toString(ambigBases[0]) + "\t" + toString(longHomoPolymer[0])); mothurOutEndLine();
-               mothurOut("2.5%-tile:\t" + toString(startPosition[ptile0_25]) + "\t" + toString(endPosition[ptile0_25]) + "\t" + toString(seqLength[ptile0_25]) + "\t" + toString(ambigBases[ptile0_25]) + "\t"+ toString(longHomoPolymer[ptile0_25])); mothurOutEndLine();
-               mothurOut("25%-tile:\t" + toString(startPosition[ptile25]) + "\t" + toString(endPosition[ptile25]) + "\t" + toString(seqLength[ptile25]) + "\t" + toString(ambigBases[ptile25]) + "\t" + toString(longHomoPolymer[ptile25])); mothurOutEndLine();
-               mothurOut("Median: \t" + toString(startPosition[ptile50]) + "\t" + toString(endPosition[ptile50]) + "\t" + toString(seqLength[ptile50]) + "\t" + toString(ambigBases[ptile50]) + "\t" + toString(longHomoPolymer[ptile50])); mothurOutEndLine();
-               mothurOut("75%-tile:\t" + toString(startPosition[ptile75]) + "\t" + toString(endPosition[ptile75]) + "\t" + toString(seqLength[ptile75]) + "\t" + toString(ambigBases[ptile75]) + "\t" + toString(longHomoPolymer[ptile75])); mothurOutEndLine();
-               mothurOut("97.5%-tile:\t" + toString(startPosition[ptile97_5]) + "\t" + toString(endPosition[ptile97_5]) + "\t" + toString(seqLength[ptile97_5]) + "\t" + toString(ambigBases[ptile97_5]) + "\t" + toString(longHomoPolymer[ptile97_5])); mothurOutEndLine();
-               mothurOut("Maximum:\t" + toString(startPosition[ptile100]) + "\t" + toString(endPosition[ptile100]) + "\t" + toString(seqLength[ptile100]) + "\t" + toString(ambigBases[ptile100]) + "\t" + toString(longHomoPolymer[ptile100])); mothurOutEndLine();
-               mothurOut("# of Seqs:\t" + toString(numSeqs)); mothurOutEndLine();
+               m->mothurOutEndLine();
+               m->mothurOut("\t\tStart\tEnd\tNBases\tAmbigs\tPolymer"); m->mothurOutEndLine();
+               m->mothurOut("Minimum:\t" + toString(startPosition[0]) + "\t" + toString(endPosition[0]) + "\t" + toString(seqLength[0]) + "\t" + toString(ambigBases[0]) + "\t" + toString(longHomoPolymer[0])); m->mothurOutEndLine();
+               m->mothurOut("2.5%-tile:\t" + toString(startPosition[ptile0_25]) + "\t" + toString(endPosition[ptile0_25]) + "\t" + toString(seqLength[ptile0_25]) + "\t" + toString(ambigBases[ptile0_25]) + "\t"+ toString(longHomoPolymer[ptile0_25])); m->mothurOutEndLine();
+               m->mothurOut("25%-tile:\t" + toString(startPosition[ptile25]) + "\t" + toString(endPosition[ptile25]) + "\t" + toString(seqLength[ptile25]) + "\t" + toString(ambigBases[ptile25]) + "\t" + toString(longHomoPolymer[ptile25])); m->mothurOutEndLine();
+               m->mothurOut("Median: \t" + toString(startPosition[ptile50]) + "\t" + toString(endPosition[ptile50]) + "\t" + toString(seqLength[ptile50]) + "\t" + toString(ambigBases[ptile50]) + "\t" + toString(longHomoPolymer[ptile50])); m->mothurOutEndLine();
+               m->mothurOut("75%-tile:\t" + toString(startPosition[ptile75]) + "\t" + toString(endPosition[ptile75]) + "\t" + toString(seqLength[ptile75]) + "\t" + toString(ambigBases[ptile75]) + "\t" + toString(longHomoPolymer[ptile75])); m->mothurOutEndLine();
+               m->mothurOut("97.5%-tile:\t" + toString(startPosition[ptile97_5]) + "\t" + toString(endPosition[ptile97_5]) + "\t" + toString(seqLength[ptile97_5]) + "\t" + toString(ambigBases[ptile97_5]) + "\t" + toString(longHomoPolymer[ptile97_5])); m->mothurOutEndLine();
+               m->mothurOut("Maximum:\t" + toString(startPosition[ptile100]) + "\t" + toString(endPosition[ptile100]) + "\t" + toString(seqLength[ptile100]) + "\t" + toString(ambigBases[ptile100]) + "\t" + toString(longHomoPolymer[ptile100])); m->mothurOutEndLine();
+               m->mothurOut("# of Seqs:\t" + toString(numSeqs)); m->mothurOutEndLine();
                
                outSummary.close();
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+               m->mothurOut(summaryFile); m->mothurOutEndLine();       
+               m->mothurOutEndLine();
+
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SeqSummaryCommand", "execute");
+               m->errorOut(e, "SeqSummaryCommand", "execute");
                exit(1);
        }
 }
index 752e081e367fc6d572b5622e0b4eb6003a28f9bb..94caf65eafc40564fbbb04e9721cf385222c8e45 100644 (file)
@@ -12,6 +12,7 @@
 /***********************************************************************/
 
 Sequence::Sequence(){
+       m = MothurOut::getInstance();
        initialize();
 }
 
@@ -81,7 +82,7 @@ string Sequence::getSequenceString(ifstream& fastaFile) {
                return sequence;
        }
        catch(exception& e) {
-               errorOut(e, "Sequence", "getSequenceString");
+               m->errorOut(e, "Sequence", "getSequenceString");
                exit(1);
        }
 }
@@ -103,7 +104,7 @@ string Sequence::getCommentString(ifstream& fastaFile) {
                return sequence;
        }
        catch(exception& e) {
-               errorOut(e, "Sequence", "getCommentString");
+               m->errorOut(e, "Sequence", "getCommentString");
                exit(1);
        }
 }
index f6d7c869853a17808d8d894466f3d473b18c13d8..f48bf13dc98d034cea520cf78b09124fff30cb33 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include "mothur.h"
-
+#include "mothurout.h"
 
 /**************************************************************************************************/
 
@@ -47,6 +47,7 @@ public:
        void printSequence(ostream&);
        
 private:
+       MothurOut* m;
        void initialize();
        string getSequenceString(ifstream&);
        string getCommentString(ifstream&);
index b3da429fc57c9da7081640876ee9fbedda808e25..9ddb40f44a7e9ded9ba12a625e647c5abd3bed43 100644 (file)
@@ -15,7 +15,7 @@
 
 /***********************************************************************/
 
-SequenceDB::SequenceDB() {}
+SequenceDB::SequenceDB() {  m = MothurOut::getInstance();  }
 /***********************************************************************/
 //the clear function free's the memory
 SequenceDB::~SequenceDB() { clear(); }
@@ -46,7 +46,7 @@ SequenceDB::SequenceDB(ifstream& filehandle) {
                
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "SequenceDB");
+               m->errorOut(e, "SequenceDB", "SequenceDB");
                exit(1);
        }
 }
@@ -67,7 +67,7 @@ string SequenceDB::readName(ifstream& in) {
                return name;
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "readName");
+               m->errorOut(e, "SequenceDB", "readName");
                exit(1);
        }
 }
@@ -96,7 +96,7 @@ string SequenceDB::readSequence(ifstream& in) {
                return sequence;
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "readSequence");
+               m->errorOut(e, "SequenceDB", "readSequence");
                exit(1);
        }
 }
@@ -114,7 +114,7 @@ void SequenceDB::set(int index, string newUnaligned) {
                data[index] = Sequence(data[index].getName(), newUnaligned);
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "set");
+               m->errorOut(e, "SequenceDB", "set");
                exit(1);
        }
 }
@@ -126,7 +126,7 @@ void SequenceDB::set(int index, Sequence newSeq) {
                data[index] = newSeq;
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "set");
+               m->errorOut(e, "SequenceDB", "set");
                exit(1);
        }
 }
@@ -144,7 +144,7 @@ void SequenceDB::resize(int newSize) {
                data.resize(newSize);
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "resize");
+               m->errorOut(e, "SequenceDB", "resize");
                exit(1);
        }
 }
@@ -156,7 +156,7 @@ void SequenceDB::clear() {
                data.clear();
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "clear");
+               m->errorOut(e, "SequenceDB", "clear");
                exit(1);
        }
 }
@@ -176,7 +176,7 @@ void SequenceDB::print(ostream& out) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "print");
+               m->errorOut(e, "SequenceDB", "print");
                exit(1);
        }
 }
@@ -188,7 +188,7 @@ void SequenceDB::push_back(Sequence newSequence) {
                data.push_back(newSequence);
        }
        catch(exception& e) {
-               errorOut(e, "SequenceDB", "push_back");
+               m->errorOut(e, "SequenceDB", "push_back");
                exit(1);
        }
 }
index 8c7e649b893339daac20eb8cd1fb9dd0f1833544..367254949fa6a2a43a59589db159810a82499dc7 100644 (file)
@@ -42,6 +42,7 @@ private:
        vector<Sequence> data;
        string readName(ifstream&);
        string readSequence(ifstream&);
+       MothurOut* m;
 
 };
 
index 5a2c0022bf68ef4756d71ad6278b171bbce0f602..407e57bfcaca82628aa60923e9bcb687a6a25416 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-SetDirectoryCommand::SetDirectoryCommand(string option){
+SetDirectoryCommand::SetDirectoryCommand(string option)  {
        try {
                abort = false;
                
@@ -39,12 +39,12 @@ SetDirectoryCommand::SetDirectoryCommand(string option){
                        if (input == "not found") {  input = "";  }
                                
                        if ((input == "") && (output == "")) {  
-                               mothurOut("You must provide either an input or output for the set.outdir command."); mothurOutEndLine(); abort = true;
+                               m->mothurOut("You must provide either an input or output for the set.outdir command."); m->mothurOutEndLine(); abort = true;
                        }
                }
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
+               m->errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
                exit(1);
        }
 }
@@ -52,17 +52,17 @@ SetDirectoryCommand::SetDirectoryCommand(string option){
 
 void SetDirectoryCommand::help(){
        try {
-               mothurOut("The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n");
-               mothurOut("The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n");
-               mothurOut("The set.dir command parameter is output and is required.\n");
-               mothurOut("To return the output to the same directory as the input files you may enter: output=clear.\n");
-               mothurOut("To return the input to the same directory as the mothur.exe you may enter: input=clear.\n");
-               mothurOut("The set.dir command should be in the following format: set.dir(output=yourOutputDirectory, input=yourInputDirectory).\n");
-               mothurOut("Example set.outdir(output=/Users/lab/desktop/outputs, input=/Users/lab/desktop/inputs).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n\n");
+               m->mothurOut("The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n");
+               m->mothurOut("The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n");
+               m->mothurOut("The set.dir command parameter is output and is required.\n");
+               m->mothurOut("To return the output to the same directory as the input files you may enter: output=clear.\n");
+               m->mothurOut("To return the input to the same directory as the mothur.exe you may enter: input=clear.\n");
+               m->mothurOut("The set.dir command should be in the following format: set.dir(output=yourOutputDirectory, input=yourInputDirectory).\n");
+               m->mothurOut("Example set.outdir(output=/Users/lab/desktop/outputs, input=/Users/lab/desktop/inputs).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "help");
+               m->errorOut(e, "SetDirectoryCommand", "help");
                exit(1);
        }
 }
@@ -97,11 +97,11 @@ int SetDirectoryCommand::execute(){
                        ofstream out;
                        out.open(outTemp.c_str(), ios::trunc);
                        if(!out) {
-                               mothurOut(output + " directory does not exist or is not writable."); mothurOutEndLine(); 
+                               m->mothurOut(output + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                out.close();
                                remove(outTemp.c_str());
-                               mothurOut("Changing output directory to " + output); mothurOutEndLine();  
+                               m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
                                commandFactory->setOutputDirectory(output);
                        }
                }
@@ -123,11 +123,11 @@ int SetDirectoryCommand::execute(){
                        ofstream in;
                        in.open(inTemp.c_str(), ios::trunc);
                        if(!in) {
-                               mothurOut(input + " directory does not exist or is not writable."); mothurOutEndLine(); 
+                               m->mothurOut(input + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                in.close();
                                remove(inTemp.c_str());
-                               mothurOut("Changing input directory to " + input); mothurOutEndLine();  
+                               m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
                                commandFactory->setInputDirectory(input); 
                        }
                }
@@ -135,7 +135,7 @@ int SetDirectoryCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
+               m->errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
                exit(1);
        }
 }
index 1807375066daa52db405b7253d82ff30a5951a4b..b38d7fc272e6e338af026b02db8a80219c06d62d 100644 (file)
@@ -52,7 +52,7 @@ EstOutput Shannon::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Shannon", "getValues");
+               m->errorOut(e, "Shannon", "getValues");
                exit(1);
        }
 }
index 61a7c74e8b36496ee213d7eb26ee3ef277f1b686..24fe5ef00e369a7a221a9bcabc4e416492a29e14 100644 (file)
@@ -100,7 +100,7 @@ EstOutput SharedAce::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SharedAce", "getValues");
+               m->errorOut(e, "SharedAce", "getValues");
                exit(1);
        }
 }
index d55a016257436ddc22ca1a885f14a81fb4006689..38eec63c2e225dcf53efa4eb6fb6b11d720e98e1 100644 (file)
@@ -40,7 +40,7 @@ EstOutput Anderberg::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Anderberg", "getValues");
+               m->errorOut(e, "Anderberg", "getValues");
                exit(1);
        }
 }
index 299939dbfd156d1e5d9724fb112a4c5e3292c5a1..e8512d4b95bf3d2d32e058ca5c0b250d25609979 100644 (file)
@@ -44,7 +44,7 @@ EstOutput BrayCurtis::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "BrayCurtis", "getValues");
+               m->errorOut(e, "BrayCurtis", "getValues");
                exit(1);
        }
 }
index c19f0322c1358ba6718485a24933578c02bd5a3f..d8cf60bf0cfe67097bcdadc8025ffc5829af6354 100644 (file)
@@ -90,7 +90,7 @@ EstOutput SharedChao1::getValues(vector<SharedRAbundVector*> shared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "getValues");
+               m->errorOut(e, "SharedChao1", "getValues");
                exit(1);
        }
 }
@@ -138,8 +138,8 @@ void SharedChao1::initialTree(int n) {
                setCoef(f2root, 0);
        }
        catch(exception& e) {
-               if ((toString(e.what()) == "vector::_M_fill_insert") || (toString(e.what()) == "St9bad_alloc")) { mothurOut("You are using " + toString(n) + " groups which creates 2^" + toString(n+1) + " nodes. Try reducing the number of groups you selected. "); mothurOutEndLine(); exit(1); }
-               errorOut(e, "SharedChao1", "initialTree");
+               if ((toString(e.what()) == "vector::_M_fill_insert") || (toString(e.what()) == "St9bad_alloc")) { m->mothurOut("You are using " + toString(n) + " groups which creates 2^" + toString(n+1) + " nodes. Try reducing the number of groups you selected. "); m->mothurOutEndLine(); exit(1); }
+               m->errorOut(e, "SharedChao1", "initialTree");
                exit(1);
        }
 }
@@ -152,7 +152,7 @@ void SharedChao1::updateTree(vector<int> bin) {
                updateBranchf2(f2root, bin, 0); 
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "updateTree");
+               m->errorOut(e, "SharedChao1", "updateTree");
                exit(1);
        }
 }
@@ -174,7 +174,7 @@ void SharedChao1::updateBranchf1(IntNode* node, vector<int> bin, int index) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "updateBranchf1");           
+               m->errorOut(e, "SharedChao1", "updateBranchf1");                
                exit(1);
        }
 }
@@ -196,7 +196,7 @@ void SharedChao1::updateBranchf2(IntNode* node, vector<int> bin, int index) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "updateBranchf2");   
+               m->errorOut(e, "SharedChao1", "updateBranchf2");        
                exit(1);
        }
 }
@@ -213,7 +213,7 @@ void SharedChao1::setCoef(IntNode* node, int coef) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "setCoef");  
+               m->errorOut(e, "SharedChao1", "setCoef");       
                exit(1);
        }
 }
@@ -222,10 +222,10 @@ void SharedChao1::setCoef(IntNode* node, int coef) {
 //for debugging purposes
 void SharedChao1::printTree() {
        
-       mothurOut("F1 leaves"); mothurOutEndLine();
+       m->mothurOut("F1 leaves"); m->mothurOutEndLine();
        printBranch(f1root);
        
-       mothurOut("F2 leaves"); mothurOutEndLine();
+       m->mothurOut("F2 leaves"); m->mothurOutEndLine();
        printBranch(f2root);
 
 
@@ -239,13 +239,13 @@ void SharedChao1::printBranch(IntNode* node) {
                        printBranch(node->left);
                        printBranch(node->right);
                }else { //you are a leaf
-                       mothurOut(toString(node->lvalue)); mothurOutEndLine();
-                       mothurOut(toString(node->rvalue)); mothurOutEndLine();
+                       m->mothurOut(toString(node->lvalue)); m->mothurOutEndLine();
+                       m->mothurOut(toString(node->rvalue)); m->mothurOutEndLine();
                }
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedChao1", "printBranch");      
+               m->errorOut(e, "SharedChao1", "printBranch");   
                exit(1);
        }
 }
index 4cc0ea73b6a4a561ce0a511ca5cbb5da4b9d581c..f03152bcfa84047813da249e0fedb3673139861c 100644 (file)
@@ -53,7 +53,7 @@ SharedCommand::SharedCommand(string o) : outputDir(o) {
 
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "SharedCommand");
+               m->errorOut(e, "SharedCommand", "SharedCommand");
                exit(1);
        }
 }
@@ -77,7 +77,7 @@ int SharedCommand::execute(){
                vector<SharedRAbundVector*> lookup; 
                
                if ((globaldata->Groups.size() == 0) && (SharedList->getNumSeqs() != groupMap->getNumSeqs())) {  //if the user has not specified any groups and their files don't match exit with error
-                       mothurOut("Your group file contains " + toString(groupMap->getNumSeqs()) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct."); mothurOutEndLine(); 
+                       m->mothurOut("Your group file contains " + toString(groupMap->getNumSeqs()) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct."); m->mothurOutEndLine(); 
                        
                        out.close();
                        remove(filename.c_str()); //remove blank shared file you made
@@ -128,7 +128,7 @@ int SharedCommand::execute(){
                                        if (pickedGroups) { //check for otus with no seqs in them
                                                eliminateZeroOTUS(lookup);
                                        }
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        
                                        printSharedData(lookup); //prints info to the .shared file
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
@@ -147,7 +147,7 @@ int SharedCommand::execute(){
                                        if (pickedGroups) { //check for otus with no seqs in them
                                                eliminateZeroOTUS(lookup);
                                        }
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        
                                        printSharedData(lookup); //prints info to the .shared file
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
@@ -184,7 +184,7 @@ int SharedCommand::execute(){
                        if (pickedGroups) { //check for otus with no seqs in them
                                eliminateZeroOTUS(lookup);
                        }
-                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                        
                        printSharedData(lookup); //prints info to the .shared file
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
@@ -210,7 +210,7 @@ int SharedCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "execute");
+               m->errorOut(e, "SharedCommand", "execute");
                exit(1);
        }
 }
@@ -232,7 +232,7 @@ void SharedCommand::printSharedData(vector<SharedRAbundVector*> thislookup) {
  
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "printSharedData");
+               m->errorOut(e, "SharedCommand", "printSharedData");
                exit(1);
        }
 }
@@ -272,7 +272,7 @@ void SharedCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislookup) {
  
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "eliminateZeroOTUS");
+               m->errorOut(e, "SharedCommand", "eliminateZeroOTUS");
                exit(1);
        }
 }
@@ -285,7 +285,7 @@ void SharedCommand::createMisMatchFile() {
                //you have sequences in your list file that are not in your group file
                if (SharedList->getNumSeqs() > groupMap->getNumSeqs()) { 
                        outputMisMatchName += "missing.group";
-                       mothurOut("For a list of names that are in your list file and not in your group file, please refer to " + outputMisMatchName + "."); mothurOutEndLine();
+                       m->mothurOut("For a list of names that are in your list file and not in your group file, please refer to " + outputMisMatchName + "."); m->mothurOutEndLine();
                        
                        openOutputFile(outputMisMatchName, outMisMatch);
                        
@@ -305,7 +305,7 @@ void SharedCommand::createMisMatchFile() {
                                        if(group == "not found") {      outMisMatch << name << endl;  }
                                        
                                        itList = listNames.find(name);
-                                       if (itList != listNames.end()) {  mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                                       if (itList != listNames.end()) {  m->mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); m->mothurOutEndLine(); }
                                        else { listNames[name] = name; }
                                }
                        
@@ -314,7 +314,7 @@ void SharedCommand::createMisMatchFile() {
                                if(group == "not found") {      outMisMatch << names << endl;  }        
                                
                                itList = listNames.find(names);
-                               if (itList != listNames.end()) {  mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                               if (itList != listNames.end()) {  m->mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); m->mothurOutEndLine(); }
                                else { listNames[names] = names; }
 
                        }
@@ -325,7 +325,7 @@ void SharedCommand::createMisMatchFile() {
                }else {//you have sequences in your group file that are not in you list file
                        
                        outputMisMatchName += "missing.name";
-                       mothurOut("For a list of names that are in your group file and not in your list file, please refer to " + outputMisMatchName + "."); mothurOutEndLine();
+                       m->mothurOut("For a list of names that are in your group file and not in your list file, please refer to " + outputMisMatchName + "."); m->mothurOutEndLine();
                        
                        map<string, string> namesInList;
                        map<string, string>::iterator itList;
@@ -340,14 +340,14 @@ void SharedCommand::createMisMatchFile() {
                                        names = names.substr(names.find_first_of(',')+1, names.length());
                                        
                                        itList = namesInList.find(name);
-                                       if (itList != namesInList.end()) {  mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                                       if (itList != namesInList.end()) {  m->mothurOut(name + " is in your list file more than once.  Sequence names must be unique. please correct."); m->mothurOutEndLine(); }
 
                                        namesInList[name] = name;
                                        
                                }
                                
                                itList = namesInList.find(names);
-                               if (itList != namesInList.end()) {  mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); mothurOutEndLine(); }
+                               if (itList != namesInList.end()) {  m->mothurOut(names + " is in your list file more than once.  Sequence names must be unique. please correct."); m->mothurOutEndLine(); }
 
                                //get last name
                                namesInList[names] = names;                             
@@ -375,7 +375,7 @@ void SharedCommand::createMisMatchFile() {
  
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "createMisMatchFile");
+               m->errorOut(e, "SharedCommand", "createMisMatchFile");
                exit(1);
        }
 }
@@ -399,7 +399,7 @@ bool SharedCommand::isValidGroup(string groupname, vector<string> groups) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "SharedCommand", "isValidGroup");
+               m->errorOut(e, "SharedCommand", "isValidGroup");
                exit(1);
        }
 }
index d07076aaaad4247d73970f26d470ca0d01990adb..79c9f5223c3be4d4cdce4a1516db914169793fbc 100644 (file)
@@ -27,7 +27,7 @@ EstOutput JAbund::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "JAbund", "getValues");
+               m->errorOut(e, "JAbund", "getValues");
                exit(1);
        }
 }
index 012d2067ab94e7026a9673e77287c1629beafc8d..26ad1269cc55df28a47007364e8627b61dc7a7b8 100644 (file)
@@ -136,7 +136,7 @@ EstOutput SharedJackknife::getValues(vector<SharedRAbundVector*> vectorShared){
        }
                
        catch(exception& e) {
-               errorOut(e, "SharedJackknife", "getValues");
+               m->errorOut(e, "SharedJackknife", "getValues");
                exit(1);
        }
 }
index 051f05ef9e8ecee0416694285cf8d598d01db9f4..d44f22f17645b4e373404d33a60509574a0ef392 100644 (file)
@@ -41,7 +41,7 @@ EstOutput Jclass::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Jclass", "getValues");
+               m->errorOut(e, "Jclass", "getValues");
                exit(1);
        }
 }
index 0396f476d75acdfbfe44957dbaecbfa4e2f85594..9c53448e0edb44478bd47c6cebd6fea68ea2d0b9 100644 (file)
@@ -52,7 +52,7 @@ EstOutput Jest::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Jest", "getValues");
+               m->errorOut(e, "Jest", "getValues");
                exit(1);
        }
 }
index 567b3458b5486b8e1f3fa601eb44631a946c24e9..d91478801678c53ddb87dce7b1474272a2b30275 100644 (file)
@@ -56,7 +56,7 @@ EstOutput KSTest::getValues(vector<SharedRAbundVector*> shared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "KSTest", "getValues");
+               m->errorOut(e, "KSTest", "getValues");
                exit(1);
        }
 }
index cd09063fdf6143d683217dbdfc3ea67e3c409438..2b4f723526da5825ffc2cb9d2cda25cb4721932d 100644 (file)
@@ -40,7 +40,7 @@ EstOutput Kulczynski::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Kulczynski", "getValues");
+               m->errorOut(e, "Kulczynski", "getValues");
                exit(1);
        }
 }
index dbb3c45d5a24ce9a594440e955e434147d72ffce..a2385d45a0ce988eadd07ded301dbd93857c5d55 100644 (file)
@@ -40,7 +40,7 @@ EstOutput KulczynskiCody::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "KulczynskiCody", "getValues");
+               m->errorOut(e, "KulczynskiCody", "getValues");
                exit(1);
        }
 }
index 514f2b90e502e468132d0a72e27273f05396a219..a68da6b05731ee214415e83d76fcb994bcd69dae 100644 (file)
@@ -46,7 +46,7 @@ EstOutput Lennon::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Lennon", "getValues");
+               m->errorOut(e, "Lennon", "getValues");
                exit(1);
        }
 }
index 4303cfde13d3c4250c8f952c7a6eeb4bd9a2553d..cc3cd8df4205e2f37182a8a80037bc02bb37ca45 100644 (file)
@@ -44,7 +44,7 @@ SharedListVector::SharedListVector(ifstream& f) : DataVector(), maxRank(0), numB
        
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "SharedListVector");
+               m->errorOut(e, "SharedListVector", "SharedListVector");
                exit(1);
        }
 }
@@ -63,7 +63,7 @@ void SharedListVector::set(int binNumber, string seqNames){
                numSeqs += (nNames_new - nNames_old);
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "set");
+               m->errorOut(e, "SharedListVector", "set");
                exit(1);
        }
 }
@@ -88,7 +88,7 @@ void SharedListVector::push_back(string seqNames){
                numSeqs += nNames;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "push_back");
+               m->errorOut(e, "SharedListVector", "push_back");
                exit(1);
        }
 }
@@ -128,7 +128,7 @@ void SharedListVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "print");
+               m->errorOut(e, "SharedListVector", "print");
                exit(1);
        }
 }
@@ -159,7 +159,7 @@ RAbundVector SharedListVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getRAbundVector");
+               m->errorOut(e, "SharedListVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -180,7 +180,7 @@ SAbundVector SharedListVector::getSAbundVector(){
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getSAbundVector");
+               m->errorOut(e, "SharedListVector", "getSAbundVector");
                exit(1);
        }
 }
@@ -201,13 +201,13 @@ SharedOrderVector* SharedListVector::getSharedOrderVector(){
                                names = names.substr(names.find_first_of(',')+1, names.length());
                                groupName = groupmap->getGroup(name);
                                
-                               if(groupName == "not found") {  mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                               if(groupName == "not found") {  m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                                
                                order->push_back(i, binSize, groupName);  //i represents what bin you are in
                        }
                        //get last name
                        groupName = groupmap->getGroup(names);
-                       if(groupName == "not found") {  mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                       if(groupName == "not found") {  m->mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                        order->push_back(i, binSize, groupName);
                }
 
@@ -217,7 +217,7 @@ SharedOrderVector* SharedListVector::getSharedOrderVector(){
                return order;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getSharedOrderVector");
+               m->errorOut(e, "SharedListVector", "getSharedOrderVector");
                exit(1);
        }
 }
@@ -233,7 +233,7 @@ SharedRAbundVector SharedListVector::getSharedRAbundVector(string groupName) {
                                name = names.substr(0,names.find_first_of(','));
                                names = names.substr(names.find_first_of(',')+1, names.length());
                                group = groupmap->getGroup(name);
-                               if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                               if(group == "not found") {      m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                                if (group == groupName) { //this name is in the group you want the vector for.
                                        rav.set(i, rav.getAbundance(i) + 1, group);  //i represents what bin you are in
                                }
@@ -241,7 +241,7 @@ SharedRAbundVector SharedListVector::getSharedRAbundVector(string groupName) {
                        
                        //get last name
                        groupName = groupmap->getGroup(names);
-                       if(groupName == "not found") {  mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                       if(groupName == "not found") {  m->mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                        if (group == groupName) { //this name is in the group you want the vector for.
                                        rav.set(i, rav.getAbundance(i) + 1, group);  //i represents what bin you are in
                        }
@@ -254,7 +254,7 @@ SharedRAbundVector SharedListVector::getSharedRAbundVector(string groupName) {
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getSharedRAbundVector");
+               m->errorOut(e, "SharedListVector", "getSharedRAbundVector");
                exit(1);
        }
 }
@@ -287,13 +287,13 @@ vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
                                name = names.substr(0,names.find_first_of(','));
                                names = names.substr(names.find_first_of(',')+1, names.length());
                                group = groupmap->getGroup(name);
-                               if(group == "not found") {      mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                               if(group == "not found") {      m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                                finder[group]->set(i, finder[group]->getAbundance(i) + 1, group);  //i represents what bin you are in
                        }
                        
                        //get last name
                        group = groupmap->getGroup(names);
-                       if(group == "not found") {      mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine();  exit(1); }
+                       if(group == "not found") {      m->mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); m->mothurOutEndLine();  exit(1); }
                        finder[group]->set(i, finder[group]->getAbundance(i) + 1, group);  //i represents what bin you are in
                        
                }
@@ -301,7 +301,7 @@ vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
                return lookup;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getSharedRAbundVector");
+               m->errorOut(e, "SharedListVector", "getSharedRAbundVector");
                exit(1);
        }
 }
@@ -318,7 +318,7 @@ SharedSAbundVector SharedListVector::getSharedSAbundVector(string groupName) {
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getSharedSAbundVector");
+               m->errorOut(e, "SharedListVector", "getSharedSAbundVector");
                exit(1);
        }
 }
@@ -359,7 +359,7 @@ OrderVector SharedListVector::getOrderVector(map<string,int>* orderMap = NULL){
                                        }
                                        else{
                                                if(orderMap->count(seqName) == 0){
-                                                       mothurOut(seqName + " not found, check *.names file\n");
+                                                       m->mothurOut(seqName + " not found, check *.names file\n");
                                                        exit(1);
                                                }
                                        
@@ -369,7 +369,7 @@ OrderVector SharedListVector::getOrderVector(map<string,int>* orderMap = NULL){
                                }
                        
                                if(orderMap->count(seqName) == 0){
-                                       mothurOut(seqName + " not found, check *.names file\n");
+                                       m->mothurOut(seqName + " not found, check *.names file\n");
                                        exit(1);
                                }
                                ov.set((*orderMap)[seqName], i);        
@@ -382,7 +382,7 @@ OrderVector SharedListVector::getOrderVector(map<string,int>* orderMap = NULL){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedListVector", "getOrderVector");
+               m->errorOut(e, "SharedListVector", "getOrderVector");
                exit(1);
        }
 }
index e4b80bec5eb22b0e513e556a5445bc0a755306b9..57de5f5bdc880e9d28b38ecaa9c5cd21ba7d1089 100644 (file)
@@ -38,7 +38,7 @@ EstOutput SharedMarczewski::getValues(vector<SharedRAbundVector*> vectorShared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SharedMarczewski", "getValues");
+               m->errorOut(e, "SharedMarczewski", "getValues");
                exit(1);
        }
 }
index d5cdeeccd05dbe8570ad09c5617c3ef106a7be78..3439747a712822fc316988c3d1aeb637a43cf00e 100644 (file)
@@ -48,7 +48,7 @@ EstOutput MorHorn::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "MorHorn", "getValues");
+               m->errorOut(e, "MorHorn", "getValues");
                exit(1);
        }
 }
index 1d0828ebf5f9b3f46b63bae40504bd041de2735a..a1991c9d0b8391f764f49078a50ab1b12c8f4a3e 100644 (file)
@@ -40,7 +40,7 @@ EstOutput Ochiai::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Ochiai", "getValues");
+               m->errorOut(e, "Ochiai", "getValues");
                exit(1);
        }
 }
index e1ede6d0e8048ee46cdc38b33ef47b76ffa03624..2df67b8d19b1861714aba2746e3326256cdfe2ae 100644 (file)
@@ -96,7 +96,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {  //reads in a
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "SharedOrderVector");
+               m->errorOut(e, "SharedOrderVector", "SharedOrderVector");
                exit(1);
        }
 }
@@ -166,7 +166,7 @@ void SharedOrderVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "print");
+               m->errorOut(e, "SharedOrderVector", "print");
                exit(1);
        }
 }
@@ -175,7 +175,7 @@ void SharedOrderVector::print(ostream& output){
 /***********************************************************************/
 
 void SharedOrderVector::resize(int){
-       mothurOut("resize() did nothing in class SharedOrderVector");
+       m->mothurOut("resize() did nothing in class SharedOrderVector");
 }
 
 /***********************************************************************/
@@ -218,7 +218,7 @@ RAbundVector SharedOrderVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "getRAbundVector");
+               m->errorOut(e, "SharedOrderVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -238,7 +238,7 @@ OrderVector SharedOrderVector::getOrderVector(map<string,int>* nameMap = NULL) {
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "getOrderVector");
+               m->errorOut(e, "SharedOrderVector", "getOrderVector");
                exit(1);
        }
 }
@@ -268,7 +268,7 @@ SharedRAbundVector SharedOrderVector::getSharedRAbundVector(string group) {
                return sharedRav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
+               m->errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
                exit(1);
        }
 }
@@ -285,7 +285,7 @@ vector<SharedRAbundVector*> SharedOrderVector::getSharedRAbundVector() {
                return lookup;
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
+               m->errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
                exit(1);
        }
 }
@@ -298,7 +298,7 @@ SharedSAbundVector SharedOrderVector::getSharedSAbundVector(string group) {
                                
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "getSharedSAbundVector");
+               m->errorOut(e, "SharedOrderVector", "getSharedSAbundVector");
                exit(1);
        }
 }
@@ -333,7 +333,7 @@ void SharedOrderVector::updateStats(){
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedOrderVector", "updateStats");
+               m->errorOut(e, "SharedOrderVector", "updateStats");
                exit(1);
        }
 }
index 25f9dd3bea207be00b1b35e264d604dd1e9b3a54..114de90e7b9ee2490f3f47379487a02ba62d5bb1 100644 (file)
@@ -51,7 +51,7 @@ SharedRAbundVector::SharedRAbundVector(string id, vector<individual> rav) : Data
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "SharedRAbundVector");
+               m->errorOut(e, "SharedRAbundVector", "SharedRAbundVector");
                exit(1);
        }
 }
@@ -140,7 +140,7 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "SharedRAbundVector");
+               m->errorOut(e, "SharedRAbundVector", "SharedRAbundVector");
                exit(1);
        }
 }
@@ -158,7 +158,7 @@ void SharedRAbundVector::set(int binNumber, int newBinSize, string groupname){
                numSeqs += (newBinSize - oldBinSize);
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "set");
+               m->errorOut(e, "SharedRAbundVector", "set");
                exit(1);
        }
 }
@@ -219,7 +219,7 @@ void SharedRAbundVector::push_back(int binSize, string groupName){
                numSeqs += binSize;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "push_back");
+               m->errorOut(e, "SharedRAbundVector", "push_back");
                exit(1);
        }
 }
@@ -243,7 +243,7 @@ void SharedRAbundVector::insert(int binSize, int otu, string groupName){
                numSeqs += binSize;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "insert");
+               m->errorOut(e, "SharedRAbundVector", "insert");
                exit(1);
        }
 }
@@ -267,7 +267,7 @@ void SharedRAbundVector::push_front(int binSize, int otu, string groupName){
                numSeqs += binSize;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "push_front");
+               m->errorOut(e, "SharedRAbundVector", "push_front");
                exit(1);
        }
 }
@@ -313,7 +313,7 @@ void SharedRAbundVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "print");
+               m->errorOut(e, "SharedRAbundVector", "print");
                exit(1);
        }
 }
@@ -374,7 +374,7 @@ vector<SharedRAbundVector*> SharedRAbundVector::getSharedRAbundVectors(){
                return lookup;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getSharedRAbundVectors");
+               m->errorOut(e, "SharedRAbundVector", "getSharedRAbundVectors");
                exit(1);
        }
 }
@@ -394,7 +394,7 @@ RAbundVector SharedRAbundVector::getRAbundVector() {
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getRAbundVector");
+               m->errorOut(e, "SharedRAbundVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -409,7 +409,7 @@ RAbundVector SharedRAbundVector::getRAbundVector2() {
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getRAbundVector2");
+               m->errorOut(e, "SharedRAbundVector", "getRAbundVector2");
                exit(1);
        }
 }
@@ -431,7 +431,7 @@ SharedSAbundVector SharedRAbundVector::getSharedSAbundVector(){
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getSharedSAbundVector");
+               m->errorOut(e, "SharedRAbundVector", "getSharedSAbundVector");
                exit(1);
        }
 }
@@ -450,7 +450,7 @@ SAbundVector SharedRAbundVector::getSAbundVector() {
                return sav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getSAbundVector");           
+               m->errorOut(e, "SharedRAbundVector", "getSAbundVector");                
                exit(1);
        }
 }
@@ -474,7 +474,7 @@ SharedOrderVector SharedRAbundVector::getSharedOrderVector() {
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getSharedOrderVector");
+               m->errorOut(e, "SharedRAbundVector", "getSharedOrderVector");
                exit(1);
        }
 }
@@ -495,7 +495,7 @@ OrderVector SharedRAbundVector::getOrderVector(map<string,int>* nameMap = NULL)
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SharedRAbundVector", "getOrderVector");
+               m->errorOut(e, "SharedRAbundVector", "getOrderVector");
                exit(1);
        }
 }
index a7dfd6683a09c3daa8cd67d2e5b16cd5880e979c..4aea5890a341ccde6b110c2db37098f99c90aeee 100644 (file)
@@ -45,7 +45,7 @@ void SharedSAbundVector::set(int bin, int abundance, string groupName){
                if(bin > maxRank)       {       maxRank = bin;          }
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "set");
+               m->errorOut(e, "SharedSAbundVector", "set");
                exit(1);
        }
 }
@@ -79,7 +79,7 @@ void SharedSAbundVector::push_back(int abundance, int bin, string groupName){
                numSeqs += (maxRank * abundance);
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "push_back");
+               m->errorOut(e, "SharedSAbundVector", "push_back");
                exit(1);
        }
 }
@@ -107,7 +107,7 @@ void SharedSAbundVector::print(ostream& output){
                output << endl;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "print");
+               m->errorOut(e, "SharedSAbundVector", "print");
                exit(1);
        }
 }
@@ -154,7 +154,7 @@ RAbundVector SharedSAbundVector::getRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "getRAbundVector");
+               m->errorOut(e, "SharedSAbundVector", "getRAbundVector");
                exit(1);
        }
 }
@@ -170,7 +170,7 @@ SAbundVector SharedSAbundVector::getSAbundVector(){
        
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "getSAbundVector");
+               m->errorOut(e, "SharedSAbundVector", "getSAbundVector");
                exit(1);
        }
 }
@@ -204,7 +204,7 @@ SharedRAbundVector SharedSAbundVector::getSharedRAbundVector(){
                return rav;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "getSharedRAbundVector");
+               m->errorOut(e, "SharedSAbundVector", "getSharedRAbundVector");
                exit(1);
        }
 }
@@ -230,7 +230,7 @@ SharedOrderVector SharedSAbundVector::getSharedOrderVector() {
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "getSharedOrderVector");
+               m->errorOut(e, "SharedSAbundVector", "getSharedOrderVector");
                exit(1);
        }
 }
@@ -257,7 +257,7 @@ OrderVector SharedSAbundVector::getOrderVector(map<string,int>* hold = NULL){
                return ov;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSAbundVector", "getOrderVector");
+               m->errorOut(e, "SharedSAbundVector", "getOrderVector");
                exit(1);
        }
 }
index b65a8781db509ab48c77ea20f0341c47e2ad1d62..c8ecba71127de2319b34e5838dcc9eafe1f8b8df 100644 (file)
@@ -29,7 +29,7 @@ EstOutput SharedSobs::getValues(vector<SharedRAbundVector*> shared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSobs", "getValues");
+               m->errorOut(e, "SharedSobs", "getValues");
                exit(1);
        }
 }
index 0096303d03cd8282e8732046ddc36205a15a1633..c64c8259ca25d0a3c585113049ff4877d6630555 100644 (file)
@@ -34,7 +34,7 @@ EstOutput SharedSobsCS::getValues(vector<SharedRAbundVector*> shared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SharedSobsCS", "getValues");
+               m->errorOut(e, "SharedSobsCS", "getValues");
                exit(1);
        }
 }
index 7b472a7b263cfc3863720ccfcf97ba754eeaa043..90b825adbd8a7c0522f5be47db3a9009693bc735 100644 (file)
@@ -27,7 +27,7 @@ EstOutput SorAbund::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SorAbund", "getValues");
+               m->errorOut(e, "SorAbund", "getValues");
                exit(1);
        }
 }
index 3bb22198303465ed5038464e32e8f3e168f16cc9..8f6065096853b358ac75a9fad0355fdb15a47b49 100644 (file)
@@ -41,7 +41,7 @@ EstOutput SorClass::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SorClass", "getValues");
+               m->errorOut(e, "SorClass", "getValues");
                exit(1);
        }
 }
index 680c4adcf380369ef0ab0bcfe85438666adceffe..d3ae59e6c119c90989eb72fbb61b35c7085bcbe8 100644 (file)
@@ -51,7 +51,7 @@ EstOutput SorEst::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "SorEst", "getValues");
+               m->errorOut(e, "SorEst", "getValues");
                exit(1);
        }
 }
index 6396d1dd667ff348b9d9d281a762d986726538d3..d118be94baca17e01f9cc11ce2e437f2955c4063 100644 (file)
@@ -51,7 +51,7 @@ EstOutput ThetaN::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "ThetaN", "getValues");
+               m->errorOut(e, "ThetaN", "getValues");
                exit(1);
        }
 }
index abb30e5a4608b9db863619f52141259bf00ba8b1..45dce49ce0a1185c1558068bc27e15be87f03fcb 100644 (file)
@@ -48,7 +48,7 @@ EstOutput ThetaYC::getValues(vector<SharedRAbundVector*> shared) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "ThetaYC", "getValues");
+               m->errorOut(e, "ThetaYC", "getValues");
                exit(1);
        }
 }
index 7d85c4cbbf3e989b4e92ac400b22ab274b60c548..4339a254efbfd9af51796e5c1d473fffa9ffaefa 100644 (file)
@@ -49,7 +49,7 @@ void SharedUtil::getSharedVectors(vector<string> Groups, vector<SharedRAbundVect
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "getSharedVectors");
+               m->errorOut(e, "SharedUtil", "getSharedVectors");
                exit(1);
        }
 }
@@ -93,7 +93,7 @@ void SharedUtil::getSharedVectorswithReplacement(vector<string> Groups, vector<S
                
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "getSharedVectorswithReplacement");
+               m->errorOut(e, "SharedUtil", "getSharedVectorswithReplacement");
                exit(1);
        }
 }
@@ -107,7 +107,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                                //check that groups are valid
                                for (int i = 0; i < userGroups.size(); i++) {
                                        if (isValidGroup(userGroups[i], allGroups) != true) {
-                                               mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); mothurOutEndLine();
+                                               m->mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); m->mothurOutEndLine();
                                                // erase the invalid group from userGroups
                                                userGroups.erase(userGroups.begin()+i);
                                                i--;
@@ -116,7 +116,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                                
                                //if the user only entered invalid groups
                                if (userGroups.size() == 0) { 
-                                       mothurOut("You provided no valid groups. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                                       m->mothurOut("You provided no valid groups. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                                        for (int i = 0; i < allGroups.size(); i++) {
                                                userGroups.push_back(allGroups[i]);
                                        }
@@ -136,7 +136,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                        
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "setGroups");
+               m->errorOut(e, "SharedUtil", "setGroups");
                exit(1);
        }
 }
@@ -149,7 +149,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                                //check that groups are valid
                                for (int i = 0; i < userGroups.size(); i++) {
                                        if (isValidGroup(userGroups[i], allGroups) != true) {
-                                               mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); mothurOutEndLine();
+                                               m->mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); m->mothurOutEndLine();
                                                // erase the invalid group from userGroups
                                                userGroups.erase(userGroups.begin()+i);
                                                i--;
@@ -171,7 +171,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                if ((mode == "collect") || (mode == "rarefact") || (mode == "summary") || (mode == "treegroup")) {
                                //if the user only entered invalid groups
                                if ((userGroups.size() == 0) || (userGroups.size() == 1)) { 
-                                       mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                                       m->mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                                        for (int i = 0; i < allGroups.size(); i++) {
                                                userGroups.push_back(allGroups[i]);
                                        }
@@ -180,7 +180,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
        
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "setGroups");
+               m->errorOut(e, "SharedUtil", "setGroups");
                exit(1);
        }
 }
@@ -199,7 +199,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                                //check that groups are valid
                                for (int i = 0; i < userGroups.size(); i++) {
                                        if (isValidGroup(userGroups[i], allGroups) != true) {
-                                               mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); mothurOutEndLine();
+                                               m->mothurOut(userGroups[i] + " is not a valid group, and will be disregarded."); m->mothurOutEndLine();
                                                // erase the invalid group from globaldata->Groups
                                                userGroups.erase(userGroups.begin()+i);
                                                i--;
@@ -236,9 +236,9 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                                                userGroups.push_back(allGroups[i]);
                                        }
                                }
-                               mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                               m->mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                        }else if (userGroups.size() == 1) { 
-                               mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                               m->mothurOut("When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                                userGroups.clear();
                                for (int i=0; i < allGroups.size(); i++) { 
                                        if (allGroups[i] != "xxx") {
@@ -251,7 +251,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                }else if ((mode == "unweighted") || (mode == "parsimony")) {
                                //if the user only entered invalid groups
                                if ((userGroups.size() == 0) && (numGroups == 0)) { 
-                                       mothurOut("When using the groups parameter you must have at least 1 valid group. I will run the command using all the groups in your groupfile."); mothurOutEndLine();
+                                       m->mothurOut("When using the groups parameter you must have at least 1 valid group. I will run the command using all the groups in your groupfile."); m->mothurOutEndLine();
                                        for (int i = 0; i < allGroups.size(); i++) {
                                                if (allGroups[i] != "xxx") {
                                                        userGroups.push_back(allGroups[i]);
@@ -263,7 +263,7 @@ void SharedUtil::setGroups(vector<string>& userGroups, vector<string>& allGroups
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "setGroups");
+               m->errorOut(e, "SharedUtil", "setGroups");
                exit(1);
        }
 }
@@ -281,7 +281,7 @@ void SharedUtil::getCombos(vector<string>& groupComb, vector<string> userGroups,
                } 
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "getCombos");
+               m->errorOut(e, "SharedUtil", "getCombos");
                exit(1);
        }
 }
@@ -295,7 +295,7 @@ bool SharedUtil::isValidGroup(string groupname, vector<string> groups) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "isValidGroup");
+               m->errorOut(e, "SharedUtil", "isValidGroup");
                exit(1);
        }
 }
@@ -309,7 +309,7 @@ void SharedUtil::updateGroupIndex(vector<string>& userGroups, map<string, int>&
                }
        }
        catch(exception& e) {
-               errorOut(e, "SharedUtil", "updateGroupIndex");
+               m->errorOut(e, "SharedUtil", "updateGroupIndex");
                exit(1);
        }
 }
index f6b95e351341a3248642a68e49b2f519f697a3d6..df7e8d3091d811285f15cb49402053ec09a4f535 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 class SharedRAbundVector;
 class SharedOrderVector;
@@ -18,7 +19,7 @@ class SharedOrderVector;
 
 class SharedUtil {
        public:
-               SharedUtil() {};
+               SharedUtil() { m = MothurOut::getInstance(); }
                ~SharedUtil() {};
                
                void getSharedVectors(vector<string>, vector<SharedRAbundVector*>&, SharedOrderVector*);
@@ -31,7 +32,7 @@ class SharedUtil {
                bool isValidGroup(string, vector<string>);
                
        private:
-       
+               MothurOut* m;
                
 };
 
index 0d515eb19487905608c341ddb536e82436a93938..dac12bd69e83fb635c5b1ab1433a776940332e8e 100644 (file)
--- a/shen.cpp
+++ b/shen.cpp
@@ -26,14 +26,14 @@ EstOutput Shen::getValues(SAbundVector* rank){
                
                double f0 = ace[0]-rank->getNumBins();
                
-               data[0] = f0 * (1 - pow(1 - f1/n/f0, m));
+               data[0] = f0 * (1 - pow(1 - f1/n/f0, f));
                
                delete calc;
                
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Shen", "getValues");
+               m->errorOut(e, "Shen", "getValues");
                exit(1);
        }
 }
diff --git a/shen.h b/shen.h
index fa8b70030e1e9ae742f86cc4f77e00d3870dedac..1016e4c8056c1ba6c50e6251d5459e9c7288a78f 100644 (file)
--- a/shen.h
+++ b/shen.h
 class Shen : public Calculator  {
        
 public: 
-       Shen(int size, int n) : m(size), abund(n), Calculator("shen", 1, false) {};
+       Shen(int size, int n) : f(size), abund(n), Calculator("shen", 1, false) {};
        EstOutput getValues(SAbundVector*);     
        EstOutput getValues(vector<SharedRAbundVector*>) {return data;};
 private:
-       int m;
+       int f;
        int abund;
 };
 
index 8e176cf926f07e899d3a965500a991bfde45f3a1..fa5b4355cf2a53a1b8cde091887d9e6f77d77284 100644 (file)
@@ -58,7 +58,7 @@ EstOutput Simpson::getValues(SAbundVector* rank){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Simpson", "getValues");
+               m->errorOut(e, "Simpson", "getValues");
                exit(1);
        }
 }
index 17626156013e2994185e9cf6f284f69c2f63367c..fe5adca04ac1659cf88ac3c8df311aeead91709c 100644 (file)
@@ -80,7 +80,7 @@ void  SingleLinkage::update(){
                removeCell(rowCells[rowInd], -1 , -1);
        }
        catch(exception& e) {
-               errorOut(e, "SingleLinkage", "update");
+               m->errorOut(e, "SingleLinkage", "update");
                exit(1);
        }
 }
@@ -97,7 +97,7 @@ bool SingleLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
                return(changed);
        }
        catch(exception& e) {
-               errorOut(e, "SingleLinkage", "updateDistance");
+               m->errorOut(e, "SingleLinkage", "updateDistance");
                exit(1);
        }
 }
index 66db22b6a36ae9a0f7f9dd383201cd3852a120b2..2d079cd6ac10ae5ed4aeea0454ff3f0e984561e8 100644 (file)
@@ -11,7 +11,7 @@
 
 /***********************************************************************/
 Slayer::Slayer(int win, int increment, int parentThreshold, float div, int i, int snp) :
-               windowSize(win), windowStep(increment), parentFragmentThreshold(parentThreshold), divRThreshold(div), iters(i), percentSNPSample(snp){}
+               windowSize(win), windowStep(increment), parentFragmentThreshold(parentThreshold), divRThreshold(div), iters(i), percentSNPSample(snp){ m = MothurOut::getInstance(); }
 /***********************************************************************/
 string Slayer::getResults(Sequence* query, vector<Sequence*> refSeqs) {
        try {
@@ -98,7 +98,7 @@ string Slayer::getResults(Sequence* query, vector<Sequence*> refSeqs) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "getResults");
+               m->errorOut(e, "Slayer", "getResults");
                exit(1);
        }
 }
@@ -130,7 +130,7 @@ vector<data_struct> Slayer::runBellerophon(Sequence* q, Sequence* pA, Sequence*
        
                //check window size
                if (length < (2*windowSize+windowStep)) { 
-                       mothurOut("Your window size is too large for " + q->getName() + ". I will make the window size " + toString(length/4) + " which is 1/4 the filtered length."); mothurOutEndLine();      
+                       m->mothurOut("Your window size is too large for " + q->getName() + ". I will make the window size " + toString(length/4) + " which is 1/4 the filtered length."); m->mothurOutEndLine();        
                        windowSize = length / 4;
                }
                
@@ -208,7 +208,7 @@ vector<data_struct> Slayer::runBellerophon(Sequence* q, Sequence* pA, Sequence*
                
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "runBellerophon");
+               m->errorOut(e, "Slayer", "runBellerophon");
                exit(1);
        }
 }
@@ -257,7 +257,7 @@ vector<snps> Slayer::getSNPS(string parentA, string query, string parentB, int l
                
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "getSNPS");
+               m->errorOut(e, "Slayer", "getSNPS");
                exit(1);
        }
 }
@@ -342,7 +342,7 @@ void Slayer::bootstrapSNPS(vector<snps> left, vector<snps> right, float& BSA, fl
        
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "bootstrapSNPS");
+               m->errorOut(e, "Slayer", "bootstrapSNPS");
                exit(1);
        }
 }
@@ -363,7 +363,7 @@ float Slayer::snpQA(vector<snps> data) {
                return percentID;
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "snpQA");
+               m->errorOut(e, "Slayer", "snpQA");
                exit(1);
        }
 }
@@ -385,7 +385,7 @@ float Slayer::snpQB(vector<snps> data) {
 
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "snpQB");
+               m->errorOut(e, "Slayer", "snpQB");
                exit(1);
        }
 }
@@ -406,7 +406,7 @@ float Slayer::snpAB(vector<snps> data) {
 
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "snpAB");
+               m->errorOut(e, "Slayer", "snpAB");
                exit(1);
        }
 }
@@ -428,7 +428,7 @@ float Slayer::computePercentID(string queryFrag, string parent, int left, int ri
                return percentID;
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "computePercentID");
+               m->errorOut(e, "Slayer", "computePercentID");
                exit(1);
        }
 }
@@ -494,7 +494,7 @@ map<int, int> Slayer::verticalFilter(vector<Sequence*> seqs) {
                return maskMap;
        }
        catch(exception& e) {
-               errorOut(e, "Slayer", "verticalFilter");
+               m->errorOut(e, "Slayer", "verticalFilter");
                exit(1);
        }
 }
index 099cb208f1e69ee9f943ea81ee395aba9bbc4efc..d746b47b0cb1170f26e16c4d7589656ab0204808 100644 (file)
--- a/slayer.h
+++ b/slayer.h
@@ -87,6 +87,7 @@ class Slayer {
                float snpQA(vector<snps>);
                float snpQB(vector<snps>);
                float snpAB(vector<snps>);
+               MothurOut* m;
                                
 };
 
index 1f2d3dfea52fade8645c2afd2eebf239e8fa7231..e1ffb0ec0de20ea11345db0b5040ed492e829a0f 100644 (file)
@@ -44,7 +44,7 @@ vector<vector<double> > SLibshuff::evaluateAll(){
                return dCXYValues;
        }
        catch(exception& e) {
-               errorOut(e, "SLibshuff", "evaluateAll");
+               m->errorOut(e, "SLibshuff", "evaluateAll");
                exit(1);
        }
 }
@@ -97,7 +97,7 @@ double SLibshuff::sCalculate(int x, int y){
                return sum;
        }
        catch(exception& e) {
-               errorOut(e, "SLibshuff", "sCalculate");
+               m->errorOut(e, "SLibshuff", "sCalculate");
                exit(1);
        }
 }
index d29b9c9a7967d8683a1199609e06bae123cec632..33f3afbc2336699b07b4ff5ff97200f8e940b530 100644 (file)
--- a/solow.cpp
+++ b/solow.cpp
@@ -21,12 +21,12 @@ EstOutput Solow::getValues(SAbundVector* rank){
                double f1 = (double)rank->get(1);
                double f2 = (double)rank->get(2);
 
-               data[0] = f1*f1/2/f2 * (1 - pow(1 - 2*f2/n/f1, m));
+               data[0] = f1*f1/2/f2 * (1 - pow(1 - 2*f2/n/f1, f));
                
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Solow", "getValues");
+               m->errorOut(e, "Solow", "getValues");
                exit(1);
        }
 }
diff --git a/solow.h b/solow.h
index 7501609eacd6ef805cb1195597dd4e647fccc426..08501418767f61c98bde2129f762bb13b34483be 100644 (file)
--- a/solow.h
+++ b/solow.h
 class Solow : public Calculator  {
        
 public: 
-       Solow(int size) : m(size), Calculator("solow", 1, false) {};
+       Solow(int size) : f(size), Calculator("solow", 1, false) {};
        EstOutput getValues(SAbundVector*);     
        EstOutput getValues(vector<SharedRAbundVector*>) {return data;};
 private:
-       int m;
+       int f;
 };
 
 
index 7477bd9365fa2f8c77319c0b6c0cb1f94ac85f24..bd54433458982de8689d48a483bfe44e806bd66e 100644 (file)
@@ -5,7 +5,7 @@
 
 /***********************************************************************/
 
-SparseMatrix::SparseMatrix() : numNodes(0), minsIndex(0), smallDist(1e6){}
+SparseMatrix::SparseMatrix() : numNodes(0), minsIndex(0), smallDist(1e6){  m = MothurOut::getInstance();  }
 
 /***********************************************************************/
 
@@ -34,7 +34,7 @@ MatData SparseMatrix::rmCell(MatData data){
        //  clustering and the clustering algorithm updates smallDist
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "rmCell");
+               m->errorOut(e, "SparseMatrix", "rmCell");
                exit(1);
        }
 }
@@ -50,7 +50,7 @@ void SparseMatrix::addCell(PCell value){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "addCell");
+               m->errorOut(e, "SparseMatrix", "addCell");
                exit(1);
        }
 }
@@ -66,7 +66,7 @@ void SparseMatrix::clear(){
                smallDist = 1e6;
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "clear");
+               m->errorOut(e, "SparseMatrix", "clear");
                exit(1);
        }
 }
@@ -97,7 +97,7 @@ void SparseMatrix::print(){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "print");
+               m->errorOut(e, "SparseMatrix", "print");
                exit(1);
        }
 }
@@ -108,15 +108,15 @@ void SparseMatrix::print(ListVector* list){
        try {
                int index = 0;
        
-               mothurOutEndLine(); mothurOut("Index\tRow\tColumn\tDistance"); mothurOutEndLine();
+               m->mothurOutEndLine(); m->mothurOut("Index\tRow\tColumn\tDistance"); m->mothurOutEndLine();
        
                for(MatData currentCell=matrix.begin();currentCell!=matrix.end();currentCell++){
-                       mothurOut(toString(index) + "\t" + toString(list->get(currentCell->row))  + "\t" + toString(list->get(currentCell->column)) + "\t" + toString(currentCell->dist)); mothurOutEndLine();
+                       m->mothurOut(toString(index) + "\t" + toString(list->get(currentCell->row))  + "\t" + toString(list->get(currentCell->column)) + "\t" + toString(currentCell->dist)); m->mothurOutEndLine();
                        index++;
                }
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "print");
+               m->errorOut(e, "SparseMatrix", "print");
                exit(1);
        }
 }
@@ -168,7 +168,7 @@ PCell* SparseMatrix::getSmallestCell(){
                return smallCell;
        }
        catch(exception& e) {
-               errorOut(e, "SparseMatrix", "getSmallestCell");
+               m->errorOut(e, "SparseMatrix", "getSmallestCell");
                exit(1);
        }
 }
index 8eeda7ff2f9899748bde34f92fac5a25dcfd3964..e42fdbb09cc10b00f535003c1c0742ba887d98b9 100644 (file)
@@ -2,6 +2,7 @@
 #define SPARSEMATRIX_H
 
 #include "mothur.h"
+#include "mothurout.h"
 
 
 class ListVector;
@@ -47,6 +48,7 @@ private:
        vector<PCell*> mins;
        float smallDist;
        int minsIndex;
+       MothurOut* m;
 };
 
 /***********************************************************************/
index 39a9b54945cf1fb0a7d4f8f29ecc323381784d1d..2aa8f3f3c04e734acb1d15406f324522b24ac2f0 100644 (file)
@@ -55,7 +55,7 @@ vector<int> SuffixDB::findClosestSequences(Sequence* candidateSeq, int num){
                return topMatches;
        }
        catch(exception& e) {
-               errorOut(e, "SuffixDB", "findClosestSequences");
+               m->errorOut(e, "SuffixDB", "findClosestSequences");
                exit(1);
        }       
 }
@@ -67,7 +67,7 @@ void SuffixDB::addSequence(Sequence seq) {
                count++;
        }
        catch(exception& e) {
-               errorOut(e, "SuffixDB", "addSequence");
+               m->errorOut(e, "SuffixDB", "addSequence");
                exit(1);
        }
 }
index 1e5d7056edb318813f8e699288810a31c096006b..130b2be9166ea28f3e4a54066dc31e6d01afdafb 100644 (file)
@@ -35,7 +35,7 @@ SuffixNode::SuffixNode(int parent, int start, int end) :
                parentNode(parent),                     //      we store the parent node as an int
                startCharPosition(start),       //      the suffix tree class will hold the sequence that the startCharPosition and 
                endCharPosition(end)            //      endCharPosition indices correspond to
-               {       /*      do nothing      */                      }
+               {       /*      do nothing      */              m = MothurOut::getInstance();   }
 
 
 void SuffixNode::setChildren(char, int)                        {       /*      do nothing      */                      }       //      there's no children in a leaf
@@ -57,14 +57,14 @@ SuffixLeaf::SuffixLeaf(int parent, int start, int end) : SuffixNode(parent, star
 
 void SuffixLeaf::print(string sequence, int nodeNumber){
        
-       mothurOut(toString(this) + "\t" + toString(parentNode) + "\t" + toString(nodeNumber) + "\t" +
+       m->mothurOut(toString(this) + "\t" + toString(parentNode) + "\t" + toString(nodeNumber) + "\t" +
        toString(-1) + "\t" + toString(startCharPosition) + "\t" + toString(endCharPosition) + "\t");
        
-       mothurOut("/");
+       m->mothurOut("/");
        for(int i=startCharPosition;i<=endCharPosition;i++){
-               mothurOut(toString(deCodeSequence(sequence[i])));
+               m->mothurOut(toString(deCodeSequence(sequence[i])));
        }
-       mothurOut("/");  mothurOutEndLine();
+       m->mothurOut("/");  m->mothurOutEndLine();
 }
 
 //********************************************************************************************************************
@@ -74,14 +74,14 @@ SuffixBranch::SuffixBranch(int parent, int start, int end) : SuffixNode(parent,
 }
        
 void SuffixBranch::print(string sequence, int nodeNumber){                                             //      this method is different that than
-       mothurOut(toString(this) + "\t" + toString(parentNode) + "\t" + toString(nodeNumber) + "\t" +           //      of a leaf because it prints out a
+       m->mothurOut(toString(this) + "\t" + toString(parentNode) + "\t" + toString(nodeNumber) + "\t" +                //      of a leaf because it prints out a
        toString(suffixNode) + "\t" + toString(startCharPosition) + "\t" + toString(endCharPosition) + "\t");  //       value for the suffix node
        
-       mothurOut("/");
+       m->mothurOut("/");
        for(int i=startCharPosition;i<=endCharPosition;i++){
-               mothurOut(toString(deCodeSequence(sequence[i])));
+               m->mothurOut(toString(deCodeSequence(sequence[i])));
        }
-       mothurOut("/");  mothurOutEndLine();
+       m->mothurOut("/");  m->mothurOutEndLine();
 }
 
 //     we can access the children by subtracting '0' from the the char value from the string, the difference is an int
index 63918fa6acf5f5c5f81124403e387cb61c7634b3..6a22c4d4359b8ee6120c3e683b2d14318fd0c05c 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 //********************************************************************************************************************
 
@@ -42,6 +43,7 @@ protected:
        int parentNode;
        int startCharPosition;
        int endCharPosition;
+       MothurOut* m;
 };
 
 //********************************************************************************************************************
index 2842b366b3360f4b43ad32dd28603073266dcdfa..9cd835185c31a61bd024590f5a3fc7396d31610f 100644 (file)
@@ -35,7 +35,7 @@ inline bool compareParents(SuffixNode* left, SuffixNode* right){//    this is neces
 
 //********************************************************************************************************************
 
-SuffixTree::SuffixTree(){}
+SuffixTree::SuffixTree(){ m = MothurOut::getInstance(); }
 
 //********************************************************************************************************************
 
@@ -75,7 +75,7 @@ string SuffixTree::getSeqName()       {
 void SuffixTree::print(){
        vector<SuffixNode*> hold = nodeVector;
        sort(hold.begin(), hold.end(), compareParents);
-       mothurOut("Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix"); mothurOutEndLine();
+       m->mothurOut("Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix"); m->mothurOutEndLine();
        for(int i=1;i<=nodeCounter;i++){
                hold[i]->print(sequence, i);
        }
index ab262ba86295ea964d3857e40d387961466e7d11..805b9b0fda003cbeade1ce5ea875cb994ab3c960 100644 (file)
@@ -60,6 +60,7 @@ private:
        int nodeCounter;
        string seqName;
        string sequence;
+       MothurOut* m;
        
 };
 
index 032282411f60905990f59dc0275259266e86d7e7..12382a48864a87363f5faae62425de574cb5d0e7 100644 (file)
@@ -31,7 +31,7 @@
 
 //**********************************************************************************************************************
 
-SummaryCommand::SummaryCommand(string option){
+SummaryCommand::SummaryCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -58,7 +58,7 @@ SummaryCommand::SummaryCommand(string option){
                        }
                        
                        //make sure the user has already run the read.otu command
-                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund, rabund or shared file before you can use the summary.single command."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund, rabund or shared file before you can use the summary.single command."); m->mothurOutEndLine(); abort = true; }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -98,7 +98,7 @@ SummaryCommand::SummaryCommand(string option){
                }
        }
        catch(exception& e) {
-               errorOut(e, "SummaryCommand", "SummaryCommand");
+               m->errorOut(e, "SummaryCommand", "SummaryCommand");
                exit(1);
        }
 }
@@ -106,19 +106,19 @@ SummaryCommand::SummaryCommand(string option){
 
 void SummaryCommand::help(){
        try {
-               mothurOut("The summary.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
-               mothurOut("The summary.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
-               mothurOut("The summary.single command parameters are label, calc, abund.  No parameters are required.\n");
-               mothurOut("The summary.single command should be in the following format: \n");
-               mothurOut("summary.single(label=yourLabel, calc=yourEstimators).\n");
-               mothurOut("Example summary.single(label=unique-.01-.03, calc=sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson).\n");
+               m->mothurOut("The summary.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
+               m->mothurOut("The summary.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
+               m->mothurOut("The summary.single command parameters are label, calc, abund.  No parameters are required.\n");
+               m->mothurOut("The summary.single command should be in the following format: \n");
+               m->mothurOut("summary.single(label=yourLabel, calc=yourEstimators).\n");
+               m->mothurOut("Example summary.single(label=unique-.01-.03, calc=sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson).\n");
                validCalculator->printCalc("summary", cout);
-               mothurOut("The default value calc is sobs-chao-ace-jack-shannon-npshannon-simpson\n");
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n");
+               m->mothurOut("The default value calc is sobs-chao-ace-jack-shannon-npshannon-simpson\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "SummaryCommand", "help");
+               m->errorOut(e, "SummaryCommand", "help");
                exit(1);
        }
 }
@@ -134,6 +134,8 @@ int SummaryCommand::execute(){
        
                if (abort == true) { return 0; }
                
+               vector<string> outputNames;
+               
                if ((globaldata->getFormat() != "sharedfile")) { inputFileNames.push_back(globaldata->inputFileName);  }
                else {  inputFileNames = parseSharedFile(globaldata->getSharedFile());  globaldata->setFormat("rabund");  }
                
@@ -141,9 +143,10 @@ int SummaryCommand::execute(){
                        
                        string fileNameRoot = outputDir + getRootName(getSimpleName(inputFileNames[p])) + "summary";
                        globaldata->inputFileName = inputFileNames[p];
+                       outputNames.push_back(fileNameRoot);
                        
                        if (inputFileNames.size() > 1) {
-                               mothurOutEndLine(); mothurOut("Processing group " + groups[p]); mothurOutEndLine(); mothurOutEndLine();
+                               m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
                        }
                        
                        sumCalculators.clear();
@@ -230,7 +233,7 @@ int SummaryCommand::execute(){
                                
                                if(allLines == 1 || labels.count(sabund->getLabel()) == 1){                     
                                        
-                                       mothurOut(sabund->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(sabund->getLabel());
                                        userLabels.erase(sabund->getLabel());
                                        
@@ -249,7 +252,7 @@ int SummaryCommand::execute(){
                                        delete sabund;
                                        sabund = input->getSAbundVector(lastLabel);
                                        
-                                       mothurOut(sabund->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(sabund->getLabel());
                                        userLabels.erase(sabund->getLabel());
                                        
@@ -275,12 +278,12 @@ int SummaryCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                        
@@ -289,7 +292,7 @@ int SummaryCommand::execute(){
                                if (sabund != NULL) {   delete sabund;  }
                                sabund = input->getSAbundVector(lastLabel);
                                
-                               mothurOut(sabund->getLabel()); mothurOutEndLine();
+                               m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
                                outputFileHandle << sabund->getLabel();
                                for(int i=0;i<sumCalculators.size();i++){
                                        vector<double> data = sumCalculators[i]->getValues(sabund);
@@ -308,10 +311,15 @@ int SummaryCommand::execute(){
                        globaldata->sabund = NULL;
                }
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SummaryCommand", "execute");
+               m->errorOut(e, "SummaryCommand", "execute");
                exit(1);
        }
 }
@@ -370,7 +378,7 @@ vector<string> SummaryCommand::parseSharedFile(string filename) {
                return filenames;
        }
        catch(exception& e) {
-               errorOut(e, "SummaryCommand", "parseSharedFile");
+               m->errorOut(e, "SummaryCommand", "parseSharedFile");
                exit(1);
        }
 }
index 081f5ef027dc04c30da1eba77647d67288bbfb44..b6b4f522df0b1fc0eeb96d3851d8eda0419a35aa 100644 (file)
@@ -35,7 +35,7 @@
 
 //**********************************************************************************************************************
 
-SummarySharedCommand::SummarySharedCommand(string option){
+SummarySharedCommand::SummarySharedCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -63,7 +63,7 @@ SummarySharedCommand::SummarySharedCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
-                                mothurOut("You must read a list and a group, or a shared before you can use the summary.shared command."); mothurOutEndLine(); abort = true; 
+                                m->mothurOut("You must read a list and a group, or a shared before you can use the summary.shared command."); m->mothurOutEndLine(); abort = true; 
                        }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -159,12 +159,14 @@ SummarySharedCommand::SummarySharedCommand(string option){
                                
                                outputFileName = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + "shared.summary";
                                openOutputFile(outputFileName, outputFileHandle);
+                               outputNames.push_back(outputFileName);
+                               
                                mult = false;
                        }
                }
        }
        catch(exception& e) {
-               errorOut(e, "SummarySharedCommand", "SummarySharedCommand");
+               m->errorOut(e, "SummarySharedCommand", "SummarySharedCommand");
                exit(1);
        }
 }
@@ -173,22 +175,22 @@ SummarySharedCommand::SummarySharedCommand(string option){
 
 void SummarySharedCommand::help(){
        try {
-               mothurOut("The summary.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The summary.shared command parameters are label, calc and all.  No parameters are required.\n");
-               mothurOut("The summary.shared command should be in the following format: \n");
-               mothurOut("summary.shared(label=yourLabel, calc=yourEstimators, groups=yourGroups).\n");
-               mothurOut("Example summary.shared(label=unique-.01-.03, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
+               m->mothurOut("The summary.shared command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The summary.shared command parameters are label, calc and all.  No parameters are required.\n");
+               m->mothurOut("The summary.shared command should be in the following format: \n");
+               m->mothurOut("summary.shared(label=yourLabel, calc=yourEstimators, groups=yourGroups).\n");
+               m->mothurOut("Example summary.shared(label=unique-.01-.03, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
                validCalculator->printCalc("sharedsummary", cout);
-               mothurOut("The default value for calc is sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan\n");
-               mothurOut("The default value for groups is all the groups in your groupfile.\n");
-               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
-               mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
+               m->mothurOut("The default value for calc is sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+               m->mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
+               m->mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "SummarySharedCommand", "help");
+               m->errorOut(e, "SummarySharedCommand", "help");
                exit(1);
        }
 }
@@ -208,7 +210,7 @@ int SummarySharedCommand::execute(){
        try {
        
                if (abort == true) { return 0; }
-       
+               
                //if the users entered no valid calculators don't execute command
                if (sumCalculators.size() == 0) { return 0; }
                //check if any calcs can do multiples
@@ -239,6 +241,7 @@ int SummarySharedCommand::execute(){
                if (mult == true) {
                        outAllFileName = ((getRootName(globaldata->inputFileName)) + "sharedmultiple.summary");
                        openOutputFile(outAllFileName, outAll);
+                       outputNames.push_back(outAllFileName);
                        
                        outAll << "label" <<'\t' << "comparison" << '\t'; 
                        for(int i=0;i<sumCalculators.size();i++){
@@ -250,7 +253,7 @@ int SummarySharedCommand::execute(){
                }
                
                if (lookup.size() < 2) { 
-                       mothurOut("I cannot run the command without at least 2 valid groups."); 
+                       m->mothurOut("I cannot run the command without at least 2 valid groups."); 
                        for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
                        
                        //close files and clean up
@@ -262,6 +265,7 @@ int SummarySharedCommand::execute(){
                        mult = false;
                        outAll.close();  
                        remove(outAllFileName.c_str());
+                       outputNames.pop_back();
                }
                                        
                //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
@@ -272,7 +276,7 @@ int SummarySharedCommand::execute(){
                while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -285,7 +289,7 @@ int SummarySharedCommand::execute(){
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        process(lookup);
                                        
                                        processedLabels.insert(lookup[0]->getLabel());
@@ -307,12 +311,12 @@ int SummarySharedCommand::execute(){
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -321,7 +325,7 @@ int SummarySharedCommand::execute(){
                                for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {     delete lookup[i];       } } 
                                lookup = input->getSharedRAbundVectors(lastLabel);
 
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                }
@@ -337,11 +341,16 @@ int SummarySharedCommand::execute(){
                for(int i=0;i<sumCalculators.size();i++){  delete sumCalculators[i]; }
                
                delete input;  globaldata->ginput = NULL;
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SummarySharedCommand", "execute");
+               m->errorOut(e, "SummarySharedCommand", "execute");
                exit(1);
        }
 }
@@ -403,7 +412,7 @@ void SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup) {
 
        }
        catch(exception& e) {
-               errorOut(e, "SummarySharedCommand", "process");
+               m->errorOut(e, "SummarySharedCommand", "process");
                exit(1);
        }
 }
index 351b1352b7e865d8c0741ffb56875407070db344..8f37eeb9cb1a907c7db1b2c6549ad19bda591a6b 100644 (file)
@@ -37,7 +37,7 @@ private:
        bool abort, allLines, mult, all;
        set<string> labels; //holds labels to be used
        string label, calc, groups;
-       vector<string>  Estimators, Groups;
+       vector<string>  Estimators, Groups, outputNames;
        vector<SharedRAbundVector*> lookup;
        string outputFileName, format, outAllFileName, outputDir;
        ofstream outputFileHandle, outAll;
index 489a2f11f7c3a13df14bedf42a05339e86fcaeb2..708724a4e5cd46643e7ec29464b61c1f34c7cd41 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-SystemCommand::SystemCommand(string option){
+SystemCommand::SystemCommand(string option)  {
        try {
                abort = false;
                
@@ -19,7 +19,7 @@ SystemCommand::SystemCommand(string option){
                if(option == "help") { help(); abort = true; }
                
                else {
-                       if (option == "") { mothurOut("You must enter a command to run."); mothurOutEndLine(); abort = true; }
+                       if (option == "") { m->mothurOut("You must enter a command to run."); m->mothurOutEndLine(); abort = true; }
                        else { 
                                //check for outputdir and inputdir parameters
                                int commaPos = option.find_first_of(',');
@@ -35,7 +35,7 @@ SystemCommand::SystemCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "SystemCommand", "SystemCommand");
+               m->errorOut(e, "SystemCommand", "SystemCommand");
                exit(1);
        }
 }
@@ -43,13 +43,13 @@ SystemCommand::SystemCommand(string option){
 
 void SystemCommand::help(){
        try {
-               mothurOut("The system command allows you to execute a system command from within mothur.\n");
-               mothurOut("The system has no parameters.\n");
-               mothurOut("The system command should be in the following format: system(yourCommand).\n");
-               mothurOut("Example system(clear).\n");
+               m->mothurOut("The system command allows you to execute a system command from within mothur.\n");
+               m->mothurOut("The system has no parameters.\n");
+               m->mothurOut("The system command should be in the following format: system(yourCommand).\n");
+               m->mothurOut("Example system(clear).\n");
        }
        catch(exception& e) {
-               errorOut(e, "SystemCommand", "help");
+               m->errorOut(e, "SystemCommand", "help");
                exit(1);
        }
 }
@@ -67,7 +67,7 @@ int SystemCommand::execute(){
        }
 
        catch(exception& e) {
-               errorOut(e, "SystemCommand", "execute");
+               m->errorOut(e, "SystemCommand", "execute");
                exit(1);
        }
 }
index c84c439a9efbc3633372ffe3ff3461f127dae171..f3ccfe45852ba8065c454d4bf42a0ad83a75d088 100644 (file)
@@ -12,6 +12,7 @@
 /**************************************************************************************************/
 TaxEqualizer::TaxEqualizer(string tfile, int c) : cutoff(c) {
        try {
+               m = MothurOut::getInstance();
                containsConfidence = false;
                
                ifstream inTax;
@@ -23,8 +24,8 @@ TaxEqualizer::TaxEqualizer(string tfile, int c) : cutoff(c) {
                if ((cutoff != -1) && (cutoff < highestLevel)) { 
                        highestLevel = cutoff;
                }else if (cutoff > highestLevel) {
-                       mothurOut("The highest level taxonomy you have is " + toString(highestLevel) + " and your cutoff is " + toString(cutoff) + ". I will set the cutoff to " + toString(highestLevel));
-                       mothurOutEndLine();
+                       m->mothurOut("The highest level taxonomy you have is " + toString(highestLevel) + " and your cutoff is " + toString(cutoff) + ". I will set the cutoff to " + toString(highestLevel));
+                       m->mothurOutEndLine();
                }
                
                inTax.close(); 
@@ -56,7 +57,7 @@ TaxEqualizer::TaxEqualizer(string tfile, int c) : cutoff(c) {
                                        
        }
        catch(exception& e) {
-               errorOut(e, "TaxEqualizer", "TaxEqualizer");
+               m->errorOut(e, "TaxEqualizer", "TaxEqualizer");
                exit(1);
        }
 }
@@ -95,7 +96,7 @@ int TaxEqualizer::getHighestLevel(ifstream& in) {
                                        
        }
        catch(exception& e) {
-               errorOut(e, "TaxEqualizer", "getHighestLevel");
+               m->errorOut(e, "TaxEqualizer", "getHighestLevel");
                exit(1);
        }
 }
@@ -118,7 +119,7 @@ void TaxEqualizer::extendTaxonomy(string name, string& tax, int desiredLevel) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "TaxEqualizer", "extendTaxonomy");
+               m->errorOut(e, "TaxEqualizer", "extendTaxonomy");
                exit(1);
        }
 }
@@ -137,7 +138,7 @@ void TaxEqualizer::truncateTaxonomy(string name, string& tax, int desiredLevel)
                tax += ";";
        }
        catch(exception& e) {
-               errorOut(e, "TaxEqualizer", "truncateTaxonomy");
+               m->errorOut(e, "TaxEqualizer", "truncateTaxonomy");
                exit(1);
        }
 }
@@ -161,7 +162,7 @@ void TaxEqualizer::removeConfidences(string& tax) {
                tax = newTax;
        }
        catch(exception& e) {
-               errorOut(e, "TaxEqualizer", "removeConfidences");
+               m->errorOut(e, "TaxEqualizer", "removeConfidences");
                exit(1);
        }
 }
index 9f38b2f2a29756d751f10b6b8e97b4cc3925bd00..e060c9e8e1f58e28b1eb083287e697a364c05268 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 //reads in taxonomy file and makes all the taxonomies the same length 
 //by appending the last taxon to a given taxonomy as many times as needed to 
@@ -39,7 +40,7 @@ private:
        void extendTaxonomy(string, string&, int);  //name, taxonomy, desired level
        void truncateTaxonomy(string, string&, int);  //name, taxonomy, desired level
        void removeConfidences(string&);  //removes the confidence limits on the taxon 
-
+       MothurOut* m;
        
 };
 
index 731eb64d93f95b485f8607308e3e88345138813c..eca53d5527bbdda6dbc97ddc0c9f4e7766e15d25 100644 (file)
--- a/tree.cpp
+++ b/tree.cpp
@@ -14,6 +14,7 @@
 Tree::Tree() {
        try {
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
                
                if (globaldata->runParse == true) {  parseTreeFile();  globaldata->runParse = false;  }
 //for(int i = 0; i <   globaldata->Treenames.size(); i++) { cout << i << '\t' << globaldata->Treenames[i] << endl;  }  
@@ -44,7 +45,7 @@ Tree::Tree() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "Tree");
+               m->errorOut(e, "Tree", "Tree");
                exit(1);
        }
 }
@@ -73,7 +74,7 @@ void Tree::addNamesToCounts() {
                        
                        map<string, string>::iterator itNames = globaldata->names.find(name);
                        
-                       if (itNames == globaldata->names.end()) { mothurOut(name + " is not in your name file, please correct."); mothurOutEndLine(); exit(1);  }
+                       if (itNames == globaldata->names.end()) { m->mothurOut(name + " is not in your name file, please correct."); m->mothurOutEndLine(); exit(1);  }
                        else {
                                vector<string> dupNames;
                                splitAtComma(globaldata->names[name], dupNames);
@@ -134,7 +135,7 @@ void Tree::addNamesToCounts() {
                                
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "addNamesToCounts");
+               m->errorOut(e, "Tree", "addNamesToCounts");
                exit(1);
        }
 }
@@ -148,7 +149,7 @@ int Tree::getIndex(string searchName) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "getIndex");
+               m->errorOut(e, "Tree", "getIndex");
                exit(1);
        }
 }
@@ -160,7 +161,7 @@ void Tree::setIndex(string searchName, int index) {
                globaldata->gTreemap->setIndex(searchName, index);
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "setIndex");
+               m->errorOut(e, "Tree", "setIndex");
                exit(1);
        }
 }
@@ -178,7 +179,7 @@ void Tree::assembleTree() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "assembleTree");
+               m->errorOut(e, "Tree", "assembleTree");
                exit(1);
        }
 }
@@ -216,7 +217,7 @@ void Tree::getCopy(Tree* copy) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "getCopy");
+               m->errorOut(e, "Tree", "getCopy");
                exit(1);
        }
 }
@@ -269,7 +270,7 @@ map<string, int> Tree::mergeGroups(int i) {
                return parsimony;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "mergeGroups");
+               m->errorOut(e, "Tree", "mergeGroups");
                exit(1);
        }
 }
@@ -335,7 +336,7 @@ map<string, int> Tree::mergeUserGroups(int i, vector<string> g) {
                return parsimony;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "mergeUserGroups");
+               m->errorOut(e, "Tree", "mergeUserGroups");
                exit(1);
        }
 }
@@ -358,7 +359,7 @@ map<string,int> Tree::mergeGcounts(int position) {
                return sum;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "mergeGcounts");
+               m->errorOut(e, "Tree", "mergeGcounts");
                exit(1);
        }
 }
@@ -400,7 +401,7 @@ void Tree::randomLabels(vector<string> g) {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "randomLabels");
+               m->errorOut(e, "Tree", "randomLabels");
                exit(1);
        }
 }
@@ -430,7 +431,7 @@ void Tree::randomLabels(string groupA, string groupB) {
                }
        }               
        catch(exception& e) {
-               errorOut(e, "Tree", "randomLabels");
+               m->errorOut(e, "Tree", "randomLabels");
                exit(1);
        }
 }
@@ -446,7 +447,7 @@ void Tree::randomBlengths()  {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "randomBlengths");
+               m->errorOut(e, "Tree", "randomBlengths");
                exit(1);
        }
 }
@@ -503,7 +504,7 @@ void Tree::randomTopology() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "randomTopology");
+               m->errorOut(e, "Tree", "randomTopology");
                exit(1);
        }
 }
@@ -515,7 +516,7 @@ void Tree::print(ostream& out) {
                out << ";" << endl;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "print");
+               m->errorOut(e, "Tree", "print");
                exit(1);
        }
 }
@@ -527,7 +528,7 @@ void Tree::printForBoot(ostream& out) {
                out << ";" << endl;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "printForBoot");
+               m->errorOut(e, "Tree", "printForBoot");
                exit(1);
        }
 }
@@ -549,7 +550,7 @@ void Tree::createNewickFile(string f) {
                out.close();
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "createNewickFile");
+               m->errorOut(e, "Tree", "createNewickFile");
                exit(1);
        }
 }
@@ -568,7 +569,7 @@ int Tree::findRoot() {
                return -1;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "findRoot");
+               m->errorOut(e, "Tree", "findRoot");
                exit(1);
        }
 }
@@ -614,7 +615,7 @@ void Tree::printBranch(int node, ostream& out, string mode) {
                
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "printBranch");
+               m->errorOut(e, "Tree", "printBranch");
                exit(1);
        }
 }
@@ -710,7 +711,7 @@ void Tree::parseTreeFile() {
                filehandle.close();
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "parseTreeFile");
+               m->errorOut(e, "Tree", "parseTreeFile");
                exit(1);
        }
 }
@@ -774,7 +775,7 @@ int Tree::readTreeString(ifstream& filehandle)      {
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "Tree", "readTreeString");
+               m->errorOut(e, "Tree", "readTreeString");
                exit(1);
        }
 }      
diff --git a/tree.h b/tree.h
index 37028be57e90f3d5d38eeb3080b36a8538e8bf8e..04d9fb1fd3499cd87b5a8563b6e082fddb3d32dd 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -62,6 +62,7 @@ private:
                                                        //not included in the tree. 
                                                        //only takes names from the first tree in the tree file and assumes that all trees use the same names.
        int readTreeString(ifstream&);
+       MothurOut* m;
        
 };
 
index 797c45723f835fea908fe2829397b682edc32c6f..86cb52798a291990ea7d0d20adfdf9c14f0ea569 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "mothur.h"
 #include "tree.h"
+#include "mothurout.h"
 
 /* The tree calculator class is the parent class for tree calculators in mothur. */ 
 
@@ -22,7 +23,7 @@ typedef vector<double> EstOutput;
 class TreeCalculator {
 
 public:
-       TreeCalculator(){};
+       TreeCalculator(){ m = MothurOut::getInstance(); }
        TreeCalculator(string n) : name(n) {};
        virtual ~TreeCalculator(){};
        virtual EstOutput getValues(Tree*) = 0; 
@@ -33,6 +34,7 @@ public:
 protected:
        EstOutput data;
        string name;
+       MothurOut* m;
 
 };
 
index e8f68e7f34c52258e480bd8e6f369a200734df1f..6ce5ee9dfcb29dfd495bb7dc5f83aec8681eb3d6 100644 (file)
@@ -22,7 +22,7 @@
 
 //**********************************************************************************************************************
 
-TreeGroupCommand::TreeGroupCommand(string option){
+TreeGroupCommand::TreeGroupCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
@@ -99,11 +99,11 @@ TreeGroupCommand::TreeGroupCommand(string option){
                        else {  globaldata->setNameFile(namefile);      }
                        
                        //error checking on files                       
-                       if ((globaldata->getSharedFile() == "") && ((phylipfile == "") && (columnfile == "")))  { mothurOut("You must run the read.otu command or provide a distance file before running the tree.shared command."); mothurOutEndLine(); abort = true; }
-                       else if ((phylipfile != "") && (columnfile != "")) { mothurOut("When running the tree.shared command with a distance file you may not use both the column and the phylip parameters."); mothurOutEndLine(); abort = true; }
+                       if ((globaldata->getSharedFile() == "") && ((phylipfile == "") && (columnfile == "")))  { m->mothurOut("You must run the read.otu command or provide a distance file before running the tree.shared command."); m->mothurOutEndLine(); abort = true; }
+                       else if ((phylipfile != "") && (columnfile != "")) { m->mothurOut("When running the tree.shared command with a distance file you may not use both the column and the phylip parameters."); m->mothurOutEndLine(); abort = true; }
                        
                        if (columnfile != "") {
-                               if (namefile == "") {  mothurOut("You need to provide a namefile if you are going to use the column format."); mothurOutEndLine(); abort = true; }
+                               if (namefile == "") {  m->mothurOut("You need to provide a namefile if you are going to use the column format."); m->mothurOutEndLine(); abort = true; }
                        }
 
                        //check for optional parameter and set defaults
@@ -187,7 +187,7 @@ TreeGroupCommand::TreeGroupCommand(string option){
 
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "TreeGroupCommand");
+               m->errorOut(e, "TreeGroupCommand", "TreeGroupCommand");
                exit(1);
        }
 }
@@ -196,25 +196,25 @@ TreeGroupCommand::TreeGroupCommand(string option){
 
 void TreeGroupCommand::help(){
        try {
-               mothurOut("The tree.shared command creates a .tre to represent the similiarity between groups or sequences.\n");
-               mothurOut("The tree.shared command can only be executed after a successful read.otu command or by providing a distance file.\n");
-               mothurOut("The tree.shared command parameters are groups, calc, phylip, column, name, cutoff, precision and label.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
-               mothurOut("The group names are separated by dashes. The label allow you to select what distance levels you would like trees created for, and are also separated by dashes.\n");
-               mothurOut("The phylip or column parameter are required if you do not run the read.otu command first, and only one may be used.  If you use a column file the name filename is required. \n");
-               mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
-               mothurOut("The tree.shared command should be in the following format: tree.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n");
-               mothurOut("Example tree.shared(groups=A-B-C, calc=jabund-sorabund).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile.\n");
-               mothurOut("The default value for calc is jclass-thetayc.\n");
-               mothurOut("The tree.shared command outputs a .tre file for each calculator you specify at each distance you choose.\n");
+               m->mothurOut("The tree.shared command creates a .tre to represent the similiarity between groups or sequences.\n");
+               m->mothurOut("The tree.shared command can only be executed after a successful read.otu command or by providing a distance file.\n");
+               m->mothurOut("The tree.shared command parameters are groups, calc, phylip, column, name, cutoff, precision and label.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n");
+               m->mothurOut("The group names are separated by dashes. The label allow you to select what distance levels you would like trees created for, and are also separated by dashes.\n");
+               m->mothurOut("The phylip or column parameter are required if you do not run the read.otu command first, and only one may be used.  If you use a column file the name filename is required. \n");
+               m->mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n");
+               m->mothurOut("The tree.shared command should be in the following format: tree.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n");
+               m->mothurOut("Example tree.shared(groups=A-B-C, calc=jabund-sorabund).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The default value for calc is jclass-thetayc.\n");
+               m->mothurOut("The tree.shared command outputs a .tre file for each calculator you specify at each distance you choose.\n");
                validCalculator->printCalc("treegroup", cout);
-               mothurOut("Or the tree.shared command can be in the following format: tree.shared(phylip=yourPhylipFile).\n");
-               mothurOut("Example tree.shared(phylip=abrecovery.dist).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("Or the tree.shared command can be in the following format: tree.shared(phylip=yourPhylipFile).\n");
+               m->mothurOut("Example tree.shared(phylip=abrecovery.dist).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "help");
+               m->errorOut(e, "TreeGroupCommand", "help");
                exit(1);
        }
 }
@@ -242,7 +242,7 @@ int TreeGroupCommand::execute(){
                
                if (format == "sharedfile") {
                        //if the users entered no valid calculators don't execute command
-                       if (treeCalculators.size() == 0) { mothurOut("You have given no valid calculators."); mothurOutEndLine(); return 0; }
+                       if (treeCalculators.size() == 0) { m->mothurOut("You have given no valid calculators."); m->mothurOutEndLine(); return 0; }
 
                        //you have groups
                        read = new ReadOTUFile(globaldata->inputFileName);      
@@ -252,7 +252,7 @@ int TreeGroupCommand::execute(){
                        lookup = input->getSharedRAbundVectors();
                        lastLabel = lookup[0]->getLabel();
                        
-                       if (lookup.size() < 2) { mothurOut("You have not provided enough valid groups.  I cannot run the command."); mothurOutEndLine(); return 0; }
+                       if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); return 0; }
                        
                        //used in tree constructor 
                        globaldata->runParse = false;
@@ -300,18 +300,24 @@ int TreeGroupCommand::execute(){
 
                        //create a new filename
                        outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + "tre"; 
+                       outputNames.push_back(outputFile);
                                
                        createTree();
-                       mothurOut("Tree complete. "); mothurOutEndLine();
+                       m->mothurOut("Tree complete. "); m->mothurOutEndLine();
                }
                                
                //reset groups parameter
                globaldata->Groups.clear();  
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
 
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "execute");
+               m->errorOut(e, "TreeGroupCommand", "execute");
                exit(1);
        }
 }
@@ -388,7 +394,7 @@ void TreeGroupCommand::createTree(){
        
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "createTree");
+               m->errorOut(e, "TreeGroupCommand", "createTree");
                exit(1);
        }
 }
@@ -412,7 +418,7 @@ void TreeGroupCommand::printSims(ostream& out) {
 
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "printSims");
+               m->errorOut(e, "TreeGroupCommand", "printSims");
                exit(1);
        }
 }
@@ -445,7 +451,7 @@ void TreeGroupCommand::makeSimsDist() {
 
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "makeSimsDist");
+               m->errorOut(e, "TreeGroupCommand", "makeSimsDist");
                exit(1);
        }
 }
@@ -472,7 +478,7 @@ void TreeGroupCommand::makeSimsShared() {
                while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -485,7 +491,7 @@ void TreeGroupCommand::makeSimsShared() {
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                lookup = input->getSharedRAbundVectors(lastLabel);
 
-                               mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                               m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                process(lookup);
                                        
                                processedLabels.insert(lookup[0]->getLabel());
@@ -506,12 +512,12 @@ void TreeGroupCommand::makeSimsShared() {
                set<string>::iterator it;
                bool needToRun = false;
                for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                       mothurOut("Your file does not include the label " + *it); 
+                       m->mothurOut("Your file does not include the label " + *it); 
                        if (processedLabels.count(lastLabel) != 1) {
-                               mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                needToRun = true;
                        }else {
-                               mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                        }
                }
                
@@ -520,7 +526,7 @@ void TreeGroupCommand::makeSimsShared() {
                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {             delete lookup[i]; }             } 
                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                        process(lookup);
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }         
                }
@@ -528,7 +534,7 @@ void TreeGroupCommand::makeSimsShared() {
                for(int i = 0 ; i < treeCalculators.size(); i++) {  delete treeCalculators[i]; }
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "makeSimsShared");
+               m->errorOut(e, "TreeGroupCommand", "makeSimsShared");
                exit(1);
        }
 }
@@ -557,6 +563,7 @@ void TreeGroupCommand::process(vector<SharedRAbundVector*> thisLookup) {
                
                                        //create a new filename
                                        outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + treeCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + ".tre";                              
+                                       outputNames.push_back(outputFile);
                                                                                                
                                        for (int k = 0; k < thisLookup.size(); k++) { 
                                                for (int l = k; l < thisLookup.size(); l++) {
@@ -581,7 +588,7 @@ void TreeGroupCommand::process(vector<SharedRAbundVector*> thisLookup) {
 
        }
        catch(exception& e) {
-               errorOut(e, "TreeGroupCommand", "process");
+               m->errorOut(e, "TreeGroupCommand", "process");
                exit(1);
        }
 }
index e23dc777689f80806a8d81e458c9acda7f3ba4aa..899716c6055b0dc12cbe493fc1ff3e5b8170d769 100644 (file)
@@ -68,7 +68,7 @@ private:
        bool abort, allLines;
        set<string> labels; //holds labels to be used
        string phylipfile, columnfile, namefile, calc, groups, label, outputDir;
-       vector<string>  Estimators, Groups; //holds estimators to be used
+       vector<string>  Estimators, Groups, outputNames; //holds estimators to be used
        
        //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
        void process(vector<SharedRAbundVector*>);
index cd046f9dced6bbbe33c0d611d603217e28884d7c..bb624480e79640d8a23fc6fe4c47c8ba8c6b82a4 100644 (file)
@@ -135,7 +135,7 @@ bool TreeMap::isValidGroup(string groupname) {
                return false;
        }
        catch(exception& e) {
-               errorOut(e, "TreeMap", "isValidGroup");
+               m->errorOut(e, "TreeMap", "isValidGroup");
                exit(1);
        }
 }
@@ -149,7 +149,7 @@ void TreeMap::print(ostream& output){
                }
        }
        catch(exception& e) {
-               errorOut(e, "TreeMap", "print");
+               m->errorOut(e, "TreeMap", "print");
                exit(1);
        }
 }
@@ -173,7 +173,7 @@ void TreeMap::makeSim(GroupMap* groupmap) {
                
        }
        catch(exception& e) {
-               errorOut(e, "TreeMap", "makeSim");
+               m->errorOut(e, "TreeMap", "makeSim");
                exit(1);
        }
 }
@@ -199,7 +199,7 @@ void TreeMap::makeSim(ListVector* list) {
                
        }
        catch(exception& e) {
-               errorOut(e, "TreeMap", "makeSim");
+               m->errorOut(e, "TreeMap", "makeSim");
                exit(1);
        }
 }
index 0824ebf7f7e6cd109db4d3adb344c46d09738b21..bda6926c20ea79800e9f9cc8a06b87ce6f44c68c 100644 (file)
--- a/treemap.h
+++ b/treemap.h
@@ -25,7 +25,7 @@ class ListVector;
 
 class TreeMap {
 public:
-       TreeMap() {};
+       TreeMap() { m = MothurOut::getInstance(); }
        TreeMap(string);
        ~TreeMap();
        void readMap();
@@ -51,6 +51,7 @@ private:
        map<string, GroupIndex>::iterator it;
        map<string, int>::iterator it2;
        void setNamesOfGroups(string); 
+       MothurOut* m;
        
        
 };
index 648707ab246725ce6f36e912d9b8509024e362b7..c00ade00e81dda033d6043dea643d95dda0b821a 100644 (file)
@@ -12,6 +12,7 @@
 
 /****************************************************************/     
 Node::Node() {
+       m = MothurOut::getInstance();
        //initialize node
        name = "";
        branchLength = -1;
@@ -60,30 +61,30 @@ int Node::getIndex() { return vectorIndex; }
 //to be used by printTree in the Tree class to print the leaf info                     
 void Node::printNode() {
        try{
-               mothurOut(toString(parent) + " " + toString(lchild) + " " + toString(rchild) + " ");
+               m->mothurOut(toString(parent) + " " + toString(lchild) + " " + toString(rchild) + " ");
                
-               for (int i = 0; i < group.size(); i++) {  mothurOut( group[i] + " "); }
+               for (int i = 0; i < group.size(); i++) {  m->mothurOut( group[i] + " "); }
                
                //there is a branch length
                if (branchLength != -1) { 
-                       mothurOut(" " + toString(branchLength)); 
+                       m->mothurOut(" " + toString(branchLength)); 
                }
-               mothurOut(" |");
+               m->mothurOut(" |");
                
                map<string, int>::iterator it;
                for(it=pGroups.begin();it!=pGroups.end();it++){
-                       mothurOut(" " + it->first + ":" + toString(it->second));
+                       m->mothurOut(" " + it->first + ":" + toString(it->second));
                }
-               mothurOut(" |");
+               m->mothurOut(" |");
                for(it=pcount.begin();it!=pcount.end();it++){
-                       mothurOut(" " + it->first + ":" + toString(it->second));
+                       m->mothurOut(" " + it->first + ":" + toString(it->second));
                }
-               mothurOutEndLine();
+               m->mothurOutEndLine();
                
                
        }
        catch(exception& e) {
-               errorOut(e, "Node", "printNode");
+               m->errorOut(e, "Node", "printNode");
                exit(1);
        }
 }
index c25806b7445cb90cc97ae45ab33d917a3981257e..029cee9419cf7adf88344d1635e5709196bd5c73 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 /* This class represents a node on a tree. */
 
@@ -58,6 +59,7 @@ class Node  {
                int                             lchild;
                int                             rchild;
                int                             vectorIndex;
+               MothurOut* m;
 };             
 
 #endif
index 70b1b4ae8a0c931ff3f84a56d4dd68fa1edd537a..1b5c7cf1416f9a8d4fe68ac3a1c6d7e751eb7d18 100644 (file)
@@ -11,7 +11,7 @@
 
 //***************************************************************************************************************
 
-TrimSeqsCommand::TrimSeqsCommand(string option){
+TrimSeqsCommand::TrimSeqsCommand(string option)  {
        try {
                
                abort = false;
@@ -70,7 +70,7 @@ TrimSeqsCommand::TrimSeqsCommand(string option){
                        
                        //check for required parameters
                        fastaFile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastaFile == "not found") { mothurOut("fasta is a required parameter for the screen.seqs command."); mothurOutEndLine(); abort = true; }
+                       if (fastaFile == "not found") { m->mothurOut("fasta is a required parameter for the screen.seqs command."); m->mothurOutEndLine(); abort = true; }
                        else if (fastaFile == "not open") { abort = true; }     
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -121,22 +121,22 @@ TrimSeqsCommand::TrimSeqsCommand(string option){
                        allFiles = isTrue(temp);
                        
                        if(allFiles && oligoFile == ""){
-                               mothurOut("You selected allfiles, but didn't enter an oligos file.  Ignoring the allfiles request."); mothurOutEndLine();
+                               m->mothurOut("You selected allfiles, but didn't enter an oligos file.  Ignoring the allfiles request."); m->mothurOutEndLine();
                        }
                        if((qAverage != 0 && qThreshold != 0) && qFileName == ""){
-                               mothurOut("You didn't provide a quality file name, quality criteria will be ignored."); mothurOutEndLine();
+                               m->mothurOut("You didn't provide a quality file name, quality criteria will be ignored."); m->mothurOutEndLine();
                                qAverage=0;
                                qThreshold=0;
                        }
                        if(!flip && oligoFile=="" && !maxLength && !minLength && (maxAmbig==-1) && !maxHomoP && qFileName == ""){               
-                               mothurOut("You didn't set any options... quiting command."); mothurOutEndLine();
+                               m->mothurOut("You didn't set any options... quiting command."); m->mothurOutEndLine();
                                abort = true;
                        }
                }
 
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "TrimSeqsCommand");
+               m->errorOut(e, "TrimSeqsCommand", "TrimSeqsCommand");
                exit(1);
        }
 }
@@ -144,30 +144,30 @@ TrimSeqsCommand::TrimSeqsCommand(string option){
 
 void TrimSeqsCommand::help(){
        try {
-               mothurOut("The trim.seqs command reads a fastaFile and creates .....\n");
-               mothurOut("The trim.seqs command parameters are fasta, flip, oligos, maxambig, maxhomop, minlength, maxlength, qfile, qthreshold, qaverage, qtrim and allfiles.\n");
-               mothurOut("The fasta parameter is required.\n");
-               mothurOut("The flip parameter .... The default is 0.\n");
-               mothurOut("The oligos parameter .... The default is "".\n");
-               mothurOut("The maxambig parameter .... The default is -1.\n");
-               mothurOut("The maxhomop parameter .... The default is 0.\n");
-               mothurOut("The minlength parameter .... The default is 0.\n");
-               mothurOut("The maxlength parameter .... The default is 0.\n");
-               mothurOut("The qfile parameter .....\n");
-               mothurOut("The qthreshold parameter .... The default is 0.\n");
-               mothurOut("The qaverage parameter .... The default is 0.\n");
-               mothurOut("The allfiles parameter .... The default is F.\n");
-               mothurOut("The qtrim parameter .... The default is F.\n");
-               mothurOut("The trim.seqs command should be in the following format: \n");
-               mothurOut("trim.seqs(fasta=yourFastaFile, flip=yourFlip, oligos=yourOligos, maxambig=yourMaxambig,  \n");
-               mothurOut("maxhomop=yourMaxhomop, minlength=youMinlength, maxlength=yourMaxlength)  \n");       
-               mothurOut("Example trim.seqs(fasta=abrecovery.fasta, flip=..., oligos=..., maxambig=..., maxhomop=..., minlength=..., maxlength=...).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n");
-               mothurOut("For more details please check out the wiki http://www.mothur.org/wiki/Trim.seqs .\n\n");
+               m->mothurOut("The trim.seqs command reads a fastaFile and creates .....\n");
+               m->mothurOut("The trim.seqs command parameters are fasta, flip, oligos, maxambig, maxhomop, minlength, maxlength, qfile, qthreshold, qaverage, qtrim and allfiles.\n");
+               m->mothurOut("The fasta parameter is required.\n");
+               m->mothurOut("The flip parameter .... The default is 0.\n");
+               m->mothurOut("The oligos parameter .... The default is "".\n");
+               m->mothurOut("The maxambig parameter .... The default is -1.\n");
+               m->mothurOut("The maxhomop parameter .... The default is 0.\n");
+               m->mothurOut("The minlength parameter .... The default is 0.\n");
+               m->mothurOut("The maxlength parameter .... The default is 0.\n");
+               m->mothurOut("The qfile parameter .....\n");
+               m->mothurOut("The qthreshold parameter .... The default is 0.\n");
+               m->mothurOut("The qaverage parameter .... The default is 0.\n");
+               m->mothurOut("The allfiles parameter .... The default is F.\n");
+               m->mothurOut("The qtrim parameter .... The default is F.\n");
+               m->mothurOut("The trim.seqs command should be in the following format: \n");
+               m->mothurOut("trim.seqs(fasta=yourFastaFile, flip=yourFlip, oligos=yourOligos, maxambig=yourMaxambig,  \n");
+               m->mothurOut("maxhomop=yourMaxhomop, minlength=youMinlength, maxlength=yourMaxlength)  \n");    
+               m->mothurOut("Example trim.seqs(fasta=abrecovery.fasta, flip=..., oligos=..., maxambig=..., maxhomop=..., minlength=..., maxlength=...).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n");
+               m->mothurOut("For more details please check out the wiki http://www.mothur.org/wiki/Trim.seqs .\n\n");
 
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "help");
+               m->errorOut(e, "TrimSeqsCommand", "help");
                exit(1);
        }
 }
@@ -184,6 +184,8 @@ int TrimSeqsCommand::execute(){
        
                if (abort == true) { return 0; }
                
+               vector<string> outputNames;
+               
                numFPrimers = 0;  //this needs to be initialized
                numRPrimers = 0;
                
@@ -193,18 +195,21 @@ int TrimSeqsCommand::execute(){
                ofstream outFASTA;
                string trimSeqFile = outputDir + getRootName(getSimpleName(fastaFile)) + "trim.fasta";
                openOutputFile(trimSeqFile, outFASTA);
+               outputNames.push_back(trimSeqFile);
                
                ofstream outGroups;
                vector<ofstream*> fastaFileNames;
                if(oligoFile != ""){
                        string groupFile = outputDir + getRootName(getSimpleName(fastaFile)) + "groups"; 
                        openOutputFile(groupFile, outGroups);
+                       outputNames.push_back(groupFile);
                        getOligos(fastaFileNames);
                }
                
                ofstream scrapFASTA;
                string scrapSeqFile = outputDir + getRootName(getSimpleName(fastaFile)) + "scrap.fasta";
                openOutputFile(scrapSeqFile, scrapFASTA);
+               outputNames.push_back(scrapSeqFile);
                
                ifstream qFile;
                if(qFileName != "")     {       openInputFile(qFileName, qFile);        }
@@ -293,6 +298,7 @@ int TrimSeqsCommand::execute(){
                        openInputFile(getRootName(fastaFile) + groupVector[i] + ".fasta", inFASTA);
                        ofstream outGroups;
                        openOutputFile(outputDir + getRootName(getSimpleName(fastaFile)) + groupVector[i] + ".groups", outGroups);
+                       outputNames.push_back(outputDir + getRootName(getSimpleName(fastaFile)) + groupVector[i] + ".groups");
                        
                        while(!inFASTA.eof()){
                                if(inFASTA.get() == '>'){
@@ -304,11 +310,16 @@ int TrimSeqsCommand::execute(){
                        outGroups.close();
                        inFASTA.close();
                }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
                        
                return 0;               
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "execute");
+               m->errorOut(e, "TrimSeqsCommand", "execute");
                exit(1);
        }
 }
@@ -366,7 +377,7 @@ void TrimSeqsCommand::getOligos(vector<ofstream*>& outFASTAVec){
                
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "getOligos");
+               m->errorOut(e, "TrimSeqsCommand", "getOligos");
                exit(1);
        }
 
@@ -397,7 +408,7 @@ bool TrimSeqsCommand::stripBarcode(Sequence& seq, int& group){
                
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "stripBarcode");
+               m->errorOut(e, "TrimSeqsCommand", "stripBarcode");
                exit(1);
        }
 
@@ -429,7 +440,7 @@ bool TrimSeqsCommand::stripForward(Sequence& seq){
                
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "stripForward");
+               m->errorOut(e, "TrimSeqsCommand", "stripForward");
                exit(1);
        }
 }
@@ -459,7 +470,7 @@ bool TrimSeqsCommand::stripReverse(Sequence& seq){
                
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "stripReverse");
+               m->errorOut(e, "TrimSeqsCommand", "stripReverse");
                exit(1);
        }
 }
@@ -480,7 +491,7 @@ bool TrimSeqsCommand::cullLength(Sequence& seq){
        
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "cullLength");
+               m->errorOut(e, "TrimSeqsCommand", "cullLength");
                exit(1);
        }
        
@@ -499,7 +510,7 @@ bool TrimSeqsCommand::cullHomoP(Sequence& seq){
                return success;
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "cullHomoP");
+               m->errorOut(e, "TrimSeqsCommand", "cullHomoP");
                exit(1);
        }
        
@@ -518,7 +529,7 @@ bool TrimSeqsCommand::cullAmbigs(Sequence& seq){
                return success;
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "cullAmbigs");
+               m->errorOut(e, "TrimSeqsCommand", "cullAmbigs");
                exit(1);
        }
        
@@ -557,7 +568,7 @@ bool TrimSeqsCommand::compareDNASeq(string oligo, string seq){
                return success;
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "compareDNASeq");
+               m->errorOut(e, "TrimSeqsCommand", "compareDNASeq");
                exit(1);
        }
 
@@ -572,7 +583,7 @@ bool TrimSeqsCommand::stripQualThreshold(Sequence& seq, ifstream& qFile){
                string name;
                
                qFile >> name;
-               if (name.length() != 0) {  if(name.substr(1) != seq.getName())  {       mothurOut("sequence name mismatch btwn fasta and qual file"); mothurOutEndLine();       }  } 
+               if (name.length() != 0) {  if(name.substr(1) != seq.getName())  {       m->mothurOut("sequence name mismatch btwn fasta and qual file"); m->mothurOutEndLine(); }  } 
                while (!qFile.eof())    {       char c = qFile.get(); if (c == 10 || c == 13){  break;  }       }
                
                int score;
@@ -595,7 +606,7 @@ bool TrimSeqsCommand::stripQualThreshold(Sequence& seq, ifstream& qFile){
                return 1;
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "stripQualThreshold");
+               m->errorOut(e, "TrimSeqsCommand", "stripQualThreshold");
                exit(1);
        }
 }
@@ -610,7 +621,7 @@ bool TrimSeqsCommand::cullQualAverage(Sequence& seq, ifstream& qFile){
                string name;
                
                qFile >> name;
-               if (name[0] == '>') {  if(name.substr(1) != seq.getName())      {       mothurOut("sequence name mismatch btwn fasta: " + seq.getName() + " and qual file: " + name); mothurOutEndLine();       } }
+               if (name[0] == '>') {  if(name.substr(1) != seq.getName())      {       m->mothurOut("sequence name mismatch btwn fasta: " + seq.getName() + " and qual file: " + name); m->mothurOutEndLine(); } }
                
                while (!qFile.eof())    {       char c = qFile.get(); if (c == 10 || c == 13){  break;  }       }
                
@@ -629,7 +640,7 @@ bool TrimSeqsCommand::cullQualAverage(Sequence& seq, ifstream& qFile){
                return success;
        }
        catch(exception& e) {
-               errorOut(e, "TrimSeqsCommand", "cullQualAverage");
+               m->errorOut(e, "TrimSeqsCommand", "cullQualAverage");
                exit(1);
        }
 }
index 957a4aaab458d5f65256d8f9bf43579ad383d493..01f6f98fceb7349fdaf9ccdce53afdf60aaff42c 100644 (file)
 #include "unifracunweightedcommand.h"
 
 /***********************************************************/
-UnifracUnweightedCommand::UnifracUnweightedCommand(string option) {
+UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                Groups.clear();
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -35,7 +35,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option) {
                        }
                        
                        if (globaldata->gTree.size() == 0) {//no trees were read
-                               mothurOut("You must execute the read.tree command, before you may execute the unifrac.unweighted command."); mothurOutEndLine(); abort = true;  }
+                               m->mothurOut("You must execute the read.tree command, before you may execute the unifrac.unweighted command."); m->mothurOutEndLine(); abort = true;  }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -74,6 +74,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option) {
                                T = globaldata->gTree;
                                tmap = globaldata->gTreemap;
                                sumFile = outputDir + getSimpleName(globaldata->getTreeFile()) + ".uwsummary";
+                               outputNames.push_back(sumFile);
                                openOutputFile(sumFile, outSum);
                                
                                util = new SharedUtil();
@@ -90,7 +91,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option) {
                
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "UnifracUnweightedCommand");
+               m->errorOut(e, "UnifracUnweightedCommand", "UnifracUnweightedCommand");
                exit(1);
        }
 }
@@ -99,20 +100,20 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option) {
 
 void UnifracUnweightedCommand::help(){
        try {
-               mothurOut("The unifrac.unweighted command can only be executed after a successful read.tree command.\n");
-               mothurOut("The unifrac.unweighted command parameters are groups, iters, distance and random.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 1 valid group.\n");
-               mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
-               mothurOut("The distance parameter allows you to create a distance file from the results. The default is false.\n");
-               mothurOut("The random parameter allows you to shut off the comparison to random trees. The default is true, meaning compare your trees with randomly generated trees.\n");
-               mothurOut("The unifrac.unweighted command should be in the following format: unifrac.unweighted(groups=yourGroups, iters=yourIters).\n");
-               mothurOut("Example unifrac.unweighted(groups=A-B-C, iters=500).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, and iters is 1000.\n");
-               mothurOut("The unifrac.unweighted command output two files: .unweighted and .uwsummary their descriptions are in the manual.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The unifrac.unweighted command can only be executed after a successful read.tree command.\n");
+               m->mothurOut("The unifrac.unweighted command parameters are groups, iters, distance and random.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 1 valid group.\n");
+               m->mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
+               m->mothurOut("The distance parameter allows you to create a distance file from the results. The default is false.\n");
+               m->mothurOut("The random parameter allows you to shut off the comparison to random trees. The default is true, meaning compare your trees with randomly generated trees.\n");
+               m->mothurOut("The unifrac.unweighted command should be in the following format: unifrac.unweighted(groups=yourGroups, iters=yourIters).\n");
+               m->mothurOut("Example unifrac.unweighted(groups=A-B-C, iters=500).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, and iters is 1000.\n");
+               m->mothurOut("The unifrac.unweighted command output two files: .unweighted and .uwsummary their descriptions are in the manual.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "help");
+               m->errorOut(e, "UnifracUnweightedCommand", "help");
                exit(1);
        }
 }
@@ -129,13 +130,16 @@ int UnifracUnweightedCommand::execute() {
                //create new tree with same num nodes and leaves as users
                
                outSum << "Tree#" << '\t' << "Groups" << '\t'  <<  "UWScore" <<'\t' << "UWSig" <<  endl;
-               mothurOut("Tree#\tGroups\tUWScore\tUWSig"); mothurOutEndLine();
+               m->mothurOut("Tree#\tGroups\tUWScore\tUWSig"); m->mothurOutEndLine();
                
                //get pscores for users trees
                for (int i = 0; i < T.size(); i++) {
                        counter = 0;
                        
-                       if (random)  {  output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".unweighted", itersString);  }
+                       if (random)  {  
+                               output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".unweighted", itersString);
+                               outputNames.push_back(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".unweighted");
+                       }
                        
                        //get unweighted for users tree
                        rscoreFreq.resize(numComp);  
@@ -205,11 +209,16 @@ int UnifracUnweightedCommand::execute() {
                globaldata->Groups.clear(); 
                outSum.close();
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "execute");
+               m->errorOut(e, "UnifracUnweightedCommand", "execute");
                exit(1);
        }
 }
@@ -234,7 +243,7 @@ void UnifracUnweightedCommand::printUnweightedFile() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "printUnweightedFile");
+               m->errorOut(e, "UnifracUnweightedCommand", "printUnweightedFile");
                exit(1);
        }
 }
@@ -250,28 +259,28 @@ void UnifracUnweightedCommand::printUWSummaryFile(int i) {
 
                for(int a = 0; a < numComp; a++) {
                        outSum << i+1 << '\t';
-                       mothurOut(toString(i+1) + "\t");
+                       m->mothurOut(toString(i+1) + "\t");
                        
                        if (random) {
                                if (UWScoreSig[a][0] > (1/(float)iters)) {
                                        outSum << setprecision(6) << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(itersString.length()) << UWScoreSig[a][0] << endl;
                                        cout << setprecision(6)  << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(itersString.length()) << UWScoreSig[a][0] << endl; 
-                                       mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t" + toString(UWScoreSig[a][0])); mothurOutEndLine(); 
+                                       m->mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t" + toString(UWScoreSig[a][0])); m->mothurOutEndLine(); 
                                }else {
                                        outSum << setprecision(6) << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl;
                                        cout << setprecision(6)  << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl; 
-                                       mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t<" + toString((1/float(iters)))); mothurOutEndLine();
+                                       m->mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t<" + toString((1/float(iters)))); m->mothurOutEndLine();
                                }
                        }else{
                                outSum << setprecision(6) << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << "0.00" << endl;
                                cout << setprecision(6)  << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << "0.00" << endl; 
-                               mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t0.00"); mothurOutEndLine();
+                               m->mothurOutJustToLog(groupComb[a]  + "\t" + toString(utreeScores[a][0])  + "\t0.00"); m->mothurOutEndLine();
                        }
                }
                
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "printUWSummaryFile");
+               m->errorOut(e, "UnifracUnweightedCommand", "printUWSummaryFile");
                exit(1);
        }
 }
@@ -279,6 +288,8 @@ void UnifracUnweightedCommand::printUWSummaryFile(int i) {
 void UnifracUnweightedCommand::createPhylipFile(int i) {
        try {
                string phylipFileName = outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".unweighted.dist";
+               outputNames.push_back(phylipFileName);
+               
                ofstream out;
                openOutputFile(phylipFileName, out);
                        
@@ -317,7 +328,7 @@ void UnifracUnweightedCommand::createPhylipFile(int i) {
                out.close();
        }
        catch(exception& e) {
-               errorOut(e, "UnifracUnweightedCommand", "createPhylipFile");
+               m->errorOut(e, "UnifracUnweightedCommand", "createPhylipFile");
                exit(1);
        }
 }
index c98abc48d748be4dcbb8928283d808b118db29b8..c6fc46ac0bce0437b2d04315442fcf33e045b4d3 100644 (file)
@@ -47,7 +47,7 @@ class UnifracUnweightedCommand : public Command {
                
                bool abort, phylip, random;
                string groups, itersString, outputDir;
-               vector<string> Groups; //holds groups to be used
+               vector<string> Groups, outputNames; //holds groups to be used
 
                ofstream outSum, out;
                ifstream inFile;
index a9f9570e771b7c45c95f96e9a162ddc9ec8dfdb8..3c6c037147c3fb0a1a3da670dfaed6b63c2767e7 100644 (file)
@@ -15,7 +15,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                globaldata = GlobalData::getInstance();
                abort = false;
                Groups.clear();
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -35,7 +35,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        }
                        
                        if (globaldata->gTree.size() == 0) {//no trees were read
-                               mothurOut("You must execute the read.tree command, before you may execute the unifrac.weighted command."); mothurOutEndLine(); abort = true;  }
+                               m->mothurOut("You must execute the read.tree command, before you may execute the unifrac.weighted command."); m->mothurOutEndLine(); abort = true;  }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -69,6 +69,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                                tmap = globaldata->gTreemap;
                                sumFile = outputDir + getSimpleName(globaldata->getTreeFile()) + ".wsummary";
                                openOutputFile(sumFile, outSum);
+                               outputNames.push_back(sumFile);
                                
                                util = new SharedUtil();
                                string s; //to make work with setgroups
@@ -83,7 +84,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "UnifracWeightedCommand");
+               m->errorOut(e, "UnifracWeightedCommand", "UnifracWeightedCommand");
                exit(1);
        }
 }
@@ -91,20 +92,20 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
 
 void UnifracWeightedCommand::help(){
        try {
-               mothurOut("The unifrac.weighted command can only be executed after a successful read.tree command.\n");
-               mothurOut("The unifrac.weighted command parameters are groups, iters, distance and random.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
-               mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
-               mothurOut("The distance parameter allows you to create a distance file from the results. The default is false.\n");
-               mothurOut("The random parameter allows you to shut off the comparison to random trees. The default is true, meaning compare your trees with randomly generated trees.\n");
-               mothurOut("The unifrac.weighted command should be in the following format: unifrac.weighted(groups=yourGroups, iters=yourIters).\n");
-               mothurOut("Example unifrac.weighted(groups=A-B-C, iters=500).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile, and iters is 1000.\n");
-               mothurOut("The unifrac.weighted command output two files: .weighted and .wsummary their descriptions are in the manual.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The unifrac.weighted command can only be executed after a successful read.tree command.\n");
+               m->mothurOut("The unifrac.weighted command parameters are groups, iters, distance and random.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
+               m->mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
+               m->mothurOut("The distance parameter allows you to create a distance file from the results. The default is false.\n");
+               m->mothurOut("The random parameter allows you to shut off the comparison to random trees. The default is true, meaning compare your trees with randomly generated trees.\n");
+               m->mothurOut("The unifrac.weighted command should be in the following format: unifrac.weighted(groups=yourGroups, iters=yourIters).\n");
+               m->mothurOut("Example unifrac.weighted(groups=A-B-C, iters=500).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile, and iters is 1000.\n");
+               m->mothurOut("The unifrac.weighted command output two files: .weighted and .wsummary their descriptions are in the manual.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "help");
+               m->errorOut(e, "UnifracWeightedCommand", "help");
                exit(1);
        }
 }
@@ -131,7 +132,10 @@ int UnifracWeightedCommand::execute() {
                        rScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
                        uScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
                        
-                       if (random) {  output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted", itersString);  } 
+                       if (random) {  
+                               output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted", itersString);  
+                               outputNames.push_back(outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted");
+                       } 
 
                        userData = weighted->getValues(T[i]);  //userData[0] = weightedscore
                        
@@ -179,7 +183,7 @@ int UnifracWeightedCommand::execute() {
                                        //so if you have 1000 random trees the index returned is 100 
                                        //then there are 900 trees with a score greater then you. 
                                        //giving you a signifigance of 0.900
-                                       int index = findIndex(userData[f], f);    if (index == -1) { mothurOut("error in UnifracWeightedCommand"); mothurOutEndLine(); exit(1); } //error code
+                                       int index = findIndex(userData[f], f);    if (index == -1) { m->mothurOut("error in UnifracWeightedCommand"); m->mothurOutEndLine(); exit(1); } //error code
                                        
                                        //the signifigance is the number of trees with the users score or higher 
                                        WScoreSig.push_back((iters-index)/(float)iters);
@@ -210,11 +214,16 @@ int UnifracWeightedCommand::execute() {
                
                delete randT;
                
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+               
                return 0;
                
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "execute");
+               m->errorOut(e, "UnifracWeightedCommand", "execute");
                exit(1);
        }
 }
@@ -237,7 +246,7 @@ void UnifracWeightedCommand::printWeightedFile() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "printWeightedFile");
+               m->errorOut(e, "UnifracWeightedCommand", "printWeightedFile");
                exit(1);
        }
 }
@@ -248,7 +257,7 @@ void UnifracWeightedCommand::printWSummaryFile() {
        try {
                //column headers
                outSum << "Tree#" << '\t' << "Groups" << '\t' << "WScore" << '\t' << "WSig" <<  endl;
-               mothurOut("Tree#\tGroups\tWScore\tWSig"); mothurOutEndLine(); 
+               m->mothurOut("Tree#\tGroups\tWScore\tWSig"); m->mothurOutEndLine(); 
                
                //format output
                outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
@@ -261,16 +270,16 @@ void UnifracWeightedCommand::printWSummaryFile() {
                                        if (WScoreSig[count] > (1/(float)iters)) {
                                                outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << WScoreSig[count] << endl; 
                                                cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << WScoreSig[count] << endl; 
-                                               mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t" +  toString(WScoreSig[count])); mothurOutEndLine();  
+                                               m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t" +  toString(WScoreSig[count])); m->mothurOutEndLine();  
                                        }else{
                                                outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl; 
                                                cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl; 
-                                               mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t<" +  toString((1/float(iters)))); mothurOutEndLine();  
+                                               m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t<" +  toString((1/float(iters)))); m->mothurOutEndLine();  
                                        }
                                }else{
                                        outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "0.00" << endl; 
                                        cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "0.00" << endl; 
-                                       mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t0.00"); mothurOutEndLine(); 
+                                       m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t0.00"); m->mothurOutEndLine(); 
                                }
                                count++;
                        }
@@ -278,7 +287,7 @@ void UnifracWeightedCommand::printWSummaryFile() {
                outSum.close();
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "printWSummaryFile");
+               m->errorOut(e, "UnifracWeightedCommand", "printWSummaryFile");
                exit(1);
        }
 }
@@ -290,6 +299,7 @@ void UnifracWeightedCommand::createPhylipFile() {
                for (int i = 0; i < T.size(); i++) { 
                
                        string phylipFileName = outputDir + getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted.dist";
+                       outputNames.push_back(phylipFileName);
                        ofstream out;
                        openOutputFile(phylipFileName, out);
                        
@@ -328,7 +338,7 @@ void UnifracWeightedCommand::createPhylipFile() {
                }
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "createPhylipFile");
+               m->errorOut(e, "UnifracWeightedCommand", "createPhylipFile");
                exit(1);
        }
 }
@@ -341,7 +351,7 @@ int UnifracWeightedCommand::findIndex(float score, int index) {
                return rScores[index].size();
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "findIndex");
+               m->errorOut(e, "UnifracWeightedCommand", "findIndex");
                exit(1);
        }
 }
@@ -386,7 +396,7 @@ void UnifracWeightedCommand::calculateFreqsCumuls() {
 
        }
        catch(exception& e) {
-               errorOut(e, "UnifracWeightedCommand", "calculateFreqsCums");
+               m->errorOut(e, "UnifracWeightedCommand", "calculateFreqsCums");
                exit(1);
        }
 }
index c36152d107d894c4e26c857ce3508e4780ae06ef..77dd10d3490999def3789b91d405ac76e470f360 100644 (file)
@@ -23,7 +23,7 @@ class GlobalData;
 class UnifracWeightedCommand : public Command {
        
        public:
-               UnifracWeightedCommand(string); 
+               UnifracWeightedCommand(string);
                ~UnifracWeightedCommand() { if (abort == false) {  delete weighted; delete util; } }
                int execute();  
                void help();
@@ -51,7 +51,7 @@ class UnifracWeightedCommand : public Command {
                
                bool abort, phylip, random;
                string groups, itersString;
-               vector<string> Groups; //holds groups to be used
+               vector<string> Groups, outputNames; //holds groups to be used
 
                
                ofstream outSum;
index e6ed0eb83e7a71d2fd34e4b0fc7627c1368b5d6e..5bf6ee3616fb39f6d9ea4a3b4d048e45962f6c33 100644 (file)
@@ -132,7 +132,7 @@ EstOutput Unweighted::getValues(Tree* t) {
        
        }
        catch(exception& e) {
-               errorOut(e, "Unweighted", "getValues");
+               m->errorOut(e, "Unweighted", "getValues");
                exit(1);
        }
 }
@@ -277,7 +277,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB) {
        
        }
        catch(exception& e) {
-               errorOut(e, "Unweighted", "getValues");
+               m->errorOut(e, "Unweighted", "getValues");
                exit(1);
        }
 }
index afc602284e7aadb41c9859441157588ec21b6198..8aa166610a3b7d3a38bfd882db6206d6982af4de 100644 (file)
--- a/uvest.cpp
+++ b/uvest.cpp
@@ -80,7 +80,7 @@ EstOutput UVEst::getUVest(vector<SharedRAbundVector*> shared) {
                return results;
        }
        catch(exception& e) {
-               errorOut(e, "UVEst", "getUVest");
+               m->errorOut(e, "UVEst", "getUVest");
                exit(1);
        }
 }
diff --git a/uvest.h b/uvest.h
index 86b96fd43095017afaf2db453ff8523191652708..384e80c3e54102635022b62aec12e4a66ee81289 100644 (file)
--- a/uvest.h
+++ b/uvest.h
@@ -21,7 +21,10 @@ typedef vector<double> EstOutput;
 /***********************************************************************/
 class UVEst {
        public:
-               EstOutput getUVest(vector<SharedRAbundVector*>);                
+               UVEst() { m = MothurOut::getInstance(); }
+               EstOutput getUVest(vector<SharedRAbundVector*>);        
+       private:
+               MothurOut* m;
 };
 /***********************************************************************/
 
index 504eb7103ee7e59c998cb438f520f3204a970c29..0ade87338bb9c2b264f99200a3c7e09fac3fdd12 100644 (file)
@@ -12,6 +12,8 @@
 /********************************************************************/
 ValidCalculators::ValidCalculators() {
        try {
+                m = MothurOut::getInstance();
+               
                 initialSingle();
                 initialShared();
                 initialRarefaction();
@@ -27,7 +29,7 @@ ValidCalculators::ValidCalculators() {
                 initialHeat();
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "ValidCalculator");
+               m->errorOut(e, "ValidCalculator", "ValidCalculator");
                exit(1);
        }
 }
@@ -46,11 +48,11 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((single.find(calculator)) != (single.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
                                for (it = single.begin(); it != single.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                //are you looking for a calculator for a shared parameter
                }else if (parameter == "shared") {
@@ -58,11 +60,11 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((shared.find(calculator)) != (shared.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator +  " is not a valid estimator for the collect.shared command and will be disregarded.  Valid estimators are ");
+                               m->mothurOut(calculator +  " is not a valid estimator for the collect.shared command and will be disregarded.  Valid estimators are ");
                                for (it = shared.begin(); it != shared.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                //are you looking for a calculator for a rarefaction parameter
                }else if (parameter == "rarefaction") {
@@ -70,11 +72,11 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((rarefaction.find(calculator)) != (rarefaction.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
                                for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                //are you looking for a calculator for a summary parameter
                }else if (parameter == "summary") {
@@ -82,11 +84,11 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((summary.find(calculator)) != (summary.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
                                for (it = summary.begin(); it != summary.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                //are you looking for a calculator for a sharedsummary parameter
                }else if (parameter == "sharedsummary") {
@@ -94,106 +96,106 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator +  " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator +  " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
                                for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "sharedrarefaction") {
                        //is it valid
                        if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
+                               m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
                                for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "vennsingle") {
                        //is it valid
                        if ((vennsingle.find(calculator)) != (vennsingle.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
                                for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "vennshared") {
                        //is it valid
                        if ((vennshared.find(calculator)) != (vennshared.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
                                for (it = vennshared.begin(); it != vennshared.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "treegroup") {
                        //is it valid
                        if ((treegroup.find(calculator)) != (treegroup.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
                                for (it = treegroup.begin(); it != treegroup.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "matrix") {
                        //is it valid
                        if ((matrix.find(calculator)) != (matrix.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator +  " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator +  " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
                                for (it = matrix.begin(); it != matrix.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "heat") {
                        //is it valid
                        if ((heat.find(calculator)) != (heat.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
                                for (it = heat.begin(); it != heat.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "boot") {
                        //is it valid
                        if ((boot.find(calculator)) != (boot.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
+                               m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
                                for (it = boot.begin(); it != boot.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                }else if (parameter == "distance") {
                        //is it valid
                        if ((distance.find(calculator)) != (distance.end())) {
                                return true;
                        }else { 
-                               mothurOut(calculator +  " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
+                               m->mothurOut(calculator +  " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
                                for (it = distance.begin(); it != distance.end(); it++) {
-                                       mothurOut(it->first + ", ");
+                                       m->mothurOut(it->first + ", ");
                                }
-                               mothurOutEndLine();
+                               m->mothurOutEndLine();
                                return false; }
                //not a valid parameter
                }else { return false; }
                
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "isValidCalculator");
+               m->errorOut(e, "ValidCalculator", "isValidCalculator");
                exit(1);
        }
 }
@@ -224,7 +226,7 @@ void ValidCalculators::initialSingle() {
                single["default"]           = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialSingle");
+               m->errorOut(e, "ValidCalculator", "initialSingle");
                exit(1);
        }
 }
@@ -256,7 +258,7 @@ void ValidCalculators::initialShared() {
                shared["default"]                   = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialShared");
+               m->errorOut(e, "ValidCalculator", "initialShared");
                exit(1);
        }
 }
@@ -277,7 +279,7 @@ void ValidCalculators::initialRarefaction() {
                rarefaction["default"]      = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialRarefaction");
+               m->errorOut(e, "ValidCalculator", "initialRarefaction");
                exit(1);
        }
 }
@@ -309,7 +311,7 @@ void ValidCalculators::initialSummary() {
                summary["default"]          = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialSummary");
+               m->errorOut(e, "ValidCalculator", "initialSummary");
                exit(1);
        }
 }
@@ -341,7 +343,7 @@ void ValidCalculators::initialSharedSummary() {
                sharedsummary["default"]                                = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialSharedSummary");
+               m->errorOut(e, "ValidCalculator", "initialSharedSummary");
                exit(1);
        }
 }
@@ -356,7 +358,7 @@ void ValidCalculators::initialSharedRarefact() {
                sharedrarefaction["default"]        = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialSharedRarefact");
+               m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
                exit(1);
        }
 }
@@ -372,7 +374,7 @@ void ValidCalculators::initialVennSingle() {
                vennsingle["default"]           = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialVennSingle");
+               m->errorOut(e, "ValidCalculator", "initialVennSingle");
                exit(1);
        }
 }
@@ -386,7 +388,7 @@ void ValidCalculators::initialVennShared() {
                vennshared["default"]           = "default";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialVennShared");
+               m->errorOut(e, "ValidCalculator", "initialVennShared");
                exit(1);
        }
 }
@@ -406,7 +408,7 @@ void ValidCalculators::initialTreeGroups() {
                treegroup["braycurtis"]                         = "braycurtis";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialTreeGroups");
+               m->errorOut(e, "ValidCalculator", "initialTreeGroups");
                exit(1);
        }
 }
@@ -425,7 +427,7 @@ void ValidCalculators::initialHeat() {
                heat["braycurtis"]                      = "braycurtis";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialHeat");
+               m->errorOut(e, "ValidCalculator", "initialHeat");
                exit(1);
        }
 }
@@ -445,7 +447,7 @@ void ValidCalculators::initialMatrix() {
                matrix["braycurtis"]                    = "braycurtis";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialMatrix");
+               m->errorOut(e, "ValidCalculator", "initialMatrix");
                exit(1);
        }
 }
@@ -465,7 +467,7 @@ void ValidCalculators::initialBoot() {
                boot["braycurtis"]                      = "braycurtis";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialBoot");
+               m->errorOut(e, "ValidCalculator", "initialBoot");
                exit(1);
        }
 }
@@ -477,7 +479,7 @@ void ValidCalculators::initialDistance() {
                distance["onegap"]              = "onegap";
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "initialDistance");
+               m->errorOut(e, "ValidCalculator", "initialDistance");
                exit(1);
        }
 }
@@ -548,7 +550,7 @@ void ValidCalculators::printCalc(string parameter, ostream& out) {
                out << endl;
        }
        catch(exception& e) {
-               errorOut(e, "ValidCalculator", "printCalc");
+               m->errorOut(e, "ValidCalculator", "printCalc");
                exit(1);
        }
 }
index 320f9822662f842faecec103ef29ba75495e77af..bf8819f4f317df5337c75975afd2e165ce376bcd 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 //This class contains a list of all valid calculators in Mothur.  
 //It has a function which will tell you if your calculator is valid for the given parameter.
@@ -53,6 +54,8 @@ class ValidCalculators {
                void initialBoot();
                void initialDistance();
                void initialHeat();
+               
+               MothurOut* m;
 };
 
 #endif
index a978f0fae0f4e357978898bb218adae100e51111..0c32a3e1c7b00e9fa90c8a5e4ca7fb759238c9e2 100644 (file)
 
 ValidParameters::ValidParameters() {
        try {
+               m = MothurOut::getInstance();
                initParameterRanges();
        }
        catch(exception& e) {
-               errorOut(e, "ValidParameters", "ValidParameters");
+               m->errorOut(e, "ValidParameters", "ValidParameters");
                exit(1);
        }
 }
@@ -38,11 +39,11 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                        }
                }
                if(!valid) {
-                       mothurOut(parameter + " is not a valid parameter."); mothurOutEndLine();
-                       mothurOut("The valid parameters are: ");
+                       m->mothurOut(parameter + " is not a valid parameter."); m->mothurOutEndLine();
+                       m->mothurOut("The valid parameters are: ");
                        for(int i = 0; i < numParams-1; i++)
-                               mothurOut(cParams.at(i) + ", ");
-                       mothurOut("and " + cParams.at(numParams-1) + ".\n");
+                               m->mothurOut(cParams.at(i) + ", ");
+                       m->mothurOut("and " + cParams.at(numParams-1) + ".\n");
                        return false;
                }
                
@@ -73,7 +74,7 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                                double logNum = log10((double)pVal);
                                double diff = (double)((int)logNum - logNum);
                                if(diff != 0) {
-                                       mothurOut("The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n");
+                                       m->mothurOut("The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n");
                                        return false;
                                }
                        }
@@ -99,7 +100,7 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                        else if(range.at(4).compare("only") == 0)
                                c = 1;
                        else {
-                               mothurOut("The range can only be 'between' or 'only' the bounding numbers.\n");
+                               m->mothurOut("The range can only be 'between' or 'only' the bounding numbers.\n");
                                return false;
                        }
                        
@@ -108,7 +109,7 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                        else if(range.at(0).compare(">=") == 0 || range[3].compare("=>") == 0)
                                d = 1;
                        else {
-                               mothurOut("The parameter value can only be '>', '>=', or '=>' the lower bounding number.\n");
+                               m->mothurOut("The parameter value can only be '>', '>=', or '=>' the lower bounding number.\n");
                                return false;
                        }
                        
@@ -117,7 +118,7 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                        else if(range.at(2).compare("<=") == 0 || range[4].compare("=<") == 0)
                                e = 1;
                        else {
-                               mothurOut("The parameter value can only be '<', '<=', or '=<' the upper bounding number.\n");
+                               m->mothurOut("The parameter value can only be '<', '<=', or '=<' the upper bounding number.\n");
                                return false;
                        }
                        
@@ -161,25 +162,25 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                        
                        
                        if(!valid) {
-                               mothurOut("The '" + parameter + "' parameter needs to be ");
+                               m->mothurOut("The '" + parameter + "' parameter needs to be ");
                                if(c == 1)
-                                       mothurOut("either '" + toString(a) + "' or '" + toString(b) + "'.\n");
+                                       m->mothurOut("either '" + toString(a) + "' or '" + toString(b) + "'.\n");
                                else {
                                        if(a != piSentinel) {
-                                               mothurOut(">");
+                                               m->mothurOut(">");
                                                if(d != 0)
-                                                       mothurOut("=");
-                                               mothurOut(" '" + toString(a) + "'");
+                                                       m->mothurOut("=");
+                                               m->mothurOut(" '" + toString(a) + "'");
                                        }
                                        if(b == piSentinel)
-                                               mothurOut( "'.\n");
+                                               m->mothurOut( "'.\n");
                                        else if(a != piSentinel)
-                                               mothurOut(" and ");
+                                               m->mothurOut(" and ");
                                        if(b != piSentinel) {
-                                               mothurOut("<");
+                                               m->mothurOut("<");
                                                if(e != 0)
-                                                       mothurOut("=");
-                                               mothurOut(" '" + toString(b) + "'.\n");
+                                                       m->mothurOut("=");
+                                               m->mothurOut(" '" + toString(b) + "'.\n");
                                        }
                                }
                                return false;
@@ -188,7 +189,7 @@ bool ValidParameters::isValidParameter(string parameter, vector<string> cParams,
                return true;
        }
        catch(exception& e) {
-               errorOut(e, "ValidParameters", "isValidParameters");
+               m->errorOut(e, "ValidParameters", "isValidParameters");
                exit(1);
        }
 }
@@ -218,7 +219,7 @@ string ValidParameters::validFile(map<string, string> container, string paramete
        
        }
        catch(exception& e) {
-               errorOut(e, "ValidParameters", "validFile");
+               m->errorOut(e, "ValidParameters", "validFile");
                exit(1);
        }
 }
@@ -263,7 +264,7 @@ void ValidParameters::initParameterRanges() {
                parameterRanges["size"] = addParameters(sizeArray, rangeSize);
        }
        catch(exception& e) {
-               errorOut(e, "ValidParameters", "initParameterRanges");
+               m->errorOut(e, "ValidParameters", "initParameterRanges");
                exit(1);
        }
 }
@@ -277,7 +278,7 @@ vector<string> ValidParameters::addParameters(string parameters[], int size) {
                return pVector;
        }
        catch(exception& e) {
-               errorOut(e, "ValidParameters", "addParameters");
+               m->errorOut(e, "ValidParameters", "addParameters");
                exit(1);
        }
 }
index 5007948ae1e556b5f7a2a6fe13eeb030ab899909..9aeafa23a6b03f619393cc502e2c1fade566ee2a 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "mothur.h"
+#include "mothurout.h"
 
 //This class contains a list of all valid parameters in Mothur.  
 //It has a function which will tell you if your parameter is valid.
@@ -31,6 +32,7 @@ class ValidParameters {
        private:
                map<string, string>::iterator it;
                map<string, vector<string> > parameterRanges;
+               MothurOut* m;
 
 };
 
index 986c68db1f4942e8242aef7514f78441ef0e37e0..43129f5e2d8713e1608be534915cbe61276d1ea5 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
 Venn::Venn(string o) : outputDir(o) {
        try {
                globaldata = GlobalData::getInstance();
+               m = MothurOut::getInstance();
 
        }
        catch(exception& e) {
-               errorOut(e, "Venn", "Venn");
+               m->errorOut(e, "Venn", "Venn");
                exit(1);
        }
 }
 //**********************************************************************************************************************
-void Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
+vector<string> Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
        try {
-                               
+               
+               vector<string> outputNames;
+               
                for(int i=0;i<vCalcs.size();i++){
                        string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + ".venn." + sabund->getLabel() + vCalcs[i]->getName() + ".svg";
+                       outputNames.push_back(filenamesvg);
                        openOutputFile(filenamesvg, outsvg);
 
                        vector<double> data = vCalcs[i]->getValues(sabund);
@@ -53,17 +57,20 @@ void Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
                        outsvg << "</g>\n</svg>\n";
                        outsvg.close();
                }
+               
+               return outputNames;
        }
        catch(exception& e) {
-               errorOut(e, "Venn", "getPic");
+               m->errorOut(e, "Venn", "getPic");
                exit(1);
        }
 }
 //**********************************************************************************************************************
-void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs) {
+vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs) {
        try {
                
                vector<SharedRAbundVector*> subset;
+               vector<string> outputNames;
                
                /******************* 1 Group **************************/
                if (lookup.size() == 1) {
@@ -74,6 +81,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                                string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+                               outputNames.push_back(filenamesvg);
                                openOutputFile(filenamesvg, outsvg);
                        
                                //in essence you want to run it like a single 
@@ -123,6 +131,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                                string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+                               outputNames.push_back(filenamesvg);
                                openOutputFile(filenamesvg, outsvg);
                                
                                //get estimates for sharedAB
@@ -190,8 +199,8 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                        
-                                                                                               
                                string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+                               outputNames.push_back(filenamesvg);
                                openOutputFile(filenamesvg, outsvg);
                                
                                if (vCalcs[i]->getName() == "sharedace") {
@@ -444,9 +453,10 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                                
-                               if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao")) { mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups.  It will be disregarded. "); mothurOutEndLine(); }
+                               if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao")) { m->mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups.  It will be disregarded. "); m->mothurOutEndLine(); }
                                else{
                                        string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+                                       outputNames.push_back(filenamesvg);
                                        openOutputFile(filenamesvg, outsvg);
 
                                
@@ -625,9 +635,11 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        }
                }
                
+               return outputNames;
+               
        }
        catch(exception& e) {
-               errorOut(e, "Venn", "getPic");
+               m->errorOut(e, "Venn", "getPic");
                exit(1);
        }
 }
diff --git a/venn.h b/venn.h
index cf6a5ee332fbe2d70e3b5d1c2066c59db5ebb107..d3a3f05b841e768554746b14fa087d0baef28bfe 100644 (file)
--- a/venn.h
+++ b/venn.h
@@ -23,14 +23,15 @@ public:
        Venn(string);
        ~Venn(){};
 
-       void getPic(SAbundVector*, vector<Calculator*>);
-       void getPic(vector<SharedRAbundVector*>, vector<Calculator*>);
+       vector<string> getPic(SAbundVector*, vector<Calculator*>);
+       vector<string> getPic(vector<SharedRAbundVector*>, vector<Calculator*>);
 
 private:
        GlobalData* globaldata;
        Calculator* singleCalc;
        string groupComb, outputDir;
        ofstream outsvg;
+       MothurOut* m;
 };
 
 /***********************************************************************/
index 437f044e841783059421a121a2d89bc079207c54..57228ad4c789124126d71781357f4328bfd143a5 100644 (file)
 
 //**********************************************************************************************************************
 
-VennCommand::VennCommand(string option){
+VennCommand::VennCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
                abort = false;
                allLines = 1;
                labels.clear();
-               
+                       
                //allow user to run help
                if(option == "help") { help(); abort = true; }
                
@@ -46,7 +46,7 @@ VennCommand::VennCommand(string option){
                        
                        //make sure the user has already run the read.otu command
                        if ((globaldata->getListFile() == "") && (globaldata->getSharedFile() == "")) {
-                               mothurOut("You must read a list, or a list and a group, or a shared before you can use the venn command."); mothurOutEndLine(); abort = true; 
+                               m->mothurOut("You must read a list, or a list and a group, or a shared before you can use the venn command."); m->mothurOutEndLine(); abort = true; 
                        }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
@@ -136,7 +136,7 @@ VennCommand::VennCommand(string option){
                                
        }
        catch(exception& e) {
-               errorOut(e, "VennCommand", "VennCommand");
+               m->errorOut(e, "VennCommand", "VennCommand");
                exit(1);
        }
 }
@@ -145,21 +145,21 @@ VennCommand::VennCommand(string option){
 
 void VennCommand::help(){
        try {
-               mothurOut("The venn command can only be executed after a successful read.otu command.\n");
-               mothurOut("The venn command parameters are groups, calc, abund and label.  No parameters are required.\n");
-               mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your venn diagram, you may only use a maximum of 4 groups.\n");
-               mothurOut("The group names are separated by dashes. The label allows you to select what distance levels you would like a venn diagram created for, and are also separated by dashes.\n");
-               mothurOut("The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, label=yourLabels, abund=yourAbund).\n");
-               mothurOut("Example venn(groups=A-B-C, calc=sharedsobs-sharedchao, abund=20).\n");
-               mothurOut("The default value for groups is all the groups in your groupfile up to 4, and all labels in your inputfile will be used.\n");
-               mothurOut("The default value for calc is sobs if you have only read a list file or if you have selected only one group, and sharedsobs if you have multiple groups.\n");
-               mothurOut("The default available estimators for calc are sobs, chao and ace if you have only read a list file, and sharedsobs, sharedchao and sharedace if you have read a list and group file or a shared file.\n");
-               mothurOut("The only estmiator available four 4 groups is sharedsobs.\n");
-               mothurOut("The venn command outputs a .svg file for each calculator you specify at each distance you choose.\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
+               m->mothurOut("The venn command can only be executed after a successful read.otu command.\n");
+               m->mothurOut("The venn command parameters are groups, calc, abund and label.  No parameters are required.\n");
+               m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your venn diagram, you may only use a maximum of 4 groups.\n");
+               m->mothurOut("The group names are separated by dashes. The label allows you to select what distance levels you would like a venn diagram created for, and are also separated by dashes.\n");
+               m->mothurOut("The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, label=yourLabels, abund=yourAbund).\n");
+               m->mothurOut("Example venn(groups=A-B-C, calc=sharedsobs-sharedchao, abund=20).\n");
+               m->mothurOut("The default value for groups is all the groups in your groupfile up to 4, and all labels in your inputfile will be used.\n");
+               m->mothurOut("The default value for calc is sobs if you have only read a list file or if you have selected only one group, and sharedsobs if you have multiple groups.\n");
+               m->mothurOut("The default available estimators for calc are sobs, chao and ace if you have only read a list file, and sharedsobs, sharedchao and sharedace if you have read a list and group file or a shared file.\n");
+               m->mothurOut("The only estmiator available four 4 groups is sharedsobs.\n");
+               m->mothurOut("The venn command outputs a .svg file for each calculator you specify at each distance you choose.\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "VennCommand", "help");
+               m->errorOut(e, "VennCommand", "help");
                exit(1);
        }
 }
@@ -185,6 +185,7 @@ int VennCommand::execute(){
                if (abort == true) { return 0; }
                
                string lastLabel;
+               vector<string> outputNames;
                
                //if the users entered no valid calculators don't execute command
                if (vennCalculators.size() == 0) { return 0; }
@@ -217,15 +218,17 @@ int VennCommand::execute(){
                        while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
 
                                if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(lookup[0]->getLabel());
                                        userLabels.erase(lookup[0]->getLabel());
                                        
                                        if (lookup.size() > 4) {
-                                               mothurOut("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."); mothurOutEndLine();
+                                               m->mothurOut("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."); m->mothurOutEndLine();
                                                for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
                                        }
-                                       venn->getPic(lookup, vennCalculators);
+                                       
+                                       vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
+                                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
                                }
                                
                                if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
@@ -234,15 +237,16 @@ int VennCommand::execute(){
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(lookup[0]->getLabel());
                                        userLabels.erase(lookup[0]->getLabel());
 
                                        if (lookup.size() > 4) {
-                                               mothurOut("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."); mothurOutEndLine();
+                                               m->mothurOut("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."); m->mothurOutEndLine();
                                                for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
                                        }                               
-                                       venn->getPic(lookup, vennCalculators);
+                                       vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
+                                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
                                        
                                        //restore real lastlabel to save below
                                        lookup[0]->setLabel(saveLabel);
@@ -260,12 +264,12 @@ int VennCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                
@@ -274,15 +278,17 @@ int VennCommand::execute(){
                                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {     delete lookup[i]; }  } 
                                        lookup = input->getSharedRAbundVectors(lastLabel);
 
-                                       mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
+                                       m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                        processedLabels.insert(lookup[0]->getLabel());
                                        userLabels.erase(lookup[0]->getLabel());
 
                                        if (lookup.size() > 4) {
-                                               mothurOut("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."); mothurOutEndLine();
+                                               m->mothurOut("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."); m->mothurOutEndLine();
                                                for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
                                        }                               
-                                       venn->getPic(lookup, vennCalculators);
+                                       vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
+                                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
+
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                        }
                
@@ -296,8 +302,10 @@ int VennCommand::execute(){
                
                                if(allLines == 1 || labels.count(sabund->getLabel()) == 1){                     
        
-                                       mothurOut(sabund->getLabel()); mothurOutEndLine();
-                                       venn->getPic(sabund, vennCalculators);
+                                       m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+                                       vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
+                                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
+
                                        
                                        processedLabels.insert(sabund->getLabel());
                                        userLabels.erase(sabund->getLabel());
@@ -309,8 +317,10 @@ int VennCommand::execute(){
                                        delete sabund;
                                        sabund = input->getSAbundVector(lastLabel);
                                        
-                                       mothurOut(sabund->getLabel()); mothurOutEndLine();
-                                       venn->getPic(sabund, vennCalculators);
+                                       m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+                                       vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
+                                       for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
+
                                        
                                        processedLabels.insert(sabund->getLabel());
                                        userLabels.erase(sabund->getLabel());
@@ -329,12 +339,12 @@ int VennCommand::execute(){
                        set<string>::iterator it;
                        bool needToRun = false;
                        for (it = userLabels.begin(); it != userLabels.end(); it++) {  
-                               mothurOut("Your file does not include the label " + *it); 
+                               m->mothurOut("Your file does not include the label " + *it); 
                                if (processedLabels.count(lastLabel) != 1) {
-                                       mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
                                        needToRun = true;
                                }else {
-                                       mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine();
+                                       m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
                                }
                        }
                
@@ -343,8 +353,10 @@ int VennCommand::execute(){
                                if (sabund != NULL) {   delete sabund;  }
                                sabund = input->getSAbundVector(lastLabel);
                                        
-                               mothurOut(sabund->getLabel()); mothurOutEndLine();
-                               venn->getPic(sabund, vennCalculators);
+                               m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+                               vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
+                               for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } 
+
                                delete sabund;
                                        
                        }
@@ -352,10 +364,17 @@ int VennCommand::execute(){
                }
                
                for (int i = 0; i < vennCalculators.size(); i++) {      delete vennCalculators[i];      }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
+               m->mothurOutEndLine();
+
+               
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "VennCommand", "execute");
+               m->errorOut(e, "VennCommand", "execute");
                exit(1);
        }
 }
index 8a312297cc677ffb78aec597bf8128efbf500a0f..9a0d5d26d339aba5618e4811e65427fb61d9e251 100644 (file)
@@ -127,7 +127,7 @@ EstOutput Weighted::getValues(Tree* t) {
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Weighted", "getValues");
+               m->errorOut(e, "Weighted", "getValues");
                exit(1);
        }
 }
@@ -225,7 +225,7 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) {
                return data; 
        }
        catch(exception& e) {
-               errorOut(e, "Weighted", "getValues");
+               m->errorOut(e, "Weighted", "getValues");
                exit(1);
        }
 }
index 48bc3222e2acadb9095744082be88fc7d615cbd0..8688edd3871ca05542a06dd2432dd094ab948889 100644 (file)
@@ -27,7 +27,7 @@ EstOutput Whittaker::getValues(vector<SharedRAbundVector*> shared){
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Whittaker", "getValues");
+               m->errorOut(e, "Whittaker", "getValues");
                exit(1);
        }
 }