Permalink
Browse files

Adds common functions to phylotype

  • Loading branch information...
1 parent 72ec06e commit c7179b4852cbfd1b797646a0221b6574568ce5bc @mothur-westcott mothur-westcott committed Aug 24, 2016
Showing with 1 addition and 31 deletions.
  1. +1 −29 source/commands/phylotypecommand.cpp
  2. +0 −2 source/commands/phylotypecommand.h
@@ -161,7 +161,7 @@ PhylotypeCommand::PhylotypeCommand(string option) {
namefile = validParameter.validFile(parameters, "name", true);
if (namefile == "not open") { namefile = ""; abort = true; }
else if (namefile == "not found") { namefile = ""; }
- else { readNamesFile(); m->setNameFile(namefile); }
+ else { m->readNames(namefile, namemap); m->setNameFile(namefile); }
countfile = validParameter.validFile(parameters, "count", true);
if (countfile == "not open") { abort = true; countfile = ""; }
@@ -384,32 +384,4 @@ int PhylotypeCommand::execute(){
exit(1);
}
}
-/*****************************************************************/
-int PhylotypeCommand::readNamesFile() {
- try {
-
- ifstream in;
- m->openInputFile(namefile, in);
-
- string first, second;
- map<string, string>::iterator itNames;
-
- while(!in.eof()) {
- in >> first >> second; m->gobble(in);
-
- itNames = namemap.find(first);
- if (itNames == namemap.end()) {
- namemap[first] = second;
- }else { m->mothurOut(first + " has already been seen in namefile, disregarding names file."); m->mothurOutEndLine(); in.close(); namemap.clear(); namefile = ""; return 1; }
- }
- in.close();
-
- return 0;
- }
- catch(exception& e) {
- m->errorOut(e, "PhylotypeCommand", "readNamesFile");
- exit(1);
- }
-}
-
/**********************************************************************************************************************/
@@ -47,8 +47,6 @@ class PhylotypeCommand : public Command {
map<int, int> parentNodes;
map<int, int>::iterator itCurrent;
- int readNamesFile();
-
};

0 comments on commit c7179b4

Please sign in to comment.