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 globaldata->gGroupmap = groupMap;
27 if (format != "matrix" ) {
28 if(globaldata->getPrecision() != ""){
29 convert(globaldata->getPrecision(), precision);
32 if(globaldata->getCutOff() != ""){
33 convert(globaldata->getCutOff(), cutoff);
34 cutoff += (5 / (precision * 10.0));
36 read->setCutoff(cutoff);
38 if(globaldata->getNameFile() != ""){
39 nameMap = new NameAssignment(globaldata->getNameFile());
40 nameMap->readMap(1,2);
49 cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
53 cout << "An unknown error has occurred in the ReadDistCommand class function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
58 //**********************************************************************************************************************
59 ReadDistCommand::~ReadDistCommand(){
64 //**********************************************************************************************************************
65 int ReadDistCommand::execute(){
68 if (format == "matrix") {
70 openInputFile(filename, in);
71 matrix = new FullMatrix(in); //reads the matrix file
72 globaldata->gMatrix = matrix; //save matrix for coverage commands
75 globaldata->gListVector = read->getListVector();
76 globaldata->gSparseMatrix = read->getMatrix();
81 cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
85 cout << "An unknown error has occurred in the ReadDistCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";