]> git.donarmstrong.com Git - mothur.git/blob - inputdata.cpp
added headers to shared and relabund files
[mothur.git] / inputdata.cpp
1 /*
2  *  inputdata.cpp
3  *  Dotur
4  *
5  *  Created by Sarah Westcott on 11/18/08.
6  *  Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "inputdata.h"
11 #include "ordervector.hpp"
12 #include "listvector.hpp"
13 #include "rabundvector.hpp"
14
15 /***********************************************************************/
16
17 InputData::InputData(string fName, string f) : format(f){
18         m = MothurOut::getInstance();
19         m->openInputFile(fName, fileHandle);
20         filename = fName;
21         m->saveNextLabel = "";
22         
23         
24 }
25 /***********************************************************************/
26
27 InputData::~InputData(){
28         fileHandle.close();
29         m->saveNextLabel = "";
30         
31 }
32
33 /***********************************************************************/
34
35 InputData::InputData(string fName, string orderFileName, string f) : format(f){
36         try {
37                 m = MothurOut::getInstance();
38                 ifstream ofHandle;
39                 m->openInputFile(orderFileName, ofHandle);
40                 string name;
41
42                 int count = 0;
43         
44                 while(ofHandle){
45                         ofHandle >> name;
46                         orderMap[name] = count;
47                         count++;
48                         m->gobble(ofHandle);
49                 }
50                 ofHandle.close();
51         
52                 m->openInputFile(fName, fileHandle);
53                 m->saveNextLabel = "";
54         }
55         catch(exception& e) {
56                 m->errorOut(e, "InputData", "InputData");
57                 exit(1);
58         }
59 }
60 /***********************************************************************/
61
62 ListVector* InputData::getListVector(){
63         try {
64                 if(!fileHandle.eof()){
65                         if(format == "list") {
66                                 list = new ListVector(fileHandle);
67                         }else{ list = NULL;  }
68                                         
69                         m->gobble(fileHandle);
70                         return list;
71                 }
72                 else{
73                         return NULL;
74                 }
75         }
76         catch(exception& e) {
77                 m->errorOut(e, "InputData", "getListVector");
78                 exit(1);
79         }
80 }
81
82 /***********************************************************************/
83 ListVector* InputData::getListVector(string label){
84         try {
85                 ifstream in;
86                 string  thisLabel;
87                 m->openInputFile(filename, in);
88                 
89                 if(in){
90
91                         if (format == "list") {
92                         
93                                 while (in.eof() != true) {
94                                         
95                                         list = new ListVector(in);
96                                         thisLabel = list->getLabel();
97                                         
98                                         //if you are at the last label
99                                         if (thisLabel == label) {  break;  }
100                                         //so you don't loose this memory
101                                         else {  delete list;    }
102                                         m->gobble(in);
103                                 }
104                         }else{ list = NULL;  }
105                         
106                         in.close();
107                         return list;
108                 }
109                 else{
110                         return NULL;
111                 }
112         }
113         catch(exception& e) {
114                 m->errorOut(e, "InputData", "getListVector");
115                 exit(1);
116         }
117 }
118 /***********************************************************************/
119 ListVector* InputData::getListVector(string label, bool resetFP){
120         try {
121                 string  thisLabel;
122                 fileHandle.clear();
123                 fileHandle.seekg(0);
124                 
125                 if(fileHandle){
126
127                         if (format == "list") {
128                         
129                                 while (fileHandle.eof() != true) {
130                                         
131                                         list = new ListVector(fileHandle); m->gobble(fileHandle);
132                                         thisLabel = list->getLabel();
133                                         
134                                         //if you are at the last label
135                                         if (thisLabel == label) {  break;  }
136                                         //so you don't loose this memory
137                                         else {  delete list;    }
138                                 }
139                         }else{ list = NULL;  }
140                 
141                         return list;
142                 }
143                 else{
144                         return NULL;
145                 }
146         }
147         catch(exception& e) {
148                 m->errorOut(e, "InputData", "getListVector");
149                 exit(1);
150         }
151 }
152
153 /***********************************************************************/
154
155 SharedListVector* InputData::getSharedListVector(){
156         try {
157                 if(fileHandle){
158                         if (format == "shared")  {
159                                 SharedList = new SharedListVector(fileHandle);
160                         }else{ SharedList = NULL;  }
161                                         
162                         m->gobble(fileHandle);
163                         return SharedList;
164                 }
165                 else{
166                         return NULL;
167                 }
168         }
169         catch(exception& e) {
170                 m->errorOut(e, "InputData", "getSharedListVector");
171                 exit(1);
172         }
173 }
174 /***********************************************************************/
175
176 SharedListVector* InputData::getSharedListVector(string label){
177         try {
178                 ifstream in;
179                 string  thisLabel;
180                 m->openInputFile(filename, in);
181                 
182                 if(in){
183
184                         if (format == "shared")  {
185                         
186                                 while (in.eof() != true) {
187                                         
188                                         SharedList = new SharedListVector(in);
189                                         thisLabel = SharedList->getLabel();
190                                         
191                                         //if you are at the last label
192                                         if (thisLabel == label) {  break;  }
193                                         //so you don't loose this memory
194                                         else {  delete SharedList;      }
195                                         m->gobble(in);
196                                 }
197
198                         }else{ SharedList = NULL;  }
199                                 
200                         in.close();
201                         return SharedList;
202                         
203                 }else{
204                         return NULL;
205                 }
206         }
207         catch(exception& e) {
208                 m->errorOut(e, "InputData", "getSharedListVector");
209                 exit(1);
210         }
211 }
212
213
214
215 /***********************************************************************/
216
217 SharedOrderVector* InputData::getSharedOrderVector(){
218         try {
219                 if(fileHandle){
220                         if (format == "sharedfile")  {
221                                 SharedOrder = new SharedOrderVector(fileHandle);
222                         }else{ SharedOrder = NULL;  }
223                                 
224                         m->gobble(fileHandle);
225                         return SharedOrder;
226                         
227                 }else{
228                         return NULL;
229                 }
230         }
231         catch(exception& e) {
232                 m->errorOut(e, "InputData", "getSharedOrderVector");
233                 exit(1);
234         }
235 }
236
237 /***********************************************************************/
238
239 SharedOrderVector* InputData::getSharedOrderVector(string label){
240         try {
241                 ifstream in;
242                 string  thisLabel;
243                 m->openInputFile(filename, in);
244                 
245                 if(in){
246
247                         if (format == "sharedfile")  {
248                         
249                                 while (in.eof() != true) {
250                                         
251                                         SharedOrder = new SharedOrderVector(in);
252                                         thisLabel = SharedOrder->getLabel();
253                                         
254                                         //if you are at the last label
255                                         if (thisLabel == label) {  break;  }
256                                         //so you don't loose this memory
257                                         else {  delete SharedOrder;     }
258                                         m->gobble(in);
259                                 }
260
261                         }else{ SharedOrder = NULL;  }
262                                 
263                         in.close();
264                         return SharedOrder;
265                         
266                 }else{
267                         return NULL;
268                 }
269         }
270         catch(exception& e) {
271                 m->errorOut(e, "InputData", "getSharedOrderVector");
272                 exit(1);
273         }
274 }
275
276
277
278 /***********************************************************************/
279
280 OrderVector* InputData::getOrderVector(){
281         try {
282                 if(fileHandle){
283                         if((format == "list") || (format == "listorder")) {
284                                 input = new ListVector(fileHandle);
285                         }
286                         else if (format == "shared")  {
287                                 input = new SharedListVector(fileHandle);
288                         }
289                         else if(format == "rabund"){
290                                 input = new RAbundVector(fileHandle);
291                         }
292                         else if(format == "order"){             
293                                 input = new OrderVector(fileHandle);
294                         }
295                         else if(format == "sabund"){
296                                 input = new SAbundVector(fileHandle);
297                         }
298                                                 
299                         m->gobble(fileHandle);
300                         
301                         output = new OrderVector();     
302                         *output = (input->getOrderVector());
303                 
304                         return output;
305                 }
306                 else{
307                         return NULL;
308                 }
309         }
310         catch(exception& e) {
311                 m->errorOut(e, "InputData", "getOrderVector");
312                 exit(1);
313         }
314 }
315
316 /***********************************************************************/
317 OrderVector* InputData::getOrderVector(string label){
318         try {
319         
320                 ifstream in;
321                 string  thisLabel;
322                 m->openInputFile(filename, in);
323                 
324                 if(in){
325                         if((format == "list") || (format == "listorder")) {
326                         
327                                 while (in.eof() != true) {
328                                         
329                                         input = new ListVector(in);
330                                         thisLabel = input->getLabel();
331                                         
332                                         //if you are at the last label
333                                         if (thisLabel == label) {  break;  }
334                                         //so you don't loose this memory
335                                         else {  delete input;   }
336                                         m->gobble(in);
337                                 }
338                         }
339                         else if (format == "shared")  {
340                                 
341                                 while (in.eof() != true) {
342                                         
343                                         input = new SharedListVector(in);
344                                         thisLabel = input->getLabel();
345                                         
346                                         //if you are at the last label
347                                         if (thisLabel == label) {  break;  }
348                                         //so you don't loose this memory
349                                         else {  delete input;   }
350                                         m->gobble(in);
351                                 }
352
353                         }
354                         else if(format == "rabund"){
355                                 
356                                 while (in.eof() != true) {
357                                         
358                                         input = new RAbundVector(in);
359                                         thisLabel = input->getLabel();
360                                         
361                                         //if you are at the last label
362                                         if (thisLabel == label) {  break;  }
363                                         //so you don't loose this memory
364                                         else {  delete input;   }
365                                         m->gobble(in);
366                                 }
367
368                         }
369                         else if(format == "order"){                     
370                                 
371                                 while (in.eof() != true) {
372                                         
373                                         input = new OrderVector(in);
374                                         thisLabel = input->getLabel();
375                                         
376                                         //if you are at the last label
377                                         if (thisLabel == label) {  break;  }
378                                         //so you don't loose this memory
379                                         else {  delete input;   }
380                                         m->gobble(in);
381                                 }
382
383                         }
384                         else if(format == "sabund"){
385                                 
386                                 while (in.eof() != true) {
387                                         
388                                         input = new SAbundVector(in);
389                                         thisLabel = input->getLabel();
390                                         
391                                         //if you are at the last label
392                                         if (thisLabel == label) {  break;  }
393                                         //so you don't loose this memory
394                                         else {  delete input;   }
395                                         m->gobble(in);
396                                         
397                                 }
398
399                         }
400                                                 
401                         in.close();             
402
403                         output = new OrderVector();
404                         *output = (input->getOrderVector());
405                         
406                         return output;
407
408                 }
409                 else{
410                         return NULL;
411                 }
412         }
413         catch(exception& e) {
414                 m->errorOut(e, "InputData", "getOrderVector");
415                 exit(1);
416         }
417 }
418
419 /***********************************************************************/
420 //this is used when you don't need the order vector
421 vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(){
422         try {
423                 if(fileHandle){
424                         if (format == "sharedfile")  {
425                                 SharedRAbundVector* SharedRAbund = new SharedRAbundVector(fileHandle);
426                                 if (SharedRAbund != NULL) {
427                                         return SharedRAbund->getSharedRAbundVectors();
428                                 }
429                         }else if (format == "shared") {
430                                 SharedList = new SharedListVector(fileHandle);
431                                 
432                                 if (SharedList != NULL) {
433                                         return SharedList->getSharedRAbundVector();
434                                 }
435                         }
436                         m->gobble(fileHandle);
437                 }
438                                 
439                 //this is created to signal to calling function that the input file is at eof
440                 vector<SharedRAbundVector*> null;  null.push_back(NULL);
441                 return null;
442                 
443         }
444         catch(exception& e) {
445                 m->errorOut(e, "InputData", "getSharedRAbundVectors");
446                 exit(1);
447         }
448 }
449 /***********************************************************************/
450 vector<SharedRAbundVector*> InputData::getSharedRAbundVectors(string label){
451         try {
452                 ifstream in;
453                 string  thisLabel;
454                 
455                 m->openInputFile(filename, in);
456                 m->saveNextLabel = "";
457         
458                 if(in){
459                         if (format == "sharedfile")  {
460                                 while (in.eof() != true) {
461                                         
462                                         SharedRAbundVector* SharedRAbund = new SharedRAbundVector(in);
463                                         if (SharedRAbund != NULL) {
464                                                 thisLabel = SharedRAbund->getLabel();
465                                         
466                                                 //if you are at the last label
467                                                 if (thisLabel == label) {  in.close(); return SharedRAbund->getSharedRAbundVectors();  }
468                                                 else {
469                                                         //so you don't loose this memory
470                                                         vector<SharedRAbundVector*> lookup = SharedRAbund->getSharedRAbundVectors(); 
471                                                         for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
472                                                         delete SharedRAbund;
473                                                 }
474                                         }else{  break;  }
475                                         m->gobble(in);
476                                         
477                                 }
478                         }else if (format == "shared") {
479                                 while (in.eof() != true) {
480                                         
481                                         SharedList = new SharedListVector(in);
482                                         
483                                         if (SharedList != NULL) {
484                                                 thisLabel = SharedList->getLabel();
485                                                 //if you are at the last label
486                                                 if (thisLabel == label) {  in.close(); return SharedList->getSharedRAbundVector();  }
487                                                 else {
488                                                         //so you don't loose this memory
489                                                         delete SharedList;
490                                                 }
491                                         }else{  break;  }
492                                         m->gobble(in);
493                                         
494                                 }
495                         
496                         }
497                 }
498                                 
499                 //this is created to signal to calling function that the input file is at eof
500                 vector<SharedRAbundVector*> null;  null.push_back(NULL);
501                 in.close();
502                 return null;
503         
504         }
505         catch(exception& e) {
506                 m->errorOut(e, "InputData", "getSharedRAbundVectors");
507                 exit(1);
508         }
509 }
510
511 /***********************************************************************/
512 //this is used when you don't need the order vector
513 vector<SharedRAbundFloatVector*> InputData::getSharedRAbundFloatVectors(){
514         try {
515                 if(fileHandle){
516                         if (format == "relabund")  {
517                                 SharedRAbundFloatVector* SharedRelAbund = new SharedRAbundFloatVector(fileHandle);
518                                 if (SharedRelAbund != NULL) {
519                                         return SharedRelAbund->getSharedRAbundFloatVectors();
520                                 }
521                         }else if (format == "sharedfile")  {
522                                 SharedRAbundVector* SharedRAbund = new SharedRAbundVector(fileHandle);
523                                 if (SharedRAbund != NULL) {
524                                         vector<SharedRAbundVector*> lookup = SharedRAbund->getSharedRAbundVectors(); 
525                                         vector<SharedRAbundFloatVector*> lookupFloat = SharedRAbund->getSharedRAbundFloatVectors(lookup); 
526                                         for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup.clear();
527                                         return lookupFloat;  
528                                 }
529                                                 
530                         }
531                         m->gobble(fileHandle);
532                 }
533                                 
534                 //this is created to signal to calling function that the input file is at eof
535                 vector<SharedRAbundFloatVector*> null;  null.push_back(NULL);
536                 return null;
537                 
538         }
539         catch(exception& e) {
540                 m->errorOut(e, "InputData", "getSharedRAbundFloatVectors");
541                 exit(1);
542         }
543 }
544 /***********************************************************************/
545 vector<SharedRAbundFloatVector*> InputData::getSharedRAbundFloatVectors(string label){
546         try {
547                 ifstream in;
548                 string  thisLabel;
549                 
550                 m->openInputFile(filename, in);
551                 m->saveNextLabel = "";
552                 
553                 if(in){
554                         if (format == "relabund")  {
555                                 while (in.eof() != true) {
556                                         
557                                         SharedRAbundFloatVector* SharedRelAbund = new SharedRAbundFloatVector(in);
558                                         if (SharedRelAbund != NULL) {
559                                                 thisLabel = SharedRelAbund->getLabel();
560                                                 //if you are at the last label
561                                                 if (thisLabel == label) {  in.close(); return SharedRelAbund->getSharedRAbundFloatVectors();  }
562                                                 else {
563                                                         //so you don't loose this memory
564                                                         vector<SharedRAbundFloatVector*> lookup = SharedRelAbund->getSharedRAbundFloatVectors(); 
565                                                         for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
566                                                         delete SharedRelAbund;
567                                                 }
568                                         }else{  break;  }
569                                         m->gobble(in);
570                                 }
571                         }else if (format == "sharedfile")  {
572                                 while (in.eof() != true) {
573                                         
574                                         SharedRAbundVector* SharedRAbund = new SharedRAbundVector(in);
575                                         if (SharedRAbund != NULL) {
576                                                 thisLabel = SharedRAbund->getLabel();
577                                                 
578                                                 //if you are at the last label
579                                                 if (thisLabel == label) {  
580                                                         in.close(); 
581                                                         vector<SharedRAbundVector*> lookup = SharedRAbund->getSharedRAbundVectors(); 
582                                                         vector<SharedRAbundFloatVector*> lookupFloat = SharedRAbund->getSharedRAbundFloatVectors(lookup); 
583                                                         for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup.clear();
584                                                         return lookupFloat;  
585                                                 }else {
586                                                         //so you don't loose this memory
587                                                         vector<SharedRAbundVector*> lookup = SharedRAbund->getSharedRAbundVectors(); 
588                                                         for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup.clear();
589                                                         delete SharedRAbund;
590                                                 }
591                                         }else{  break;  }
592                                         m->gobble(in);
593                                 }
594                         }       
595                 }
596                 
597                                 
598                 //this is created to signal to calling function that the input file is at eof
599                 vector<SharedRAbundFloatVector*> null;  null.push_back(NULL);
600                 in.close();
601                 return null;
602         
603         }
604         catch(exception& e) {
605                 m->errorOut(e, "InputData", "getSharedRAbundFloatVectors");
606                 exit(1);
607         }
608 }
609 /***********************************************************************/
610
611 SAbundVector* InputData::getSAbundVector(){
612         try {
613                 if(fileHandle){
614                         if (format == "list") {
615                                 input = new ListVector(fileHandle);
616                         }
617                         else if (format == "shared")  {
618                                 input = new SharedListVector(fileHandle);
619                         }
620                         else if(format == "rabund"){
621                                 input = new RAbundVector(fileHandle);
622                         }
623                         else if(format == "order"){                     
624                                 input = new OrderVector(fileHandle);
625                         }
626                         else if(format == "sabund"){
627                                 input = new SAbundVector(fileHandle);
628                         }                                       
629                         m->gobble(fileHandle);
630
631                         sabund = new SAbundVector();
632                         *sabund = (input->getSAbundVector());
633
634                         return sabund;
635                 }
636                 else{
637                         return NULL;
638                 }
639         }
640         catch(exception& e) {
641                 m->errorOut(e, "InputData", "getSAbundVector");
642                 exit(1);
643         }
644 }
645 /***********************************************************************/
646 SAbundVector* InputData::getSAbundVector(string label){
647         try {
648         
649                 ifstream in;
650                 string  thisLabel;
651                 m->openInputFile(filename, in);
652                 
653                 if(in){
654                         if (format == "list") {
655                         
656                                 while (in.eof() != true) {
657                                         
658                                         input = new ListVector(in);
659                                         thisLabel = input->getLabel();
660                                         
661                                         //if you are at the last label
662                                         if (thisLabel == label) {  break;  }
663                                         //so you don't loose this memory
664                                         else {  delete input;   }
665                                         m->gobble(in);
666                                 }
667                         }
668                         else if (format == "shared")  {
669                                 
670                                 while (in.eof() != true) {
671                                         
672                                         input = new SharedListVector(in);
673                                         thisLabel = input->getLabel();
674                                         
675                                         //if you are at the last label
676                                         if (thisLabel == label) {  break;  }
677                                         //so you don't loose this memory
678                                         else {  delete input;   }
679                                         m->gobble(in);
680                                 }
681
682                         }
683                         else if(format == "rabund"){
684                                 
685                                 while (in.eof() != true) {
686                                         
687                                         input = new RAbundVector(in);
688                                         thisLabel = input->getLabel();
689                                         
690                                         //if you are at the last label
691                                         if (thisLabel == label) {  break;  }
692                                         //so you don't loose this memory
693                                         else {  delete input;   }
694                                         m->gobble(in);
695                                 }
696
697                         }
698                         else if(format == "order"){                     
699                                 
700                                 while (in.eof() != true) {
701                                         
702                                         input = new OrderVector(in);
703                                         thisLabel = input->getLabel();
704                                         
705                                         //if you are at the last label
706                                         if (thisLabel == label) {  break;  }
707                                         //so you don't loose this memory
708                                         else {  delete input;   }
709                                         m->gobble(in);
710                                 }
711
712                         }
713                         else if(format == "sabund"){
714                                 
715                                 while (in.eof() != true) {
716                                         
717                                         input = new SAbundVector(in);
718                                         thisLabel = input->getLabel();
719                                         
720                                         //if you are at the last label
721                                         if (thisLabel == label) {  break;  }
722                                         //so you don't loose this memory
723                                         else {  delete input;   }
724                                         m->gobble(in);
725                                         
726                                 }
727
728                         }
729                         
730                         in.close();             
731
732                         sabund = new SAbundVector();
733                         *sabund = (input->getSAbundVector());
734
735                         return sabund;
736
737                 }
738                 else{
739                         return NULL;
740                 }
741         }
742         catch(exception& e) {
743                 m->errorOut(e, "InputData", "getSAbundVector");
744                 exit(1);
745         }
746 }
747
748 /***********************************************************************/
749 RAbundVector* InputData::getRAbundVector(){
750         try {
751                 if(fileHandle){
752                         if (format == "list") {
753                                 input = new ListVector(fileHandle);
754                         }
755                         else if (format == "shared")  {
756                                 input = new SharedListVector(fileHandle);
757                         }
758                         else if(format == "rabund"){
759                                 input = new RAbundVector(fileHandle);
760                         }
761                         else if(format == "order"){                     
762                                 input = new OrderVector(fileHandle);
763                         }
764                         else if(format == "sabund"){
765                                 input = new SAbundVector(fileHandle);
766                         }
767                         
768                         m->gobble(fileHandle);
769
770                         rabund = new RAbundVector();
771                         *rabund = (input->getRAbundVector());
772
773                         return rabund;
774                 }
775                 else{
776                         return NULL;
777                 }
778         }
779         catch(exception& e) {
780                 m->errorOut(e, "InputData", "getRAbundVector");
781                 exit(1);
782         }
783 }
784 /***********************************************************************/
785 RAbundVector* InputData::getRAbundVector(string label){
786         try {
787         
788                 ifstream in;
789                 string  thisLabel;
790                 m->openInputFile(filename, in);
791                 
792                 if(in){
793                         if (format == "list") {
794                         
795                                 while (in.eof() != true) {
796                                         
797                                         input = new ListVector(in);
798                                         thisLabel = input->getLabel();
799                                         
800                                         //if you are at the last label
801                                         if (thisLabel == label) {  break;  }
802                                         //so you don't loose this memory
803                                         else {  delete input;   }
804                                         m->gobble(in);
805                                 }
806                         }
807                         else if (format == "shared")  {
808                                 
809                                 while (in.eof() != true) {
810                                         
811                                         input = new SharedListVector(in);
812                                         thisLabel = input->getLabel();
813                                         
814                                         //if you are at the last label
815                                         if (thisLabel == label) {  break;  }
816                                         //so you don't loose this memory
817                                         else {  delete input;   }
818                                         m->gobble(in);
819                                 }
820
821                         }
822                         else if(format == "rabund"){
823                                 
824                                 while (in.eof() != true) {
825                                         
826                                         input = new RAbundVector(in);
827                                         thisLabel = input->getLabel();
828                                         
829                                         //if you are at the last label
830                                         if (thisLabel == label) {  break;  }
831                                         //so you don't loose this memory
832                                         else {  delete input;   }
833                                         m->gobble(in);
834                                 }
835
836                         }
837                         else if(format == "order"){                     
838                                 
839                                 while (in.eof() != true) {
840                                         
841                                         input = new OrderVector(in);
842                                         thisLabel = input->getLabel();
843                                         
844                                         //if you are at the last label
845                                         if (thisLabel == label) {  break;  }
846                                         //so you don't loose this memory
847                                         else {  delete input;   }
848                                         m->gobble(in);
849                                 }
850
851                         }
852                         else if(format == "sabund"){
853                                 
854                                 while (in.eof() != true) {
855                                         
856                                         input = new SAbundVector(in);
857                                         thisLabel = input->getLabel();
858                                         
859                                         //if you are at the last label
860                                         if (thisLabel == label) {  break;  }
861                                         //so you don't loose this memory
862                                         else {  delete input;   }
863                                         m->gobble(in);
864                                         
865                                 }
866
867                         }                       
868                         
869                         
870                         in.close();             
871
872                         rabund = new RAbundVector();
873                         *rabund = (input->getRAbundVector());
874
875                         return rabund;
876                 }
877                 else{
878                         return NULL;
879                 }
880         }
881         catch(exception& e) {
882                 m->errorOut(e, "InputData", "getRAbundVector");
883                 exit(1);
884         }
885 }
886
887 /***********************************************************************/
888
889
890