]> git.donarmstrong.com Git - mothur.git/blob - globaldata.cpp
fixed multiple bugs for 1.4 release
[mothur.git] / globaldata.cpp
1 #include "globaldata.hpp"
2 #include "tree.h"
3 #include "sparsematrix.hpp"
4
5 /*******************************************************/
6
7 /******************************************************/
8 GlobalData* GlobalData::getInstance() {
9         if( _uniqueInstance == 0 ) {
10                 _uniqueInstance = new GlobalData();
11         }
12         return _uniqueInstance;
13 }
14 /*******************************************************/
15
16 /******************************************************/
17 //This function parses through the option string of the command to remove its parameters
18 void GlobalData::parseGlobalData(string commandString, string optionText){
19         try {
20                 commandName = commandString; //save command name to be used by other classes
21                 
22                 //set all non filename paramters to default
23                 reset();
24                 
25                 //clears out data from previous read
26                 if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree")) { 
27                         clear();
28                         gGroupmap = NULL;
29                         gTree.clear();
30                         Treenames.clear();
31                         labels.clear(); lines.clear(); Groups.clear();
32                         allLines = 1;
33                 }
34                 
35                 //saves help request
36                 if (commandName =="help") {
37                         helpRequest = optionText;
38                 }
39                 
40                 if (commandName == "libshuff") {
41                         iters = "10000";
42                         cutoff = "1.0";
43                 }
44                 
45                 //set default value for cutoff
46                 if (commandName == "dist.seqs") {       cutoff = "1.0";         }
47
48                 string key, value;              
49                 //reads in parameters and values
50                 if((optionText != "") && (commandName != "help")){
51                         while((optionText.find_first_of(',') != -1)) {  //while there are parameters
52                                 splitAtComma(value, optionText);
53                                 splitAtEquals(key, value);
54                                 
55                                 if (key == "phylip" )   { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip";       }
56                                 if (key == "column" )   { columnfile = value; inputFileName = value; fileroot = value; format = "column";       }
57                                 if (key == "list" )             { listfile = value; inputFileName = value; fileroot = value; format = "list";           }
58                                 if (key == "rabund" )   { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund";       }
59                                 if (key == "sabund" )   { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund";       } 
60                                 if (key == "fasta" )    { fastafile = value; inputFileName = value; fileroot = value; format = "fasta";         }
61                                 if (key == "nexus" )    { nexusfile = value; inputFileName = value; fileroot = value; format = "nexus";         } 
62                                 if (key == "clustal" )  { clustalfile = value; inputFileName = value; fileroot = value; format = "clustal"; }
63                                 if (key == "tree" )             { treefile = value; inputFileName = value; fileroot = value; format = "tree";           }
64                                 if (key == "shared" )   { sharedfile = value; inputFileName = value; fileroot = value; format = "sharedfile";   }
65                                 if (key == "name" )             { namefile = value;             }
66                                 if (key == "order" )    { orderfile = value;    }
67                                 if (key == "group" )    { groupfile = value;    }
68                                 if (key == "cutoff" )           { cutoff = value;               }
69                                 if (key == "precision" )        { precision = value;    }
70                                 if (key == "iters" )            { iters = value;                }
71                                 if (key == "jumble" )           { jumble = value;               }
72                                 if (key == "freq" )                     { freq = value;                 }
73                                 if (key == "method" )           { method = value;               }
74                                 if (key == "fileroot" )         { fileroot = value;             }
75                                 if (key == "abund" )        { abund = value;        }
76                                 if (key == "random" )           { randomtree = value;   }
77                                 if (key == "calc")                      { calc = value;                 }
78                                 if (key == "step")                      { step = value;                 }
79                                 if (key == "form")                      { form = value;                 }
80                                 if (key == "sorted")            { sorted = value;               }
81                                 if (key == "vertical")          { vertical = value;             }
82                                 if (key == "trump")                 { trump = value;            }
83                                 if (key == "hard")                      { hard = value;         }
84                                 if (key == "soft")                  { soft = value;                 }
85                                 if (key == "scale")                     { scale = value;                }
86                                 if (key == "countends" )        { countends = value;    }
87                                 if (key == "processors" )       { processors = value;   }
88                                 if (key == "size" )         { size = value;         }
89                                 if (key == "candidate")         { candidatefile = value;        }
90                                 if (key == "search")            { search = value;               }
91                                 if (key == "ksize")                     { ksize = value;                }
92                                 if (key == "align")                 { align = value;            }
93                                 if (key == "match")                     { match = value;                }
94                                 if (key == "mismatch")          { mismatch = value;         }
95                                 if (key == "gapopen")           { gapopen = value;              }
96                                 if (key == "gapextend" )        { gapextend = value;    }
97                                 
98                                 if (key == "line") {//stores lines to be used in a set
99                                         lines.clear();
100                                         labels.clear();
101                                         line = value;
102                                         label = "";
103                                         splitAtDash(value, lines);
104                                         allLines = 0;
105                                 }
106                                 if (key == "label") {//stores labels to be used in a set
107                                         labels.clear();
108                                         lines.clear();
109                                         label = value;
110                                         line = "";
111                                         splitAtDash(value, labels);
112                                         allLines = 0;
113                                 }
114
115                                 if (key == "groups") {//stores groups to be used in a vector
116                                         Groups.clear();
117                                         groups = value;
118                                         splitAtDash(value, Groups);
119                                 }
120
121                         }
122                         
123                         //saves the last parameter
124                         value = optionText;
125                         splitAtEquals(key, value);
126                         if (key == "phylip" )   { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip";       }
127                         if (key == "column" )   { columnfile = value; inputFileName = value; fileroot = value; format = "column";       }
128                         if (key == "list" )             { listfile = value; inputFileName = value; fileroot = value; format = "list";           }
129                         if (key == "rabund" )   { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund";       }
130                         if (key == "sabund" )   { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund";       }
131                         if (key == "fasta" )    { fastafile = value; inputFileName = value; fileroot = value; format = "fasta";         }
132                         if (key == "nexus" )    { nexusfile = value; inputFileName = value; fileroot = value; format = "nexus";         }
133                         if (key == "clustal" )  { clustalfile = value; inputFileName = value; fileroot = value; format = "clustal"; } 
134                         if (key == "tree" )             { treefile = value; inputFileName = value; fileroot = value; format = "tree";           } 
135                         if (key == "shared" )   { sharedfile = value; inputFileName = value; fileroot = value; format = "sharedfile";   } 
136                         if (key == "name" )             { namefile = value;             }
137                         if (key == "order" )    { orderfile = value;    }
138                         if (key == "group" )    { groupfile = value;    }
139                         if (key == "cutoff" )           { cutoff = value;               }
140                         if (key == "precision" )        { precision = value;    }
141                         if (key == "iters" )            { iters = value;                }
142                         if (key == "jumble" )           { jumble = value;               }
143                         if (key == "freq" )                     { freq = value;                 }
144                         if (key == "method" )           { method = value;               }
145                         if (key == "fileroot" )         { fileroot = value;             }
146                         if (key == "abund" )        { abund = value;        }
147                         if (key == "random" )           { randomtree = value;   }
148                         if (key == "calc")                      { calc = value;                 }
149                         if (key == "step")                      { step = value;                 }
150                         if (key == "form")                      { form = value;                 }
151                         if (key == "sorted")            { sorted = value;               }
152                         if (key == "vertical")          { vertical = value;             }
153                         if (key == "trump")                 { trump = value;            }
154                         if (key == "hard")                      { hard = value;         }
155                         if (key == "soft")                  { soft = value;                 }
156                         if (key == "scale")                     { scale = value;                }
157                         if (key == "countends" )        { countends = value;    }
158                         if (key == "processors" )       { processors = value;   }
159                         if (key == "size" )         { size = value;         }
160                         if (key == "candidate")         { candidatefile = value;        }
161                         if (key == "search")            { search = value;               }
162                         if (key == "ksize")                     { ksize = value;                }
163                         if (key == "align")                 { align = value;            }
164                         if (key == "match")                     { match = value;                }
165                         if (key == "mismatch")          { mismatch = value;         }
166                         if (key == "gapopen")           { gapopen = value;              }
167                         if (key == "gapextend" )        { gapextend = value;    }
168
169                         if (key == "line") {//stores lines to be used in a vector
170                                 lines.clear();
171                                 labels.clear();
172                                 line = value;
173                                 label = "";
174                                 if (line != "all") {  splitAtDash(value, lines);  allLines = 0;  }
175                                 else { allLines = 1;  }
176                         }
177                         
178                         if (key == "label") {//stores lines to be used in a vector
179                                 labels.clear();
180                                 lines.clear();
181                                 label = value;
182                                 line = "";
183                                 if (label != "all") {  splitAtDash(value, labels);  allLines = 0;  }
184                                 else { allLines = 1;  }
185                         }
186                         
187                         if (key == "groups") {//stores groups to be used in a vector
188                                         Groups.clear();
189                                         groups = value;
190                                         splitAtDash(value, Groups);
191                         }
192                 }
193                 
194                 //set format for shared
195                 if ((listfile != "") && (groupfile != "")) { format = "shared"; }
196                 if ((phylipfile != "") && (groupfile != "")) { format = "matrix"; }
197                                 
198                 //input defaults for calculators
199                 if (commandName == "collect.single") {
200
201                         if ((calc == "default") || (calc == "")) { calc = "sobs-chao-ace-jack-shannon-npshannon-simpson"; }
202                         Estimators.clear();
203                         splitAtDash(calc, Estimators); 
204                 }
205                 if (commandName == "rarefaction.single") {
206                         if ((calc == "default") || (calc == "")) { calc = "sobs"; }
207                         Estimators.clear();
208                         splitAtDash(calc, Estimators); 
209                 }
210                 if (commandName == "collect.shared") {
211
212                         if ((calc == "default") || (calc == "")) { calc = "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan"; }
213                         Estimators.clear();
214                         splitAtDash(calc, Estimators); 
215                 }
216                 if (commandName == "summary.single") {
217                         if ((calc == "default") || (calc == "")) { calc = "sobs-chao-ace-jack-shannon-npshannon-simpson"; }
218                         Estimators.clear();
219                         splitAtDash(calc, Estimators); 
220                 }
221                 if (commandName == "summary.shared") {
222                         if ((calc == "default") || (calc == "")) { calc = "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan"; }
223                         Estimators.clear();
224                         splitAtDash(calc, Estimators); 
225                 }
226                 if (commandName == "rarefaction.shared") {
227                         if ((calc == "default") || (calc == "")) { calc = "sharedobserved"; }
228                         Estimators.clear();
229                         splitAtDash(calc, Estimators); 
230                 }
231                 if (commandName == "dist.seqs") {
232                         if ((calc == "default") || (calc == "")) {  calc = "onegap";    }
233                         if (countends == "")    { countends = "T"; }
234                         Estimators.clear();
235                         splitAtDash(calc, Estimators); 
236                 }
237                 if (commandName == "venn") {
238                         if ((calc == "default") || (calc == "")) { 
239                                 if (format == "list") { calc = "sobs"; }
240                                 else { calc = "sharedsobs"; }
241                         }
242                         Estimators.clear();
243                         splitAtDash(calc, Estimators); 
244                 }
245                 if ((commandName == "tree.shared") || (commandName == "bootstrap.shared") || (commandName == "dist.shared")) {
246                         if ((calc == "default") || (calc == "")) { 
247                                 calc = "jclass-thetayc";
248                         }
249                         Estimators.clear();
250                         splitAtDash(calc, Estimators); 
251                 }
252                 
253                 if(commandName == "filter.seqs"){
254                         if(trump == "" && vertical == "" && hard == "" && soft == ""){
255                                 trump = '.';
256                         }
257
258                 }
259
260                 //if you have done a read.otu with a groupfile but don't want to use it anymore because you want to do single commands
261                 if ((commandName == "collect.single") || (commandName == "rarefaction.single") || (commandName == "summary.single")) {
262                         if (listfile != "") { format = "list"; }
263                         else if (sabundfile != "") { format = "sabund"; }
264                         else if (rabundfile != "") { format = "rabund"; }
265                 }
266         }
267         catch(exception& e) {
268                 cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function parseGlobalData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
269                 exit(1);
270         }
271         catch(...) {
272                 cout << "An unknown error has occurred in the GlobalData class function parseGlobalData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
273                 exit(1);
274         }
275 }
276 /*******************************************************/
277
278 /******************************************************/
279 // These functions give you the option parameters of the commands
280 string GlobalData::getPhylipFile()              {       return phylipfile;      }
281 string GlobalData::getColumnFile()              {       return columnfile;      }
282 string GlobalData::getListFile()                {       return listfile;        }
283 string GlobalData::getRabundFile()              {       return rabundfile;      }
284 string GlobalData::getSabundFile()              {       return sabundfile;      }
285 string GlobalData::getNameFile()                {       return namefile;        }
286 string GlobalData::getGroupFile()               {       return groupfile;       }
287 string GlobalData::getOrderFile()               {       return orderfile;       }
288 string GlobalData::getTreeFile()                {       return treefile;        }
289 string GlobalData::getSharedFile()              {       return sharedfile;      }
290 string GlobalData::getFastaFile()               {       return fastafile;       }
291 string GlobalData::getNexusFile()               {       return nexusfile;       }
292 string GlobalData::getClustalFile()     {   return clustalfile; }
293 string GlobalData::getCutOff()                  {       return cutoff;          }
294 string GlobalData::getFormat()                  {       return format;          }
295 string GlobalData::getPrecision()               {       return precision;       }
296 string GlobalData::getMethod()                  {       return method;          }
297 string GlobalData::getFileRoot()                {       return fileroot;        }
298 string GlobalData::getIters()                   {       return iters;           }
299 string GlobalData::getJumble()                  {       return jumble;          }
300 string GlobalData::getFreq()                    {       return freq;            }
301 string GlobalData::getAbund()           {   return abund;       }
302 string GlobalData::getRandomTree()              {       return randomtree;      }
303 string GlobalData::getGroups()                  {       return groups;          }
304 string GlobalData::getStep()                    {       return step;            }
305 string GlobalData::getForm()                    {       return form;            }
306 string GlobalData::getSorted()                  {       return sorted;          }
307 string GlobalData::getVertical()                {   return vertical;    }
308 string GlobalData::getTrump()                   {   return trump;       }
309 string GlobalData::getSoft()                    {   return soft;                }
310 string GlobalData::getHard()                    {   return hard;                }
311 string GlobalData::getScale()                   {       return scale;           }
312 string GlobalData::getCountEnds()               {   return countends;   }
313 string GlobalData::getProcessors()              {       return processors;      }
314 string GlobalData::getSize()            {   return size;        }
315 string GlobalData::getCandidateFile()   {       return candidatefile;}
316 string GlobalData::getSearch()                  {       return search;          }
317 string GlobalData::getKSize()                   {       return ksize;           }
318 string GlobalData::getAlign()                   {       return align;           }
319 string GlobalData::getMatch()                   {       return match;           }
320 string GlobalData::getMismatch()                {       return mismatch;        }
321 string GlobalData::getGapopen()                 {       return gapopen;         }
322 string GlobalData::getGapextend()               {       return gapextend;       }
323
324
325 void GlobalData::setListFile(string file)               {       listfile = file;        inputFileName = file;                                   }
326 void GlobalData::setRabundFile(string file)             {       rabundfile = file;      inputFileName = file;                                   }
327 void GlobalData::setSabundFile(string file)             {       sabundfile = file;      inputFileName = file;                                   }
328 void GlobalData::setPhylipFile(string file)             {       phylipfile = file;    inputFileName = file;                                     }
329 void GlobalData::setColumnFile(string file)             {       columnfile = file;    inputFileName = file;                                     }
330 void GlobalData::setGroupFile(string file)              {       groupfile = file;                                                                                       }
331 void GlobalData::setSharedFile(string file)             {       sharedfile = file;      inputFileName = file; fileroot = file;  }
332 void GlobalData::setNameFile(string file)               {       namefile = file;                }
333 void GlobalData::setFormat(string Format)               {       format = Format;                }
334 void GlobalData::setRandomTree(string Random)   {       randomtree = Random;    }
335 void GlobalData::setGroups(string g)                    {       groups = g;                             }
336 void GlobalData::setCalc(string Calc)                   {       calc = Calc;                    }
337 void GlobalData::setCountEnds(string e)                 {   countends = e;                      }
338 void GlobalData::setProcessors(string p)                {       processors = p;                 }
339
340
341 /*******************************************************/
342
343 /******************************************************/
344 GlobalData::GlobalData() {
345         //option definitions should go here...
346         helpRequest = "";
347         clear();
348         gListVector == NULL;            
349         gSparseMatrix == NULL;  
350 }
351 /*******************************************************/
352
353 /******************************************************/
354 void GlobalData::clear() {
355         //option definitions should go here...
356         phylipfile              =       "";
357         columnfile              =       "";
358         listfile                =       "";
359         rabundfile              =       "";
360         sabundfile              =       "";
361         namefile                =       "";
362         groupfile               =       ""; 
363         orderfile               =       "";
364         fastafile               =   "";
365         nexusfile               =   "";
366         clustalfile             =   "";
367         treefile                =       "";
368         sharedfile              =       "";
369         candidatefile   =       "";
370         cutoff                  =       "10.00";
371         format                  =       "";
372         precision               =       "100";
373         iters                   =       "1000"; 
374         line                    =   "";
375         label                   =       "";
376         groups                  =       "";
377         jumble                  =       "1";    //0 means don't jumble, 1 means jumble.
378         randomtree              =       "";  //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile.
379         freq                    =       "100";
380         method                  =       "furthest";
381         fileroot                =       "";
382         abund           =   "10";
383         step                    =       "0.01";
384         form                    =       "integral";
385         sorted                  =       "T";  //F means don't sort, T means sort.
386         vertical        =   "";         
387         trump           =       "";             
388         hard                    =   "";         
389         soft            =   ""; 
390         scale                   =       "log10";
391         countends               =   "T";  //yes
392         processors              =       "1";
393         size            =   "0";
394         search                  =       "kmer";
395         ksize                   =       "7";
396         align                   =       "needleman";
397         match                   =       "1.0";
398         mismatch                =       "-1.0";
399         gapopen                 =       "-1.0";
400         gapextend               =       "-2.0";
401 }
402
403 //*******************************************************/
404
405 /******************************************************/
406 void GlobalData::reset() {
407         cutoff                  =       "10.00";
408         precision               =       "100";
409         iters                   =       "1000"; 
410         groups                  =       "";
411         jumble                  =       "1";    //0 means don't jumble, 1 means jumble.
412         sorted                  =       "T";  //F means don't sort, T means sort.
413         randomtree              =       "";  //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile.
414         freq                    =       "100";
415         method                  =       "furthest";
416         calc                    =       "";
417         abund                   =   "10";
418         step                    =       "0.01";
419         form                    =       "integral";
420         countends               =   "T";
421         processors              =       "1";
422         size            =   "0";
423         search                  =       "kmer";
424         ksize                   =       "7";
425         align                   =       "needleman";
426         match                   =       "1.0";
427         mismatch                =       "-1.0";
428         gapopen                 =       "-1.0";
429         gapextend               =       "-2.0";
430         vertical        =   "";         
431         trump           =   "";         
432         hard                    =   "";         
433         soft            =   ""; 
434
435 }
436 /*******************************************************/
437
438 /******************************************************/
439 GlobalData::~GlobalData() {
440         _uniqueInstance = 0;
441         if(gListVector != NULL)         {       delete gListVector;             }
442         if(gSparseMatrix != NULL)       {       delete gSparseMatrix;   }
443         if(gorder != NULL)                      {       delete gorder;          }
444 }
445 /*******************************************************/
446
447 /*******************************************************/
448 void GlobalData::parseTreeFile() {
449         //only takes names from the first tree and assumes that all trees use the same names.
450         try {
451                 string filename = treefile;
452                 ifstream filehandle;
453                 openInputFile(filename, filehandle);
454                 int c, comment;
455                 comment = 0;
456                 
457                 //if you are not a nexus file 
458                 if ((c = filehandle.peek()) != '#') {  
459                         while((c = filehandle.peek()) != ';') { 
460                                 while ((c = filehandle.peek()) != ';') {
461                                         // get past comments
462                                         if(c == '[') {
463                                                 comment = 1;
464                                         }
465                                         if(c == ']'){
466                                                 comment = 0;
467                                         }
468                                         if((c == '(') && (comment != 1)){ break; }
469                                         filehandle.get();
470                                 }
471
472                                 readTreeString(filehandle); 
473                         }
474                 //if you are a nexus file
475                 }else if ((c = filehandle.peek()) == '#') {
476                         string holder = "";
477                                         
478                         // get past comments
479                         while(holder != "translate" && holder != "Translate"){  
480                                 if(holder == "[" || holder == "[!"){
481                                         comment = 1;
482                                 }
483                                 if(holder == "]"){
484                                         comment = 0;
485                                 }
486                                 filehandle >> holder; 
487         
488                                 //if there is no translate then you must read tree string otherwise use translate to get names
489                                 if(holder == "tree" && comment != 1){   
490                                         //pass over the "tree rep.6878900 = "
491                                         while (((c = filehandle.get()) != '(') && ((c = filehandle.peek()) != EOF) ) {;}
492
493                                         if (c == EOF ) { break; }
494                                         filehandle.putback(c);  //put back first ( of tree.
495                                         readTreeString(filehandle);     
496                                         break;
497                                 }
498                         }
499                         
500                         //use nexus translation rather than parsing tree to save time
501                         if ((holder == "translate") || (holder == "Translate")) {
502
503                                 string number, name, h;
504                                 h = ""; // so it enters the loop the first time
505                                 while((h != ";") && (number != ";")) { 
506                                         filehandle >> number;
507                                         filehandle >> name;
508         
509                                         //c = , until done with translation then c = ;
510                                         h = name.substr(name.length()-1, name.length()); 
511                                         name.erase(name.end()-1);  //erase the comma
512                                         Treenames.push_back(number);
513                                 }
514                                 if (number == ";") { Treenames.pop_back(); }  //in case ';' from translation is on next line instead of next to last name
515                         }
516                 }
517                 
518         }
519         catch(exception& e) {
520                 cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function parseTreeFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
521                 exit(1);
522         }
523         catch(...) {
524                 cout << "An unknown error has occurred in the GlobalData class function parseTreeFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
525                 exit(1);
526         }               
527 }
528 /*******************************************************/
529
530 /*******************************************************/
531 void GlobalData::readTreeString(ifstream& filehandle)   {
532         try {
533                 int c;
534                 string name; //k
535                 
536                 while((c = filehandle.peek()) != ';') { 
537                                 //if you are a name
538                         if ((c != '(') && (c != ')') && (c != ',') && (c != ':') && (c != '\n') && (c != '\t') && (c != 32)) { //32 is space
539                                 name = "";
540                                 c = filehandle.get();
541         //              k = c;
542 //cout << k << endl;
543                                 while ((c != '(') && (c != ')') && (c != ',') && (c != ':') && (c != '\n') && (c != 32) && (c != '\t')) {                       
544                                         name += c;
545                                         c = filehandle.get();
546                 //      k = c;
547 //cout << " in name while " << k << endl;
548                                 }
549                                 
550 //cout << "name = " << name << endl;
551                                 Treenames.push_back(name);
552                                 filehandle.putback(c);
553 //k = c;
554 //cout << " after putback" <<  k << endl;
555                         } 
556                         
557                         if (c  == ':') { //read until you reach the end of the branch length
558                                 while ((c != '(') && (c != ')') && (c != ',') && (c != ';') && (c != '\n') && (c != '\t') && (c != 32)) {
559                                         c = filehandle.get();
560                                 //      k = c;
561         //cout << " in branch while " << k << endl;
562                                 }
563                                 filehandle.putback(c);
564                         }
565                         c = filehandle.get();
566                         if (c == ';') { break; }
567                 //      k = c;
568 //cout << k << endl;
569
570                 }
571         }
572         catch(exception& e) {
573                 cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function parseTreeFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
574                 exit(1);
575         }
576         catch(...) {
577                 cout << "An unknown error has occurred in the GlobalData class function parseTreeFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
578                 exit(1);
579         }               
580 }       
581
582 /*******************************************************/
583
584 /*******************************************************/
585
586