]> git.donarmstrong.com Git - mothur.git/blob - mothurout.h
removed read.dist, read.otu, read.tree and globaldata. added current to defaults...
[mothur.git] / mothurout.h
1 #ifndef MOTHUROUT_H
2 #define MOTHUROUT_H
3
4 /*
5  *  mothurOut.h
6  *  Mothur
7  *
8  *  Created by westcott on 2/25/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14
15
16 /***********************************************/
17
18 class MothurOut {
19         
20         public:
21                 static MothurOut* getInstance();
22                 void setFileName(string);
23                 
24                 void mothurOut(string);
25                 void mothurOutEndLine();
26                 void mothurOutJustToLog(string);
27                 void errorOut(exception&, string, string);
28                 void closeLog();
29                 string getDefaultPath() { return defaultPath; }
30                 void setDefaultPath(string);
31                 string getOutputDir() { return outputDir; }
32                 void setOutputDir(string);
33                 
34                 string getReleaseDate() { return releaseDate; }
35                 void setReleaseDate(string r) { releaseDate = r; }
36                 string getVersion() { return version; }
37                 void setVersion(string r) { version = r; }
38                 vector<string> Groups;
39                 vector<string> Treenames;
40                 map<string, string> names;
41                 vector<string> namesOfGroups;
42                 string saveNextLabel, argv;
43                 
44                 //functions from mothur.h
45                 //file operations
46                 vector<unsigned long int> divideFile(string, int&);
47                 vector<unsigned long int> setFilePosEachLine(string, int&);
48                 vector<unsigned long int> setFilePosFasta(string, int&);
49                 string sortFile(string, string);
50                 void appendFiles(string, string);
51                 int renameFile(string, string); //oldname, newname
52                 string getFullPathName(string);
53                 string hasPath(string);
54                 string getExtension(string);
55                 string getPathName(string);
56                 string getSimpleName(string);
57                 string getRootName(string);
58                 bool isBlank(string);
59                 int openOutputFile(string, ofstream&);
60                 int openOutputFileAppend(string, ofstream&);
61                 int openInputFile(string, ifstream&);
62                 int openInputFile(string, ifstream&, string); //no error given 
63                 string getline(ifstream&);
64                 string getline(istringstream&);
65                 void gobble(istream&);
66                 void gobble(istringstream&);
67                 map<string, int> readNames(string);
68                 
69                 //searchs and checks
70                 bool checkReleaseVersion(ifstream&, string);
71                 bool anyLabelsToProcess(string, set<string>&, string);
72                 bool inUsersGroups(vector<string>, vector<string>);
73                 bool inUsersGroups(string, vector<string>);
74                 void getNumSeqs(ifstream&, int&);
75                 int getNumSeqs(ifstream&);
76                 int getNumNames(string);
77                 bool isTrue(string);
78         
79                 
80                 //string manipulation
81                 void splitAtEquals(string&, string&);
82                 void splitAtComma(string&, string&);    
83                 void splitAtComma(string&, vector<string>&);
84                 void splitAtDash(string&, set<int>&);
85                 void splitAtDash(string&, set<string>&);
86                 void splitAtDash(string&, vector<string>&);
87                 void splitAtChar(string&, vector<string>&, char);
88                 
89                 //math operation
90                 int factorial(int num);
91                 vector<vector<double> > binomial(int);
92                 float ceilDist(float, int);
93                 float roundDist(float, int);
94                 unsigned int fromBase36(string);
95
96                 int control_pressed;
97                 bool executing, runParse, jumble;
98                 
99                 //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
100                 string getPhylipFile()          { return phylipfile;            }
101                 string getColumnFile()          { return columnfile;            }
102                 string getListFile()            { return listfile;                      }
103                 string getRabundFile()          { return rabundfile;            }
104                 string getSabundFile()          { return sabundfile;            }
105                 string getNameFile()            { return namefile;                      }       
106                 string getGroupFile()           { return groupfile;                     }       
107                 string getOrderFile()           { return orderfile;                     }
108                 string getOrderGroupFile()      { return ordergroupfile;        }
109                 string getTreeFile()            { return treefile;                      }
110                 string getSharedFile()          { return sharedfile;            }
111                 string getRelAbundFile()        { return relabundfile;          }
112                 string getDesignFile()          { return designfile;            }
113                 string getFastaFile()           { return fastafile;                     }
114                 string getSFFFile()                     { return sfffile;                       }
115                 string getQualFile()            { return qualfile;                      }
116                 string getOligosFile()          { return oligosfile;            }
117                 string getAccnosFile()          { return accnosfile;            }
118                 string getTaxonomyFile()        { return taxonomyfile;          }
119                 string getProcessors()          { return processors;            }
120                 
121                 void setListFile(string f)                      { listfile = getFullPathName(f);                        }
122                 void setTreeFile(string f)                      { treefile = getFullPathName(f);                        }
123                 void setGroupFile(string f)                     { groupfile = getFullPathName(f);                       }               
124                 void setPhylipFile(string f)            { phylipfile = getFullPathName(f);                      }
125                 void setColumnFile(string f)            { columnfile = getFullPathName(f);                      }
126                 void setNameFile(string f)                      { namefile = getFullPathName(f);                        }       
127                 void setRabundFile(string f)            { rabundfile = getFullPathName(f);                      }
128                 void setSabundFile(string f)            { sabundfile = getFullPathName(f);                      }
129                 void setSharedFile(string f)            { sharedfile = getFullPathName(f);                      }
130                 void setRelAbundFile(string f)          { relabundfile = getFullPathName(f);            }
131                 void setOrderFile(string f)                     { orderfile = getFullPathName(f);                       }
132                 void setOrderGroupFile(string f)        { ordergroupfile = getFullPathName(f);          }
133                 void setDesignFile(string f)            { designfile = getFullPathName(f);                      }
134                 void setFastaFile(string f)                     { fastafile = getFullPathName(f);                       }
135                 void setSFFFile(string f)                       { sfffile = getFullPathName(f);                         }
136                 void setQualFile(string f)                      { qualfile = getFullPathName(f);                        }
137                 void setOligosFile(string f)            { oligosfile = getFullPathName(f);                      }
138                 void setAccnosFile(string f)            { accnosfile = getFullPathName(f);                      }
139                 void setTaxonomyFile(string f)          { taxonomyfile = getFullPathName(f);            }
140                 void setProcessors(string p)            { processors = p;                                                       }
141                 
142                 void printCurrentFiles();
143                 void clearCurrentFiles();
144                 
145         private:
146                 static MothurOut* _uniqueInstance;
147                 MothurOut( const MothurOut& ); // Disable copy constructor
148                 void operator=( const MothurOut& ); // Disable assignment operator
149                 MothurOut() { 
150                         control_pressed = false; defaultPath=""; 
151                         phylipfile = "";
152                         columnfile = "";
153                         listfile = "";
154                         rabundfile = "";
155                         sabundfile = "";
156                         namefile = "";
157                         groupfile = "";
158                         designfile = "";
159                         orderfile = "";
160                         treefile = "";
161                         sharedfile = "";
162                         ordergroupfile = "";
163                         relabundfile = "";
164                         fastafile = "";
165                         qualfile = "";
166                         sfffile = "";
167                         oligosfile = "";
168                         accnosfile = "";
169                         taxonomyfile = "";
170                         processors = "1";
171                 };
172                 ~MothurOut();
173
174                 string logFileName;
175                 string defaultPath, outputDir;
176                 string releaseDate, version;
177         
178                 string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
179                 string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors;
180
181         
182                 ofstream out;
183                 
184                 int mem_usage(double&, double&);
185
186 };
187 /***********************************************/
188
189 #endif
190