]> git.donarmstrong.com Git - mothur.git/blob - inputdata.cpp
ec23955513f42c218ed750be5471eb23ee08cd40
[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                                         
627                         m->gobble(fileHandle);
628
629                         sabund = new SAbundVector();
630                         *sabund = (input->getSAbundVector());
631
632                         return sabund;
633                 }
634                 else{
635                         return NULL;
636                 }
637         }
638         catch(exception& e) {
639                 m->errorOut(e, "InputData", "getSAbundVector");
640                 exit(1);
641         }
642 }
643 /***********************************************************************/
644 SAbundVector* InputData::getSAbundVector(string label){
645         try {
646         
647                 ifstream in;
648                 string  thisLabel;
649                 m->openInputFile(filename, in);
650                 
651                 if(in){
652                         if (format == "list") {
653                         
654                                 while (in.eof() != true) {
655                                         
656                                         input = new ListVector(in);
657                                         thisLabel = input->getLabel();
658                                         
659                                         //if you are at the last label
660                                         if (thisLabel == label) {  break;  }
661                                         //so you don't loose this memory
662                                         else {  delete input;   }
663                                         m->gobble(in);
664                                 }
665                         }
666                         else if (format == "shared")  {
667                                 
668                                 while (in.eof() != true) {
669                                         
670                                         input = new SharedListVector(in);
671                                         thisLabel = input->getLabel();
672                                         
673                                         //if you are at the last label
674                                         if (thisLabel == label) {  break;  }
675                                         //so you don't loose this memory
676                                         else {  delete input;   }
677                                         m->gobble(in);
678                                 }
679
680                         }
681                         else if(format == "rabund"){
682                                 
683                                 while (in.eof() != true) {
684                                         
685                                         input = new RAbundVector(in);
686                                         thisLabel = input->getLabel();
687                                         
688                                         //if you are at the last label
689                                         if (thisLabel == label) {  break;  }
690                                         //so you don't loose this memory
691                                         else {  delete input;   }
692                                         m->gobble(in);
693                                 }
694
695                         }
696                         else if(format == "order"){                     
697                                 
698                                 while (in.eof() != true) {
699                                         
700                                         input = new OrderVector(in);
701                                         thisLabel = input->getLabel();
702                                         
703                                         //if you are at the last label
704                                         if (thisLabel == label) {  break;  }
705                                         //so you don't loose this memory
706                                         else {  delete input;   }
707                                         m->gobble(in);
708                                 }
709
710                         }
711                         else if(format == "sabund"){
712                                 
713                                 while (in.eof() != true) {
714                                         
715                                         input = new SAbundVector(in);
716                                         thisLabel = input->getLabel();
717                                         
718                                         //if you are at the last label
719                                         if (thisLabel == label) {  break;  }
720                                         //so you don't loose this memory
721                                         else {  delete input;   }
722                                         m->gobble(in);
723                                         
724                                 }
725
726                         }
727                         
728                         in.close();             
729
730                         sabund = new SAbundVector();
731                         *sabund = (input->getSAbundVector());
732
733                         return sabund;
734
735                 }
736                 else{
737                         return NULL;
738                 }
739         }
740         catch(exception& e) {
741                 m->errorOut(e, "InputData", "getSAbundVector");
742                 exit(1);
743         }
744 }
745
746 /***********************************************************************/
747 RAbundVector* InputData::getRAbundVector(){
748         try {
749                 if(fileHandle){
750                         if (format == "list") {
751                                 input = new ListVector(fileHandle);
752                         }
753                         else if (format == "shared")  {
754                                 input = new SharedListVector(fileHandle);
755                         }
756                         else if(format == "rabund"){
757                                 input = new RAbundVector(fileHandle);
758                         }
759                         else if(format == "order"){                     
760                                 input = new OrderVector(fileHandle);
761                         }
762                         else if(format == "sabund"){
763                                 input = new SAbundVector(fileHandle);
764                         }
765                                         
766                         m->gobble(fileHandle);
767
768                         rabund = new RAbundVector();
769                         *rabund = (input->getRAbundVector());
770
771                         return rabund;
772                 }
773                 else{
774                         return NULL;
775                 }
776         }
777         catch(exception& e) {
778                 m->errorOut(e, "InputData", "getRAbundVector");
779                 exit(1);
780         }
781 }
782 /***********************************************************************/
783 RAbundVector* InputData::getRAbundVector(string label){
784         try {
785         
786                 ifstream in;
787                 string  thisLabel;
788                 m->openInputFile(filename, in);
789                 
790                 if(in){
791                         if (format == "list") {
792                         
793                                 while (in.eof() != true) {
794                                         
795                                         input = new ListVector(in);
796                                         thisLabel = input->getLabel();
797                                         
798                                         //if you are at the last label
799                                         if (thisLabel == label) {  break;  }
800                                         //so you don't loose this memory
801                                         else {  delete input;   }
802                                         m->gobble(in);
803                                 }
804                         }
805                         else if (format == "shared")  {
806                                 
807                                 while (in.eof() != true) {
808                                         
809                                         input = new SharedListVector(in);
810                                         thisLabel = input->getLabel();
811                                         
812                                         //if you are at the last label
813                                         if (thisLabel == label) {  break;  }
814                                         //so you don't loose this memory
815                                         else {  delete input;   }
816                                         m->gobble(in);
817                                 }
818
819                         }
820                         else if(format == "rabund"){
821                                 
822                                 while (in.eof() != true) {
823                                         
824                                         input = new RAbundVector(in);
825                                         thisLabel = input->getLabel();
826                                         
827                                         //if you are at the last label
828                                         if (thisLabel == label) {  break;  }
829                                         //so you don't loose this memory
830                                         else {  delete input;   }
831                                         m->gobble(in);
832                                 }
833
834                         }
835                         else if(format == "order"){                     
836                                 
837                                 while (in.eof() != true) {
838                                         
839                                         input = new OrderVector(in);
840                                         thisLabel = input->getLabel();
841                                         
842                                         //if you are at the last label
843                                         if (thisLabel == label) {  break;  }
844                                         //so you don't loose this memory
845                                         else {  delete input;   }
846                                         m->gobble(in);
847                                 }
848
849                         }
850                         else if(format == "sabund"){
851                                 
852                                 while (in.eof() != true) {
853                                         
854                                         input = new SAbundVector(in);
855                                         thisLabel = input->getLabel();
856                                         
857                                         //if you are at the last label
858                                         if (thisLabel == label) {  break;  }
859                                         //so you don't loose this memory
860                                         else {  delete input;   }
861                                         m->gobble(in);
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