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;
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 void mothurRemove(string);
89 bool checkReleaseVersion(ifstream&, string);
90 bool anyLabelsToProcess(string, set<string>&, string);
91 bool inUsersGroups(vector<string>, vector<string>);
92 bool inUsersGroups(string, vector<string>);
93 void getNumSeqs(ifstream&, int&);
94 int getNumSeqs(ifstream&);
95 int getNumNames(string);
97 bool isContainingOnlyDigits(string);
100 //string manipulation
101 void splitAtEquals(string&, string&);
102 void splitAtComma(string&, string&);
103 void splitAtComma(string&, vector<string>&);
104 void splitAtDash(string&, set<int>&);
105 void splitAtDash(string&, set<string>&);
106 void splitAtDash(string&, vector<string>&);
107 void splitAtChar(string&, vector<string>&, char);
110 int factorial(int num);
111 vector<vector<double> > binomial(int);
112 float ceilDist(float, int);
113 float roundDist(float, int);
114 unsigned int fromBase36(string);
115 int getRandomIndex(int); //highest
118 bool executing, runParse, jumble, gui;
120 //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
121 string getPhylipFile() { return phylipfile; }
122 string getColumnFile() { return columnfile; }
123 string getListFile() { return listfile; }
124 string getRabundFile() { return rabundfile; }
125 string getSabundFile() { return sabundfile; }
126 string getNameFile() { return namefile; }
127 string getGroupFile() { return groupfile; }
128 string getOrderFile() { return orderfile; }
129 string getOrderGroupFile() { return ordergroupfile; }
130 string getTreeFile() { return treefile; }
131 string getSharedFile() { return sharedfile; }
132 string getRelAbundFile() { return relabundfile; }
133 string getDesignFile() { return designfile; }
134 string getFastaFile() { return fastafile; }
135 string getSFFFile() { return sfffile; }
136 string getQualFile() { return qualfile; }
137 string getOligosFile() { return oligosfile; }
138 string getAccnosFile() { return accnosfile; }
139 string getTaxonomyFile() { return taxonomyfile; }
140 string getFlowFile() { return flowfile; }
141 string getProcessors() { return processors; }
143 void setListFile(string f) { listfile = getFullPathName(f); }
144 void setTreeFile(string f) { treefile = getFullPathName(f); }
145 void setGroupFile(string f) { groupfile = getFullPathName(f); }
146 void setPhylipFile(string f) { phylipfile = getFullPathName(f); }
147 void setColumnFile(string f) { columnfile = getFullPathName(f); }
148 void setNameFile(string f) { namefile = getFullPathName(f); }
149 void setRabundFile(string f) { rabundfile = getFullPathName(f); }
150 void setSabundFile(string f) { sabundfile = getFullPathName(f); }
151 void setSharedFile(string f) { sharedfile = getFullPathName(f); }
152 void setRelAbundFile(string f) { relabundfile = getFullPathName(f); }
153 void setOrderFile(string f) { orderfile = getFullPathName(f); }
154 void setOrderGroupFile(string f) { ordergroupfile = getFullPathName(f); }
155 void setDesignFile(string f) { designfile = getFullPathName(f); }
156 void setFastaFile(string f) { fastafile = getFullPathName(f); }
157 void setSFFFile(string f) { sfffile = getFullPathName(f); }
158 void setQualFile(string f) { qualfile = getFullPathName(f); }
159 void setOligosFile(string f) { oligosfile = getFullPathName(f); }
160 void setAccnosFile(string f) { accnosfile = getFullPathName(f); }
161 void setTaxonomyFile(string f) { taxonomyfile = getFullPathName(f); }
162 void setFlowFile(string f) { flowfile = getFullPathName(f); }
163 void setProcessors(string p) { processors = p; }
165 void printCurrentFiles();
166 bool hasCurrentFiles();
167 void clearCurrentFiles();
170 static MothurOut* _uniqueInstance;
171 MothurOut( const MothurOut& ); // Disable copy constructor
172 void operator=( const MothurOut& ); // Disable assignment operator
174 control_pressed = false; defaultPath="";
197 printedHeaders = false;
198 sharedHeaderMode = "";
203 string defaultPath, outputDir;
204 string releaseDate, version;
206 string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
207 string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
209 vector<string> Groups;
210 vector<string> namesOfGroups;
213 int mem_usage(double&, double&);
216 /***********************************************/