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; }
40 void addGroup(string g) { Groups.push_back(g); }
41 void setGroups(vector<string>& g) { sort(g.begin(), g.end()); Groups = g; }
42 void clearGroups() { Groups.clear(); }
43 int getNumGroups() { return Groups.size(); }
44 vector<string> getGroups() { sort(Groups.begin(), Groups.end()); return Groups; }
45 void addAllGroup(string g) { namesOfGroups.push_back(g); }
46 void setAllGroups(vector<string>& g) { sort(g.begin(), g.end()); namesOfGroups = g; }
47 void clearAllGroups() { namesOfGroups.clear(); }
48 int getNumAllGroups() { return namesOfGroups.size(); }
50 vector<string> getAllGroups() { sort(namesOfGroups.begin(), namesOfGroups.end()); return namesOfGroups; }
51 vector<string> Treenames;
52 map<string, string> names;
53 vector<string> binLabelsInFile;
54 vector<string> currentBinLabels;
55 string saveNextLabel, argv, sharedHeaderMode;
56 bool printedHeaders, commandInputsConvertError;
58 //functions from mothur.h
60 vector<unsigned long long> divideFile(string, int&);
61 int divideFile(string, int&, vector<string>&);
62 vector<unsigned long long> setFilePosEachLine(string, int&);
63 vector<unsigned long long> setFilePosFasta(string, int&);
64 string sortFile(string, string);
65 int appendFiles(string, string);
66 int renameFile(string, string); //oldname, newname
67 string getFullPathName(string);
68 string hasPath(string);
69 string getExtension(string);
70 string getPathName(string);
71 string getSimpleName(string);
72 string getRootName(string);
74 int openOutputFile(string, ofstream&);
75 int openOutputFileAppend(string, ofstream&);
76 int openInputFile(string, ifstream&);
77 int openInputFile(string, ifstream&, string); //no error given
78 string getline(ifstream&);
79 string getline(istringstream&);
80 void gobble(istream&);
81 void gobble(istringstream&);
82 map<string, int> readNames(string);
83 int readNames(string, map<string, string>&);
84 int readNames(string, map<string, vector<string> >&);
85 int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
86 int mothurRemove(string);
87 bool mothurConvert(string, int&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
88 bool mothurConvert(string, float&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
89 bool mothurConvert(string, double&); //use for converting user inputs. Sets commandInputsConvertError to true if error occurs. Engines check this.
93 bool checkReleaseVersion(ifstream&, string);
94 bool anyLabelsToProcess(string, set<string>&, string);
95 bool inUsersGroups(vector<string>, vector<string>);
96 bool inUsersGroups(string, vector<string>);
97 void getNumSeqs(ifstream&, int&);
98 int getNumSeqs(ifstream&);
99 int getNumNames(string);
100 int getNumChar(string, char);
102 bool isContainingOnlyDigits(string);
103 bool isNumeric1(string);
106 //string manipulation
107 void splitAtEquals(string&, string&);
108 void splitAtComma(string&, string&);
109 void splitAtComma(string&, vector<string>&);
110 void splitAtDash(string&, set<int>&);
111 void splitAtDash(string&, set<string>&);
112 void splitAtDash(string&, vector<string>&);
113 void splitAtChar(string&, vector<string>&, char);
114 int removeConfidences(string&);
117 int factorial(int num);
118 vector<vector<double> > binomial(int);
119 float ceilDist(float, int);
120 float roundDist(float, int);
121 unsigned int fromBase36(string);
122 int getRandomIndex(int); //highest
125 bool executing, runParse, jumble, gui;
127 //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
128 string getPhylipFile() { return phylipfile; }
129 string getColumnFile() { return columnfile; }
130 string getListFile() { return listfile; }
131 string getRabundFile() { return rabundfile; }
132 string getSabundFile() { return sabundfile; }
133 string getNameFile() { return namefile; }
134 string getGroupFile() { return groupfile; }
135 string getOrderFile() { return orderfile; }
136 string getOrderGroupFile() { return ordergroupfile; }
137 string getTreeFile() { return treefile; }
138 string getSharedFile() { return sharedfile; }
139 string getRelAbundFile() { return relabundfile; }
140 string getDesignFile() { return designfile; }
141 string getFastaFile() { return fastafile; }
142 string getSFFFile() { return sfffile; }
143 string getQualFile() { return qualfile; }
144 string getOligosFile() { return oligosfile; }
145 string getAccnosFile() { return accnosfile; }
146 string getTaxonomyFile() { return taxonomyfile; }
147 string getFlowFile() { return flowfile; }
148 string getProcessors() { return processors; }
150 void setListFile(string f) { listfile = getFullPathName(f); }
151 void setTreeFile(string f) { treefile = getFullPathName(f); }
152 void setGroupFile(string f) { groupfile = getFullPathName(f); }
153 void setPhylipFile(string f) { phylipfile = getFullPathName(f); }
154 void setColumnFile(string f) { columnfile = getFullPathName(f); }
155 void setNameFile(string f) { namefile = getFullPathName(f); }
156 void setRabundFile(string f) { rabundfile = getFullPathName(f); }
157 void setSabundFile(string f) { sabundfile = getFullPathName(f); }
158 void setSharedFile(string f) { sharedfile = getFullPathName(f); }
159 void setRelAbundFile(string f) { relabundfile = getFullPathName(f); }
160 void setOrderFile(string f) { orderfile = getFullPathName(f); }
161 void setOrderGroupFile(string f) { ordergroupfile = getFullPathName(f); }
162 void setDesignFile(string f) { designfile = getFullPathName(f); }
163 void setFastaFile(string f) { fastafile = getFullPathName(f); }
164 void setSFFFile(string f) { sfffile = getFullPathName(f); }
165 void setQualFile(string f) { qualfile = getFullPathName(f); }
166 void setOligosFile(string f) { oligosfile = getFullPathName(f); }
167 void setAccnosFile(string f) { accnosfile = getFullPathName(f); }
168 void setTaxonomyFile(string f) { taxonomyfile = getFullPathName(f); }
169 void setFlowFile(string f) { flowfile = getFullPathName(f); }
170 void setProcessors(string p) { processors = p; }
172 void printCurrentFiles();
173 bool hasCurrentFiles();
174 void clearCurrentFiles();
177 static MothurOut* _uniqueInstance;
178 MothurOut( const MothurOut& ); // Disable copy constructor
179 void operator=( const MothurOut& ); // Disable assignment operator
181 control_pressed = false; defaultPath="";
204 printedHeaders = false;
205 commandInputsConvertError = false;
206 sharedHeaderMode = "";
211 string defaultPath, outputDir;
212 string releaseDate, version;
214 string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
215 string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
217 vector<string> Groups;
218 vector<string> namesOfGroups;
221 int mem_usage(double&, double&);
224 /***********************************************/