]> git.donarmstrong.com Git - mothur.git/blob - globaldata.cpp
merged pat's trim seqs edits with sarah's major overhaul of global data; also added...
[mothur.git] / globaldata.cpp
1
2
3 #include "globaldata.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 // These functions give you the option parameters of the commands
18 string GlobalData::getPhylipFile()              {       return phylipfile;              }
19 string GlobalData::getColumnFile()              {       return columnfile;              }
20 string GlobalData::getListFile()                {       return listfile;                }
21 string GlobalData::getRabundFile()              {       return rabundfile;              }
22 string GlobalData::getSabundFile()              {       return sabundfile;              }
23 string GlobalData::getNameFile()                {       return namefile;                }
24 string GlobalData::getGroupFile()               {       return groupfile;               }
25 string GlobalData::getOrderFile()               {       return orderfile;               }
26 string GlobalData::getTreeFile()                {       return treefile;                }
27 string GlobalData::getSharedFile()              {       return sharedfile;              }
28 //string GlobalData::getFastaFile()             {       return fastafile;               }       
29 string GlobalData::getFormat()                  {       return format;                  }
30
31 void GlobalData::setListFile(string file)               {       listfile = file;        inputFileName = file;                                   }
32 //void GlobalData::setFastaFile(string file)            {       fastafile = file;       inputFileName = file;                                   }
33 void GlobalData::setTreeFile(string file)               {       treefile = file;        inputFileName = file;                                   }
34 void GlobalData::setRabundFile(string file)             {       rabundfile = file;      inputFileName = file;                                   }
35 void GlobalData::setSabundFile(string file)             {       sabundfile = file;      inputFileName = file;                                   }
36 void GlobalData::setPhylipFile(string file)             {       phylipfile = file;    inputFileName = file;                                     }
37 void GlobalData::setColumnFile(string file)             {       columnfile = file;    inputFileName = file;                                     }
38 void GlobalData::setGroupFile(string file)              {       groupfile = file;                                                                                       }
39 void GlobalData::setSharedFile(string file)             {       sharedfile = file;      inputFileName = file;                                   }
40 void GlobalData::setNameFile(string file)               {       namefile = file;                }
41 void GlobalData::setOrderFile(string file)              {       orderfile = file;               }
42 void GlobalData::setFormat(string Format)               {       format = Format;                }
43
44
45 /*******************************************************/
46
47 /******************************************************/
48 GlobalData::GlobalData() {
49         //option definitions should go here...
50         clear();
51         gListVector = NULL;             
52         gSparseMatrix = NULL;   
53 }
54 /*******************************************************/
55
56 /******************************************************/
57 void GlobalData::clear() {
58         //option definitions should go here...
59         phylipfile              =       ""; //do we need this?
60         columnfile              =       ""; //do we need this?
61         listfile                =       "";
62         rabundfile              =       "";
63         sabundfile              =       "";
64         namefile                =       ""; //do we need this?
65         groupfile               =       ""; //do we need this?
66         orderfile               =       "";
67 //      fastafile               =   ""; //do we need this?
68         treefile                =       "";
69         sharedfile              =       "";
70 }
71
72
73 /*******************************************************/
74
75 /******************************************************/
76 void GlobalData::newRead() {
77         try{
78                         clear();
79                         gGroupmap = NULL;
80                         gListVector = NULL;
81                         gSparseMatrix = NULL;
82                         gTree.clear();
83                         Treenames.clear();
84                         labels.clear(); lines.clear(); Groups.clear();
85                         allLines = 1;
86                         runParse = true;
87         }
88         catch(exception& e) {
89                 cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function newRead. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
90                 exit(1);
91         }
92         catch(...) {
93                 cout << "An unknown error has occurred in the GlobalData class function newRead. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
94                 exit(1);
95         }
96 }
97
98 //******************************************************/
99
100 /******************************************************/
101 GlobalData::~GlobalData() {
102         _uniqueInstance = 0;
103         if(gListVector != NULL)         {       delete gListVector;             }
104         if(gSparseMatrix != NULL)       {       delete gSparseMatrix;   }
105         if(gorder != NULL)                      {       delete gorder;          }
106 }
107 /*******************************************************/
108
109 /*******************************************************/
110
111