setNamesOfGroups(seqGroup);
treemap[seqName].groupname = seqGroup; //store data in map
-
+
+ it2 = seqsPerGroup.find(seqGroup);
+ if (it2 == seqsPerGroup.end()) { //if it's a new group
+ seqsPerGroup[seqGroup] = 1;
+ }else {//it's a group we already have
+ seqsPerGroup[seqGroup]++;
+ }
+
gobble(fileHandle);
}
fileHandle.close();
}
/************************************************************/
void TreeMap::setIndex(string seq, int index) {
- treemap[seq].vectorIndex = index;
+ it = treemap.find(seq);
+ if (it != treemap.end()) { //sequence name was in group file
+ treemap[seq].vectorIndex = index;
+ }else {
+ treemap[seq].vectorIndex = index;
+ treemap[seq].groupname = "not found";
+ }
}
/************************************************************/
int TreeMap::getIndex(string seq) {
namesOfGroups.push_back(seqGroup); //new group
}
}
-
+/************************************************************/
+bool TreeMap::isValidGroup(string groupname) {
+ try {
+ for (int i = 0; i < namesOfGroups.size(); i++) {
+ if (groupname == namesOfGroups[i]) { return true; }
+ }
+
+ return false;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function isValidGroup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the TreeMap class function isValidGroup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
/***********************************************************************/
void TreeMap::print(ostream& output){
}
}
-/************************************************************/
\ No newline at end of file
+/************************************************************/
+void TreeMap::makeSim(GroupMap* groupmap) {
+ try {
+ //set names of groups
+ namesOfGroups = groupmap->namesOfGroups;
+
+ //set names of seqs to names of groups
+ namesOfSeqs = groupmap->namesOfGroups;
+
+ // make map where key and value are both the group name since that what the tree.groups command wants
+ for (int i = 0; i < namesOfGroups.size(); i++) {
+ treemap[namesOfGroups[i]].groupname = namesOfGroups[i];
+ seqsPerGroup[namesOfGroups[i]] = 1;
+ }
+
+ numGroups = namesOfGroups.size();
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function make. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the TreeMap class function make. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/************************************************************/
+