X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readdistcommand.cpp;h=116e670a6e36f20df403cabf0610f7d60b4bbb5a;hb=9651e8e7172d86707b34af15e95ec60ad4c3c3f9;hp=4cf5c4e368067510ea7462dcd27eff9ac59d47ed;hpb=a85da7303079652b569291eacb9c2964060e072b;p=mothur.git diff --git a/readdistcommand.cpp b/readdistcommand.cpp index 4cf5c4e..116e670 100644 --- a/readdistcommand.cpp +++ b/readdistcommand.cpp @@ -17,24 +17,31 @@ ReadDistCommand::ReadDistCommand(){ format = globaldata->getFormat(); if (format == "column") { read = new ReadColumnMatrix(filename); } - else if (format == "phylip") { read = new ReadPhylipMatrix(filename); } - - if(globaldata->getPrecision() != ""){ - convert(globaldata->getPrecision(), precision); + else if (format == "phylip") { read = new ReadPhylipMatrix(filename); } + else if (format == "matrix") { + groupMap = new GroupMap(globaldata->getGroupFile()); + groupMap->readMap(); + globaldata->gGroupmap = groupMap; } - if(globaldata->getCutOff() != ""){ - convert(globaldata->getCutOff(), cutoff); - cutoff += (5 / (precision * 10.0)); - } - read->setCutoff(cutoff); + if (format != "matrix" ) { + if(globaldata->getPrecision() != ""){ + convert(globaldata->getPrecision(), precision); + } + + if(globaldata->getCutOff() != ""){ + convert(globaldata->getCutOff(), cutoff); + cutoff += (5 / (precision * 10.0)); + } + read->setCutoff(cutoff); - if(globaldata->getNameFile() != ""){ - nameMap = new NameAssignment(globaldata->getNameFile()); - nameMap->readMap(1,2); - } - else{ - nameMap = NULL; + if(globaldata->getNameFile() != ""){ + nameMap = new NameAssignment(globaldata->getNameFile()); + nameMap->readMap(1,2); + } + else{ + nameMap = NULL; + } } } @@ -57,9 +64,17 @@ ReadDistCommand::~ReadDistCommand(){ //********************************************************************************************************************** int ReadDistCommand::execute(){ try { - read->read(nameMap); - globaldata->setListVector(read->getListVector()); - globaldata->setSparseMatrix(read->getMatrix()); + + if (format == "matrix") { + ifstream in; + openInputFile(filename, in); + matrix = new FullMatrix(in); //reads the matrix file + globaldata->gMatrix = matrix; //save matrix for coverage commands + }else { + read->read(nameMap); + globaldata->setListVector(read->getListVector()); + globaldata->setSparseMatrix(read->getMatrix()); + } return 0; } catch(exception& e) {