5 * Created by Sarah Westcott on 1/20/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "readdistcommand.h"
12 ReadDistCommand::ReadDistCommand(){
14 globaldata = GlobalData::getInstance();
16 filename = globaldata->inputFileName;
17 format = globaldata->getFormat();
19 if (format == "column") { read = new ReadColumnMatrix(filename); }
20 else if (format == "phylip") { read = new ReadPhylipMatrix(filename); }
21 else if (format == "matrix") {
22 groupMap = new GroupMap(globaldata->getGroupFile());
24 //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
25 globaldata->gGroupmap = groupMap;
28 if (format != "matrix" ) {
29 if(globaldata->getPrecision() != ""){
30 convert(globaldata->getPrecision(), precision);
33 if(globaldata->getCutOff() != ""){
34 convert(globaldata->getCutOff(), cutoff);
35 cutoff += (5 / (precision * 10.0));
37 read->setCutoff(cutoff);
39 if(globaldata->getNameFile() != ""){
40 nameMap = new NameAssignment(globaldata->getNameFile());
41 nameMap->readMap(1,2);
50 cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
54 cout << "An unknown error has occurred in the ReadDistCommand class function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
59 //**********************************************************************************************************************
60 ReadDistCommand::~ReadDistCommand(){
65 //**********************************************************************************************************************
66 int ReadDistCommand::execute(){
69 if (format == "matrix") {
71 openInputFile(filename, in);
72 matrix = new FullMatrix(in); //reads the matrix file
73 //memory leak prevention
74 //if (globaldata->gMatrix != NULL) { delete globaldata->gMatrix; }
75 globaldata->gMatrix = matrix; //save matrix for coverage commands
78 globaldata->gListVector = read->getListVector();
79 globaldata->gSparseMatrix = read->getMatrix();
84 cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
88 cout << "An unknown error has occurred in the ReadDistCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";