8 * Created by westcott on 2/25/10.
9 * Copyright 2010 Schloss Lab. All rights reserved.
15 /***********************************************/
20 static MothurOut* getInstance();
21 void setFileName(string);
23 void mothurOut(string); //writes to cout and the logfile
24 void mothurOutEndLine(); //writes to cout and the logfile
25 void mothurOut(string, ofstream&); //writes to the ofstream, cout and the logfile
26 void mothurOutEndLine(ofstream&); //writes to the ofstream, cout and the logfile
27 void mothurOutJustToLog(string);
28 void errorOut(exception&, string, string);
30 string getDefaultPath() { return defaultPath; }
31 void setDefaultPath(string);
32 string getOutputDir() { return outputDir; }
33 void setOutputDir(string);
35 string getReleaseDate() { return releaseDate; }
36 void setReleaseDate(string r) { releaseDate = r; }
37 string getVersion() { return version; }
38 void setVersion(string r) { version = r; }
39 vector<string> Groups;
40 vector<string> Treenames;
41 map<string, string> names;
42 vector<string> namesOfGroups;
43 vector<string> binLabelsInFile;
44 vector<string> currentBinLabels;
45 string saveNextLabel, argv, sharedHeaderMode;
48 //functions from mothur.h
50 vector<unsigned long int> divideFile(string, int&);
51 int divideFile(string, int&, vector<string>&);
52 vector<unsigned long int> setFilePosEachLine(string, int&);
53 vector<unsigned long int> setFilePosFasta(string, int&);
54 string sortFile(string, string);
55 void appendFiles(string, string);
56 int renameFile(string, string); //oldname, newname
57 string getFullPathName(string);
58 string hasPath(string);
59 string getExtension(string);
60 string getPathName(string);
61 string getSimpleName(string);
62 string getRootName(string);
64 int openOutputFile(string, ofstream&);
65 int openOutputFileAppend(string, ofstream&);
66 int openInputFile(string, ifstream&);
67 int openInputFile(string, ifstream&, string); //no error given
68 string getline(ifstream&);
69 string getline(istringstream&);
70 void gobble(istream&);
71 void gobble(istringstream&);
72 map<string, int> readNames(string);
73 int readNames(string, map<string, string>&);
74 int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
75 void mothurRemove(string);
78 bool checkReleaseVersion(ifstream&, string);
79 bool anyLabelsToProcess(string, set<string>&, string);
80 bool inUsersGroups(vector<string>, vector<string>);
81 bool inUsersGroups(string, vector<string>);
82 void getNumSeqs(ifstream&, int&);
83 int getNumSeqs(ifstream&);
84 int getNumNames(string);
86 bool isContainingOnlyDigits(string);
90 void splitAtEquals(string&, string&);
91 void splitAtComma(string&, string&);
92 void splitAtComma(string&, vector<string>&);
93 void splitAtDash(string&, set<int>&);
94 void splitAtDash(string&, set<string>&);
95 void splitAtDash(string&, vector<string>&);
96 void splitAtChar(string&, vector<string>&, char);
99 int factorial(int num);
100 vector<vector<double> > binomial(int);
101 float ceilDist(float, int);
102 float roundDist(float, int);
103 unsigned int fromBase36(string);
104 int getRandomIndex(int); //highest
107 bool executing, runParse, jumble, gui;
109 //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
110 string getPhylipFile() { return phylipfile; }
111 string getColumnFile() { return columnfile; }
112 string getListFile() { return listfile; }
113 string getRabundFile() { return rabundfile; }
114 string getSabundFile() { return sabundfile; }
115 string getNameFile() { return namefile; }
116 string getGroupFile() { return groupfile; }
117 string getOrderFile() { return orderfile; }
118 string getOrderGroupFile() { return ordergroupfile; }
119 string getTreeFile() { return treefile; }
120 string getSharedFile() { return sharedfile; }
121 string getRelAbundFile() { return relabundfile; }
122 string getDesignFile() { return designfile; }
123 string getFastaFile() { return fastafile; }
124 string getSFFFile() { return sfffile; }
125 string getQualFile() { return qualfile; }
126 string getOligosFile() { return oligosfile; }
127 string getAccnosFile() { return accnosfile; }
128 string getTaxonomyFile() { return taxonomyfile; }
129 string getFlowFile() { return flowfile; }
130 string getProcessors() { return processors; }
132 void setListFile(string f) { listfile = getFullPathName(f); }
133 void setTreeFile(string f) { treefile = getFullPathName(f); }
134 void setGroupFile(string f) { groupfile = getFullPathName(f); }
135 void setPhylipFile(string f) { phylipfile = getFullPathName(f); }
136 void setColumnFile(string f) { columnfile = getFullPathName(f); }
137 void setNameFile(string f) { namefile = getFullPathName(f); }
138 void setRabundFile(string f) { rabundfile = getFullPathName(f); }
139 void setSabundFile(string f) { sabundfile = getFullPathName(f); }
140 void setSharedFile(string f) { sharedfile = getFullPathName(f); }
141 void setRelAbundFile(string f) { relabundfile = getFullPathName(f); }
142 void setOrderFile(string f) { orderfile = getFullPathName(f); }
143 void setOrderGroupFile(string f) { ordergroupfile = getFullPathName(f); }
144 void setDesignFile(string f) { designfile = getFullPathName(f); }
145 void setFastaFile(string f) { fastafile = getFullPathName(f); }
146 void setSFFFile(string f) { sfffile = getFullPathName(f); }
147 void setQualFile(string f) { qualfile = getFullPathName(f); }
148 void setOligosFile(string f) { oligosfile = getFullPathName(f); }
149 void setAccnosFile(string f) { accnosfile = getFullPathName(f); }
150 void setTaxonomyFile(string f) { taxonomyfile = getFullPathName(f); }
151 void setFlowFile(string f) { flowfile = getFullPathName(f); }
152 void setProcessors(string p) { processors = p; }
154 void printCurrentFiles();
155 bool hasCurrentFiles();
156 void clearCurrentFiles();
159 static MothurOut* _uniqueInstance;
160 MothurOut( const MothurOut& ); // Disable copy constructor
161 void operator=( const MothurOut& ); // Disable assignment operator
163 control_pressed = false; defaultPath="";
186 printedHeaders = false;
187 sharedHeaderMode = "";
192 string defaultPath, outputDir;
193 string releaseDate, version;
195 string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
196 string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
201 int mem_usage(double&, double&);
204 /***********************************************/