]> git.donarmstrong.com Git - mothur.git/blob - readseqscommand.cpp
altered venn command to make use of sharedchao for any number of groups, fixed window...
[mothur.git] / readseqscommand.cpp
1 /*
2  *  readseqscommand.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 4/13/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "readseqscommand.h"
11
12 //**********************************************************************************************************************
13 ReadSeqsCommand::ReadSeqsCommand(){
14         try {
15                 globaldata = GlobalData::getInstance();
16                 filename = globaldata->inputFileName;
17                 if(globaldata->getFastaFile().compare("") != 0) {
18                         readFasta = new ReadFasta(filename);
19                         readFasta->read();
20                         globaldata->gSequenceDB = readFasta->getDB();
21                 }
22                 else if(globaldata->getNexusFile().compare("") != 0) {
23                         readNexus = new ReadNexus(filename);
24                         readNexus->read();
25                         globaldata->gSequenceDB = readNexus->getDB();
26                 }
27                 else if(globaldata->getClustalFile().compare("") != 0) {
28                         readClustal = new ReadClustal(filename);
29                         readClustal->read();
30                         globaldata->gSequenceDB = readClustal->getDB();
31                 }
32                 else if(globaldata->getPhylipFile().compare("") != 0) {
33                         readPhylip = new ReadPhylip(filename);
34                         readPhylip->read();
35                         globaldata->gSequenceDB = readPhylip->getDB();
36                 }
37         }
38         catch(exception& e) {
39                 cout << "Standard Error: " << e.what() << " has occurred in the ReadSeqsCommand class Function ReadSeqsCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
40                 exit(1);
41         }
42         catch(...) {
43                 cout << "An unknown error has occurred in the ReadSeqsCommand class function ReadSeqsCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
44                 exit(1);
45         }
46 }
47
48 //**********************************************************************************************************************
49
50 ReadSeqsCommand::~ReadSeqsCommand(){
51         //delete readFasta->getDB();
52 //      delete readNexus->getDB();
53 //      delete readClustal->getDB();
54 //      delete readPhylip->getDB();
55 }
56
57 //**********************************************************************************************************************
58
59 int ReadSeqsCommand::execute(){
60         try {
61                 filebuf fb;
62                 
63                 //fb.open ("fasta.txt",ios::out);
64                 //readFasta->read();
65 //              SequenceDB* db = readFasta->getDB();
66                 
67                 //fb.open("nexus.txt",ios::out);
68 //              readNexus->read();
69 //              SequenceDB* db = readNexus->getDB();    
70
71                 //fb.open("clustal.txt",ios::out);
72 //              readClustal->read();
73 //              SequenceDB* db = readClustal->getDB();
74                 
75                 //fb.open("phylip.txt",ios::out);
76 //              readPhylip->read();
77 //              SequenceDB* db = readPhylip->getDB();
78
79                 
80                 
81                 //for(int i = 0; i < db->size(); i++) {
82 //                      cout << db->get(i).getLength() << "\n" << db->get(i).getName() << ": " << db->get(i).getAligned() << "\n\n";
83 //              }
84
85                 //ostream os(&fb);
86 //              db->print(os);
87 //              fb.close();
88
89                 return 0;
90         }
91         catch(exception& e) {
92                 cout << "Standard Error: " << e.what() << " has occurred in the ReadOtuCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
93                 exit(1);
94         }
95         catch(...) {
96                 cout << "An unknown error has occurred in the ReadOtuCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
97                 exit(1);
98         }
99 }
100 //**********************************************************************************************************************