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