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