5 * Created by Thomas Ryabin on 4/22/09.
6 * Copyright 2009 __MyCompanyName__. All rights reserved.
10 #include "readnexus.h"
14 /*******************************************************************************/
15 ReadNexus::ReadNexus(string file) {
17 openInputFile(file, filehandle);
19 globaldata = GlobalData::getInstance();
22 cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function ReadTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
26 cout << "An unknown error has occurred in the ReadTree class function ReadTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
30 /*******************************************************************************/
31 ReadNexus::~ReadNexus(){
32 // for(int i = 0; i < sequencedb.getNumSeqs(); i++)
33 // delete sequencedb.get(i);
35 /*******************************************************************************/
36 void ReadNexus::read() {
40 for(int i = 0; i < 5; i++)
43 int numSeqs = atoi(temp.substr(temp.find_first_of("=")+1, temp.length() - temp.find_first_of("=") - 1).c_str());
45 for(int i = 0; i < 9; i++)
49 bool firstDone = false;
50 while(!filehandle.eof()){
52 filehandle >> sequence;
53 if(name.compare(";") != 0) {
55 Sequence newSeq(name, sequence);
56 sequencedb.add(newSeq);
59 sequencedb.set(count, sequencedb.get(count).getAligned() + sequence);
62 if(count == numSeqs) {
72 /*********************************************************************************/
73 SequenceDB* ReadNexus::getDB() {