]> git.donarmstrong.com Git - mothur.git/blob - readotucommand.cpp
put back no command and worked on libshuff
[mothur.git] / readotucommand.cpp
1 /*
2  *  readotu.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 1/20/09.
6  *  Copyright 2009 Schloss Lab UMASS AMherst. All rights reserved.
7  *
8  */
9
10 #include "readotucommand.h"
11
12 //**********************************************************************************************************************
13 ReadOtuCommand::ReadOtuCommand(){
14         try {
15                 globaldata = GlobalData::getInstance();
16                 filename = globaldata->inputFileName;
17                 read = new ReadPhilFile(filename);
18                 if (globaldata->getFormat() == "shared") {
19                         //read in group map info.
20                         groupMap = new GroupMap(globaldata->getGroupFile());
21                 }
22         }
23         catch(exception& e) {
24                 cout << "Standard Error: " << e.what() << " has occurred in the ReadOtuCommand class Function ReadOtuCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
25                 exit(1);
26         }
27         catch(...) {
28                 cout << "An unknown error has occurred in the ReadOtuCommand class function ReadOtuCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
29                 exit(1);
30         }
31 }
32
33 //**********************************************************************************************************************
34
35 ReadOtuCommand::~ReadOtuCommand(){
36         delete read;
37 }
38
39 //**********************************************************************************************************************
40
41 int ReadOtuCommand::execute(){
42         try {
43                 read->read(&*globaldata); 
44                 if (globaldata->getFormat() == "shared") {
45                         groupMap->readMap();
46                         
47                         //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap;  }
48                         globaldata->gGroupmap = groupMap;
49                 
50                         shared = new SharedCommand();
51                         shared->execute();
52                         parselist = new ParseListCommand();
53                         parselist->execute();
54                 }
55                 return 0;
56         }
57         catch(exception& e) {
58                 cout << "Standard Error: " << e.what() << " has occurred in the ReadOtuCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
59                 exit(1);
60         }
61         catch(...) {
62                 cout << "An unknown error has occurred in the ReadOtuCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
63                 exit(1);
64         }
65 }
66 //**********************************************************************************************************************