X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readtreecommand.cpp;h=89efc9abcf0057f68189ddad6975b5e1464fca09;hb=e03de8796670a0c747aed63483daa09c8b86aea0;hp=fdfdb050f22c4ccc281646d1d56c8a5aa6b33806;hpb=0c764f30117bc3ae41413e12071070330c3d6a3d;p=mothur.git diff --git a/readtreecommand.cpp b/readtreecommand.cpp index fdfdb05..89efc9a 100644 --- a/readtreecommand.cpp +++ b/readtreecommand.cpp @@ -76,8 +76,20 @@ ReadTreeCommand::ReadTreeCommand(string option) { groupfile = validParameter.validFile(parameters, "group", true); if (groupfile == "not open") { abort = true; } - else if (groupfile == "not found") { groupfile = ""; m->mothurOut("group is a required parameter for the read.tree command."); m->mothurOutEndLine(); abort = true; } - else { + else if (groupfile == "not found") { + groupfile = ""; + + m->mothurOut("You have not provided a group file. I am assumming all sequence are from the same group."); m->mothurOutEndLine(); + + if (treefile != "") { Tree* tree = new Tree(treefile); delete tree; } //extracts names from tree to make faked out groupmap + + globaldata->setGroupFile(groupfile); + //read in group map info. + treeMap = new TreeMap(); + for (int i = 0; i < globaldata->Treenames.size(); i++) { treeMap->addSeq(globaldata->Treenames[i], "Group1"); } + globaldata->gTreemap = treeMap; + + }else { globaldata->setGroupFile(groupfile); //read in group map info. treeMap = new TreeMap(groupfile); @@ -227,7 +239,7 @@ int ReadTreeCommand::readNamesFile() { vector dupNames; m->splitAtComma(second, dupNames); - for (int i = 0; i < dupNames.size(); i++) { nameMap[dupNames[i]] = dupNames[i]; } + for (int i = 0; i < dupNames.size(); i++) { nameMap[dupNames[i]] = dupNames[i]; if ((groupfile == "") && (i != 0)) { globaldata->gTreemap->addSeq(dupNames[i], "Group1"); } } }else { m->mothurOut(first + " has already been seen in namefile, disregarding names file."); m->mothurOutEndLine(); in.close(); globaldata->names.clear(); namefile = ""; return 1; } } in.close();