X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readcolumn.cpp;h=53a8c4263dddc4687acc5a64cf7c5b1d27aac647;hb=cbaa068e77aeb15bb06f0695a36d8f757977ed64;hp=2782bd08a84efd8a596364f14c56015e04407241;hpb=260ae19c36cb11a53ddc5a75b5e507f8dd8b31d6;p=mothur.git diff --git a/readcolumn.cpp b/readcolumn.cpp index 2782bd0..53a8c42 100644 --- a/readcolumn.cpp +++ b/readcolumn.cpp @@ -15,8 +15,16 @@ ReadColumnMatrix::ReadColumnMatrix(string df) : distFile(df){ successOpen = m->openInputFile(distFile, fileHandle); + sim = false; } +/***********************************************************************/ + +ReadColumnMatrix::ReadColumnMatrix(string df, bool s) : distFile(df){ + + successOpen = m->openInputFile(distFile, fileHandle); + sim = s; +} /***********************************************************************/ @@ -47,16 +55,11 @@ int ReadColumnMatrix::read(NameAssignment* nameMap){ map::iterator itA = nameMap->find(firstName); map::iterator itB = nameMap->find(secondName); - if(itA == nameMap->end()){ - cerr << "AAError: Sequence '" << firstName << "' was not found in the names file, please correct\n"; exit(1); - } - if(itB == nameMap->end()){ - cerr << "ABError: Sequence '" << secondName << "' was not found in the names file, please correct\n"; exit(1); - } -//if (((itA->second == 8) && (itB->second == 1588)) || ((itA->second == 1588) && (itB->second == 8))) { cout << "found it" << endl; } + if(itA == nameMap->end()){ m->mothurOut("AAError: Sequence '" + firstName + "' was not found in the names file, please correct\n"); exit(1); } + if(itB == nameMap->end()){ m->mothurOut("ABError: Sequence '" + secondName + "' was not found in the names file, please correct\n"); exit(1); } if (distance == -1) { distance = 1000000; } - else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert. + else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert. if(distance < cutoff && itA != itB){ if(itA->second > itB->second){ @@ -109,15 +112,11 @@ int ReadColumnMatrix::read(NameAssignment* nameMap){ map::iterator itA = nameMap->find(firstName); map::iterator itB = nameMap->find(secondName); - if(itA == nameMap->end()){ - cerr << "BError: Sequence '" << firstName << "' was not found in the names file, please correct\n"; - } - if(itB == nameMap->end()){ - cerr << "BError: Sequence '" << secondName << "' was not found in the names file, please correct\n"; - } + if(itA == nameMap->end()){ m->mothurOut("AAError: Sequence '" + firstName + "' was not found in the names file, please correct\n"); exit(1); } + if(itB == nameMap->end()){ m->mothurOut("ABError: Sequence '" + secondName + "' was not found in the names file, please correct\n"); exit(1); } if (distance == -1) { distance = 1000000; } - else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert. + else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert. if(distance < cutoff && itA->second > itB->second){ PCell value(itA->second, itB->second, distance);