try {
ifstream in;
- openInputFile(userTfile, in);
+ m->openInputFile(userTfile, in);
//read in users taxonomy file and add sequences to tree
string name, tax;
while(!in.eof()){
- in >> name >> tax; gobble(in);
+ in >> name >> tax; m->gobble(in);
addSeqToTree(name, tax);
//print labels
out << "taxlevel\t rankID\t taxon\t daughterlevels\t total\t";
if (groupmap != NULL) {
+ //so the labels match the counts below, since the map sorts them automatically...
+ //sort(groupmap->namesOfGroups.begin(), groupmap->namesOfGroups.end());
+
for (int i = 0; i < groupmap->namesOfGroups.size(); i++) {
out << groupmap->namesOfGroups[i] << '\t';
}
map<string, int>::iterator itGroup;
if (groupmap != NULL) {
- for (itGroup = tree[0].groupCount.begin(); itGroup != tree[0].groupCount.end(); itGroup++) {
- out << itGroup->second << '\t';
- }
+ //for (itGroup = tree[0].groupCount.begin(); itGroup != tree[0].groupCount.end(); itGroup++) {
+ // out << itGroup->second << '\t';
+ //}
+ for (int i = 0; i < groupmap->namesOfGroups.size(); i++) { out << tree[0].groupCount[groupmap->namesOfGroups[i]] << '\t'; }
}
out << endl;
map<string, int>::iterator itGroup;
if (groupmap != NULL) {
- for (itGroup = tree[it->second].groupCount.begin(); itGroup != tree[it->second].groupCount.end(); itGroup++) {
- out << itGroup->second << '\t';
- }
+ //for (itGroup = tree[it->second].groupCount.begin(); itGroup != tree[it->second].groupCount.end(); itGroup++) {
+ // out << itGroup->second << '\t';
+ //}
+ for (int i = 0; i < groupmap->namesOfGroups.size(); i++) { out << tree[it->second].groupCount[groupmap->namesOfGroups[i]] << '\t'; }
}
out << endl;
}
/**************************************************************************************************/
void PhyloSummary::readTreeStruct(ifstream& in){
try {
+
+ //read version
+ string line = m->getline(in); m->gobble(in);
+
int num;
- in >> num; gobble(in);
+ in >> num; m->gobble(in);
tree.resize(num);
+
+ in >> maxLevel; m->gobble(in);
//read the tree file
for (int i = 0; i < tree.size(); i++) {
tree[i].total = 0;
- gobble(in);
+ m->gobble(in);
- if (tree[i].level > maxLevel) { maxLevel = tree[i].level; }
+ //if (tree[i].level > maxLevel) { maxLevel = tree[i].level; }
}
}