8 * Created by westcott on 2/25/10.
9 * Copyright 2010 Schloss Lab. All rights reserved.
15 /***********************************************/
22 logger& operator <<( const T& o ) {
23 cout << o; return *this;
26 logger& operator<<(ostream& (*m)(ostream&) ) {
27 cout << m; return *this;
31 /***********************************************/
36 static MothurOut* getInstance();
37 void setFileName(string);
39 void mothurOut(string); //writes to cout and the logfile
40 void mothurOutEndLine(); //writes to cout and the logfile
41 void mothurOut(string, ofstream&); //writes to the ofstream, cout and the logfile
42 void mothurOutEndLine(ofstream&); //writes to the ofstream, cout and the logfile
43 void mothurOutJustToLog(string);
44 void errorOut(exception&, string, string);
46 string getDefaultPath() { return defaultPath; }
47 void setDefaultPath(string);
48 string getOutputDir() { return outputDir; }
49 void setOutputDir(string);
51 string getReleaseDate() { return releaseDate; }
52 void setReleaseDate(string r) { releaseDate = r; }
53 string getVersion() { return version; }
54 void setVersion(string r) { version = r; }
56 void addGroup(string g) { Groups.push_back(g); }
57 void setGroups(vector<string>& g) { sort(g.begin(), g.end()); Groups = g; }
58 void clearGroups() { Groups.clear(); }
59 int getNumGroups() { return Groups.size(); }
60 vector<string> getGroups() { sort(Groups.begin(), Groups.end()); return Groups; }
61 void addAllGroup(string g) { namesOfGroups.push_back(g); }
62 void setAllGroups(vector<string>& g) { sort(g.begin(), g.end()); namesOfGroups = g; }
63 void clearAllGroups() { namesOfGroups.clear(); }
64 int getNumAllGroups() { return namesOfGroups.size(); }
66 vector<string> getAllGroups() { sort(namesOfGroups.begin(), namesOfGroups.end()); return namesOfGroups; }
67 vector<string> Treenames;
68 map<string, string> names;
69 vector<string> binLabelsInFile;
70 vector<string> currentBinLabels;
71 string saveNextLabel, argv, sharedHeaderMode;
72 bool printedHeaders, commandInputsConvertError;
74 //functions from mothur.h
76 vector<unsigned long long> divideFile(string, int&);
77 int divideFile(string, int&, vector<string>&);
78 vector<unsigned long long> setFilePosEachLine(string, int&);
79 vector<unsigned long long> setFilePosFasta(string, int&);
80 string sortFile(string, string);
81 int appendFiles(string, string);
82 int renameFile(string, string); //oldname, newname
83 string getFullPathName(string);
84 string hasPath(string);
85 string getExtension(string);
86 string getPathName(string);
87 string getSimpleName(string);
88 string getRootName(string);
90 int openOutputFile(string, ofstream&);
91 int openOutputFileAppend(string, ofstream&);
92 int openInputFile(string, ifstream&);
93 int openInputFile(string, ifstream&, string); //no error given
94 string getline(ifstream&);
95 string getline(istringstream&);
96 void gobble(istream&);
97 void gobble(istringstream&);
98 map<string, int> readNames(string);
99 int readNames(string, map<string, string>&);
100 int readNames(string, map<string, vector<string> >&);
101 int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
102 int mothurRemove(string);
103 bool mothurConvert(string, int&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
104 bool mothurConvert(string, float&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
105 bool mothurConvert(string, double&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
109 bool checkReleaseVersion(ifstream&, string);
110 bool anyLabelsToProcess(string, set<string>&, string);
111 bool inUsersGroups(vector<string>, vector<string>);
112 bool inUsersGroups(string, vector<string>);
113 void getNumSeqs(ifstream&, int&);
114 int getNumSeqs(ifstream&);
115 int getNumNames(string);
116 int getNumChar(string, char);
118 bool isContainingOnlyDigits(string);
119 bool isNumeric1(string);
122 //string manipulation
123 void splitAtEquals(string&, string&);
124 void splitAtComma(string&, string&);
125 void splitAtComma(string&, vector<string>&);
126 void splitAtDash(string&, set<int>&);
127 void splitAtDash(string&, set<string>&);
128 void splitAtDash(string&, vector<string>&);
129 void splitAtChar(string&, vector<string>&, char);
130 int removeConfidences(string&);
133 int factorial(int num);
134 vector<vector<double> > binomial(int);
135 float ceilDist(float, int);
136 float roundDist(float, int);
137 unsigned int fromBase36(string);
138 int getRandomIndex(int); //highest
141 bool executing, runParse, jumble, gui, mothurCalling;
143 //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
144 string getPhylipFile() { return phylipfile; }
145 string getColumnFile() { return columnfile; }
146 string getListFile() { return listfile; }
147 string getRabundFile() { return rabundfile; }
148 string getSabundFile() { return sabundfile; }
149 string getNameFile() { return namefile; }
150 string getGroupFile() { return groupfile; }
151 string getOrderFile() { return orderfile; }
152 string getOrderGroupFile() { return ordergroupfile; }
153 string getTreeFile() { return treefile; }
154 string getSharedFile() { return sharedfile; }
155 string getRelAbundFile() { return relabundfile; }
156 string getDesignFile() { return designfile; }
157 string getFastaFile() { return fastafile; }
158 string getSFFFile() { return sfffile; }
159 string getQualFile() { return qualfile; }
160 string getOligosFile() { return oligosfile; }
161 string getAccnosFile() { return accnosfile; }
162 string getTaxonomyFile() { return taxonomyfile; }
163 string getFlowFile() { return flowfile; }
164 string getProcessors() { return processors; }
166 void setListFile(string f) { listfile = getFullPathName(f); }
167 void setTreeFile(string f) { treefile = getFullPathName(f); }
168 void setGroupFile(string f) { groupfile = getFullPathName(f); }
169 void setPhylipFile(string f) { phylipfile = getFullPathName(f); }
170 void setColumnFile(string f) { columnfile = getFullPathName(f); }
171 void setNameFile(string f) { namefile = getFullPathName(f); }
172 void setRabundFile(string f) { rabundfile = getFullPathName(f); }
173 void setSabundFile(string f) { sabundfile = getFullPathName(f); }
174 void setSharedFile(string f) { sharedfile = getFullPathName(f); }
175 void setRelAbundFile(string f) { relabundfile = getFullPathName(f); }
176 void setOrderFile(string f) { orderfile = getFullPathName(f); }
177 void setOrderGroupFile(string f) { ordergroupfile = getFullPathName(f); }
178 void setDesignFile(string f) { designfile = getFullPathName(f); }
179 void setFastaFile(string f) { fastafile = getFullPathName(f); }
180 void setSFFFile(string f) { sfffile = getFullPathName(f); }
181 void setQualFile(string f) { qualfile = getFullPathName(f); }
182 void setOligosFile(string f) { oligosfile = getFullPathName(f); }
183 void setAccnosFile(string f) { accnosfile = getFullPathName(f); }
184 void setTaxonomyFile(string f) { taxonomyfile = getFullPathName(f); }
185 void setFlowFile(string f) { flowfile = getFullPathName(f); }
186 void setProcessors(string p) { processors = p; }
188 void printCurrentFiles();
189 bool hasCurrentFiles();
190 void clearCurrentFiles();
193 static MothurOut* _uniqueInstance;
194 MothurOut( const MothurOut& ); // Disable copy constructor
195 void operator=( const MothurOut& ); // Disable assignment operator
197 control_pressed = false; defaultPath="";
220 printedHeaders = false;
221 commandInputsConvertError = false;
222 mothurCalling = false;
223 sharedHeaderMode = "";
228 string defaultPath, outputDir;
229 string releaseDate, version;
231 string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
232 string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
234 vector<string> Groups;
235 vector<string> namesOfGroups;
238 int mem_usage(double&, double&);
241 /***********************************************/