5 // Created by Sarah Westcott on 6/26/12.
6 // Copyright (c) 2012 Schloss Lab. All rights reserved.
9 #include "counttable.h"
11 /************************************************************/
12 int CountTable::createTable(set<string>& n, map<string, string>& g, set<string>& gs) {
17 indexGroupMap.clear();
20 for (set<string>::iterator it = gs.begin(); it != gs.end(); it++) { groups.push_back(*it); hasGroups = true; }
21 numGroups = groups.size();
22 totalGroups.resize(numGroups, 0);
24 //sort groups to keep consistent with how we store the groups in groupmap
25 sort(groups.begin(), groups.end());
26 for (int i = 0; i < groups.size(); i++) { indexGroupMap[groups[i]] = i; }
27 m->setAllGroups(groups);
31 for (set<string>::iterator it = n.begin(); it != n.end(); it++) {
33 if (m->control_pressed) { break; }
37 vector<int> groupCounts; groupCounts.resize(numGroups, 0);
38 map<string, string>::iterator itGroup = g.find(seqName);
40 if (itGroup != g.end()) {
41 groupCounts[indexGroupMap[itGroup->second]] = 1;
42 totalGroups[indexGroupMap[itGroup->second]]++;
43 }else { m->mothurOut("[ERROR]: Your group file does not contain " + seqName + ". Please correct."); m->mothurOutEndLine(); }
45 map<string, int>::iterator it2 = indexNameMap.find(seqName);
46 if (it2 == indexNameMap.end()) {
47 if (hasGroups) { counts.push_back(groupCounts); }
48 indexNameMap[seqName] = uniques;
56 for (int i = 0; i < totalGroups.size(); i++) {
57 if (totalGroups[i] == 0) { m->mothurOut("\nRemoving group: " + groups[i] + " because all sequences have been removed.\n"); removeGroup(groups[i]); i--; }
64 m->errorOut(e, "CountTable", "createTable");
68 /************************************************************/
69 bool CountTable::testGroups(string file) {
71 m = MothurOut::getInstance(); hasGroups = false; total = 0;
73 m->openInputFile(file, in);
75 string headers = m->getline(in); m->gobble(in);
76 vector<string> columnHeaders = m->splitWhiteSpace(headers);
77 if (columnHeaders.size() > 2) { hasGroups = true; }
81 m->errorOut(e, "CountTable", "readTable");
85 /************************************************************/
86 int CountTable::createTable(string namefile, string groupfile, bool createGroup) {
89 if (namefile == "") { m->mothurOut("[ERROR]: namefile cannot be blank when creating a count table.\n"); m->control_pressed = true; }
95 indexGroupMap.clear();
98 map<int, string> originalGroupIndexes;
100 if (groupfile != "") {
102 groupMap = new GroupMap(groupfile); groupMap->readMap();
103 numGroups = groupMap->getNumGroups();
104 groups = groupMap->getNamesOfGroups();
105 totalGroups.resize(numGroups, 0);
106 }else if(createGroup) {
109 groups.push_back("Group1");
110 totalGroups.resize(numGroups, 0);
112 //sort groups to keep consistent with how we store the groups in groupmap
113 sort(groups.begin(), groups.end());
114 for (int i = 0; i < groups.size(); i++) { indexGroupMap[groups[i]] = i; }
115 m->setAllGroups(groups);
125 m->openInputFile(namefile, in);
129 if (m->control_pressed) { break; }
131 string firstCol, secondCol;
132 in >> firstCol; m->gobble(in); in >> secondCol; m->gobble(in);
134 m->checkName(firstCol);
135 m->checkName(secondCol);
137 vector<string> names;
138 m->splitAtChar(secondCol, names, ',');
140 map<string, int> groupCounts;
142 if (groupfile != "") {
144 for (int i = 0; i < groups.size(); i++) { groupCounts[groups[i]] = 0; }
146 //get counts for each of the users groups
147 for (int i = 0; i < names.size(); i++) {
148 string group = groupMap->getGroup(names[i]);
150 if (group == "not found") { m->mothurOut("[ERROR]: " + names[i] + " is not in your groupfile, please correct."); m->mothurOutEndLine(); error=true; }
152 map<string, int>::iterator it = groupCounts.find(group);
154 //if not found, then this sequence is not from a group we care about
155 if (it != groupCounts.end()) {
161 }else if (createGroup) {
162 groupCounts["Group1"]=0;
163 for (int i = 0; i < names.size(); i++) {
164 string group = "Group1";
165 groupCounts["Group1"]++; thisTotal++;
167 }else { thisTotal = names.size(); }
169 //if group info, then read it
170 vector<int> thisGroupsCount; thisGroupsCount.resize(numGroups, 0);
171 for (int i = 0; i < numGroups; i++) {
172 thisGroupsCount[i] = groupCounts[groups[i]];
173 totalGroups[i] += thisGroupsCount[i];
176 map<string, int>::iterator it = indexNameMap.find(firstCol);
177 if (it == indexNameMap.end()) {
178 if (hasGroups) { counts.push_back(thisGroupsCount); }
179 indexNameMap[firstCol] = uniques;
180 totals.push_back(thisTotal);
185 m->mothurOut("[ERROR]: Your count table contains more than 1 sequence named " + firstCol + ", sequence names must be unique. Please correct."); m->mothurOutEndLine();
190 if (error) { m->control_pressed = true; }
191 else { //check for zero groups
193 for (int i = 0; i < totalGroups.size(); i++) {
194 if (totalGroups[i] == 0) { m->mothurOut("\nRemoving group: " + groups[i] + " because all sequences have been removed.\n"); removeGroup(groups[i]); i--; }
198 if (groupfile != "") { delete groupMap; }
202 catch(exception& e) {
203 m->errorOut(e, "CountTable", "createTable");
207 /************************************************************/
208 int CountTable::readTable(string file) {
212 m->openInputFile(filename, in);
214 string headers = m->getline(in); m->gobble(in);
215 vector<string> columnHeaders = m->splitWhiteSpace(headers);
220 indexGroupMap.clear();
221 indexNameMap.clear();
223 map<int, string> originalGroupIndexes;
224 if (columnHeaders.size() > 2) { hasGroups = true; numGroups = columnHeaders.size() - 2; }
225 for (int i = 2; i < columnHeaders.size(); i++) { groups.push_back(columnHeaders[i]); originalGroupIndexes[i-2] = columnHeaders[i]; totalGroups.push_back(0); }
226 //sort groups to keep consistent with how we store the groups in groupmap
227 sort(groups.begin(), groups.end());
228 for (int i = 0; i < groups.size(); i++) { indexGroupMap[groups[i]] = i; }
229 m->setAllGroups(groups);
238 if (m->control_pressed) { break; }
240 in >> name; m->gobble(in); in >> thisTotal; m->gobble(in);
241 if (m->debug) { m->mothurOut("[DEBUG]: " + name + '\t' + toString(thisTotal) + "\n"); }
243 //if group info, then read it
244 vector<int> groupCounts; groupCounts.resize(numGroups, 0);
245 for (int i = 0; i < numGroups; i++) { int thisIndex = indexGroupMap[originalGroupIndexes[i]]; in >> groupCounts[thisIndex]; m->gobble(in); totalGroups[thisIndex] += groupCounts[thisIndex]; }
247 map<string, int>::iterator it = indexNameMap.find(name);
248 if (it == indexNameMap.end()) {
249 if (hasGroups) { counts.push_back(groupCounts); }
250 indexNameMap[name] = uniques;
251 totals.push_back(thisTotal);
256 m->mothurOut("[ERROR]: Your count table contains more than 1 sequence named " + name + ", sequence names must be unique. Please correct."); m->mothurOutEndLine();
261 if (error) { m->control_pressed = true; }
262 else { //check for zero groups
264 for (int i = 0; i < totalGroups.size(); i++) {
265 if (totalGroups[i] == 0) { m->mothurOut("\nRemoving group: " + groups[i] + " because all sequences have been removed.\n"); removeGroup(groups[i]); i--; }
272 catch(exception& e) {
273 m->errorOut(e, "CountTable", "readTable");
277 /************************************************************/
278 int CountTable::printTable(string file) {
281 m->openOutputFile(file, out);
282 out << "Representative_Sequence\ttotal\t";
283 for (int i = 0; i < groups.size(); i++) { out << groups[i] << '\t'; }
286 map<int, string> reverse; //use this to preserve order
287 for (map<string, int>::iterator it = indexNameMap.begin(); it !=indexNameMap.end(); it++) { reverse[it->second] = it->first; }
289 for (int i = 0; i < totals.size(); i++) {
290 map<int, string>::iterator itR = reverse.find(i);
292 if (itR != reverse.end()) { //will equal end if seqs were removed because remove just removes from indexNameMap
293 out << itR->second << '\t' << totals[i] << '\t';
295 for (int j = 0; j < groups.size(); j++) {
296 out << counts[i][j] << '\t';
302 /*for (map<string, int>::iterator itNames = indexNameMap.begin(); itNames != indexNameMap.end(); itNames++) {
303 out << itNames->first << '\t' << totals[itNames->second] << '\t';
306 for (int i = 0; i < groups.size(); i++) {
307 out << counts[itNames->second][i] << '\t';
315 catch(exception& e) {
316 m->errorOut(e, "CountTable", "printTable");
320 /************************************************************/
321 int CountTable::printHeaders(ofstream& out) {
323 out << "Representative_Sequence\ttotal\t";
324 for (int i = 0; i < groups.size(); i++) { out << groups[i] << '\t'; }
328 catch(exception& e) {
329 m->errorOut(e, "CountTable", "printHeaders");
333 /************************************************************/
334 int CountTable::printSeq(ofstream& out, string seqName) {
336 map<string, int>::iterator it = indexNameMap.find(seqName);
337 if (it == indexNameMap.end()) {
338 m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
340 out << it->first << '\t' << totals[it->second] << '\t';
342 for (int i = 0; i < groups.size(); i++) {
343 out << counts[it->second][i] << '\t';
350 catch(exception& e) {
351 m->errorOut(e, "CountTable", "printSeq");
355 /************************************************************/
356 //group counts for a seq
357 vector<int> CountTable::getGroupCounts(string seqName) {
361 map<string, int>::iterator it = indexNameMap.find(seqName);
362 if (it == indexNameMap.end()) {
363 m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
365 temp = counts[it->second];
367 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
371 catch(exception& e) {
372 m->errorOut(e, "CountTable", "getGroupCounts");
376 /************************************************************/
377 //total number of sequences for the group
378 int CountTable::getGroupCount(string groupName) {
381 map<string, int>::iterator it = indexGroupMap.find(groupName);
382 if (it == indexGroupMap.end()) {
383 m->mothurOut("[ERROR]: group " + groupName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
385 return totalGroups[it->second];
387 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
391 catch(exception& e) {
392 m->errorOut(e, "CountTable", "getGroupCount");
396 /************************************************************/
397 //total number of sequences for the seq for the group
398 int CountTable::getGroupCount(string seqName, string groupName) {
401 map<string, int>::iterator it = indexGroupMap.find(groupName);
402 if (it == indexGroupMap.end()) {
403 m->mothurOut("[ERROR]: group " + groupName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
405 map<string, int>::iterator it2 = indexNameMap.find(seqName);
406 if (it2 == indexNameMap.end()) {
407 m->mothurOut("[ERROR]: seq " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
409 return counts[it2->second][it->second];
412 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
416 catch(exception& e) {
417 m->errorOut(e, "CountTable", "getGroupCount");
421 /************************************************************/
422 //set the number of sequences for the seq for the group
423 int CountTable::setAbund(string seqName, string groupName, int num) {
426 map<string, int>::iterator it = indexGroupMap.find(groupName);
427 if (it == indexGroupMap.end()) {
428 m->mothurOut("[ERROR]: " + groupName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
430 map<string, int>::iterator it2 = indexNameMap.find(seqName);
431 if (it2 == indexNameMap.end()) {
432 m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
434 int oldCount = counts[it2->second][it->second];
435 counts[it2->second][it->second] = num;
436 totalGroups[it->second] += (num - oldCount);
437 total += (num - oldCount);
438 totals[it2->second] += (num - oldCount);
441 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
445 catch(exception& e) {
446 m->errorOut(e, "CountTable", "set");
450 /************************************************************/
452 int CountTable::addGroup(string groupName) {
454 bool sanity = m->inUsersGroups(groupName, groups);
455 if (sanity) { m->mothurOut("[ERROR]: " + groupName + " is already in the count table, cannot add again.\n"); m->control_pressed = true; return 0; }
457 groups.push_back(groupName);
458 if (!hasGroups) { counts.resize(uniques); }
460 for (int i = 0; i < counts.size(); i++) { counts[i].push_back(0); }
461 totalGroups.push_back(0);
462 indexGroupMap[groupName] = groups.size()-1;
463 map<string, int> originalGroupMap = indexGroupMap;
465 //important to play well with others, :)
466 sort(groups.begin(), groups.end());
468 //fix indexGroupMap && totalGroups
469 vector<int> newTotals; newTotals.resize(groups.size(), 0);
470 for (int i = 0; i < groups.size(); i++) {
471 indexGroupMap[groups[i]] = i;
472 //find original spot of group[i]
473 int index = originalGroupMap[groups[i]];
474 newTotals[i] = totalGroups[index];
476 totalGroups = newTotals;
479 for (int i = 0; i < counts.size(); i++) {
480 vector<int> newCounts; newCounts.resize(groups.size(), 0);
481 for (int j = 0; j < groups.size(); j++) {
482 //find original spot of group[i]
483 int index = originalGroupMap[groups[j]];
484 newCounts[j] = counts[i][index];
486 counts[i] = newCounts;
489 m->setAllGroups(groups);
493 catch(exception& e) {
494 m->errorOut(e, "CountTable", "addGroup");
498 /************************************************************/
500 int CountTable::removeGroup(string groupName) {
503 //save for later in case removing a group means we need to remove a seq.
504 map<int, string> reverse;
505 for (map<string, int>::iterator it = indexNameMap.begin(); it !=indexNameMap.end(); it++) { reverse[it->second] = it->first; }
507 map<string, int>::iterator it = indexGroupMap.find(groupName);
508 if (it == indexGroupMap.end()) {
509 m->mothurOut("[ERROR]: " + groupName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
511 int indexOfGroupToRemove = it->second;
512 map<string, int> currentGroupIndex = indexGroupMap;
513 vector<string> newGroups;
514 for (int i = 0; i < groups.size(); i++) {
515 if (groups[i] != groupName) {
516 newGroups.push_back(groups[i]);
517 indexGroupMap[groups[i]] = newGroups.size()-1;
520 indexGroupMap.erase(groupName);
522 totalGroups.erase(totalGroups.begin()+indexOfGroupToRemove);
525 map<string, int> newIndexNameMap;
526 for (int i = 0; i < counts.size(); i++) {
527 int num = counts[i][indexOfGroupToRemove];
528 counts[i].erase(counts[i].begin()+indexOfGroupToRemove);
531 if (totals[i] == 0) { //your sequences are only from the group we want to remove, then remove you.
532 counts.erase(counts.begin()+i);
533 totals.erase(totals.begin()+i);
537 newIndexNameMap[reverse[thisIndex]] = i;
540 indexNameMap = newIndexNameMap;
542 if (groups.size() == 0) { hasGroups = false; }
544 }else { m->mothurOut("[ERROR]: your count table does not contain group information, can not remove group " + groupName + ".\n"); m->control_pressed = true; }
548 catch(exception& e) {
549 m->errorOut(e, "CountTable", "removeGroup");
553 /************************************************************/
554 //vector of groups for the seq
555 vector<string> CountTable::getGroups(string seqName) {
557 vector<string> thisGroups;
559 vector<int> thisCounts = getGroupCounts(seqName);
560 for (int i = 0; i < thisCounts.size(); i++) {
561 if (thisCounts[i] != 0) { thisGroups.push_back(groups[i]); }
563 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
567 catch(exception& e) {
568 m->errorOut(e, "CountTable", "getGroups");
572 /************************************************************/
573 //total number of seqs represented by seq
574 int CountTable::renameSeq(string oldSeqName, string newSeqName) {
577 map<string, int>::iterator it = indexNameMap.find(oldSeqName);
578 if (it == indexNameMap.end()) {
579 m->mothurOut("[ERROR]: " + oldSeqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
581 int index = it->second;
582 indexNameMap.erase(it);
583 indexNameMap[newSeqName] = index;
588 catch(exception& e) {
589 m->errorOut(e, "CountTable", "renameSeq");
594 /************************************************************/
595 //total number of seqs represented by seq
596 int CountTable::getNumSeqs(string seqName) {
599 map<string, int>::iterator it = indexNameMap.find(seqName);
600 if (it == indexNameMap.end()) {
601 m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
603 return totals[it->second];
608 catch(exception& e) {
609 m->errorOut(e, "CountTable", "getNumSeqs");
613 /************************************************************/
614 //returns unique index for sequence like get in NameAssignment
615 int CountTable::get(string seqName) {
618 map<string, int>::iterator it = indexNameMap.find(seqName);
619 if (it == indexNameMap.end()) {
620 m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
621 }else { return it->second; }
625 catch(exception& e) {
626 m->errorOut(e, "CountTable", "get");
630 /************************************************************/
631 //add seqeunce without group info
632 int CountTable::push_back(string seqName) {
634 map<string, int>::iterator it = indexNameMap.find(seqName);
635 if (it == indexNameMap.end()) {
636 if (hasGroups) { m->mothurOut("[ERROR]: Your count table has groups and I have no group information for " + seqName + "."); m->mothurOutEndLine(); m->control_pressed = true; }
637 indexNameMap[seqName] = uniques;
642 m->mothurOut("[ERROR]: Your count table contains more than 1 sequence named " + seqName + ", sequence names must be unique. Please correct."); m->mothurOutEndLine(); m->control_pressed = true;
647 catch(exception& e) {
648 m->errorOut(e, "CountTable", "push_back");
652 /************************************************************/
654 int CountTable::remove(string seqName) {
656 map<string, int>::iterator it = indexNameMap.find(seqName);
657 if (it != indexNameMap.end()) {
659 if (hasGroups){ //remove this sequences counts from group totals
660 for (int i = 0; i < totalGroups.size(); i++) { totalGroups[i] -= counts[it->second][i]; counts[it->second][i] = 0; }
662 int thisTotal = totals[it->second]; totals[it->second] = 0;
664 indexNameMap.erase(it);
666 m->mothurOut("[ERROR]: Your count table contains does not include " + seqName + ", cannot remove."); m->mothurOutEndLine(); m->control_pressed = true;
671 catch(exception& e) {
672 m->errorOut(e, "CountTable", "push_back");
676 /************************************************************/
677 //add seqeunce without group info
678 int CountTable::push_back(string seqName, int thisTotal) {
680 map<string, int>::iterator it = indexNameMap.find(seqName);
681 if (it == indexNameMap.end()) {
682 if (hasGroups) { m->mothurOut("[ERROR]: Your count table has groups and I have no group information for " + seqName + "."); m->mothurOutEndLine(); m->control_pressed = true; }
683 indexNameMap[seqName] = uniques;
684 totals.push_back(thisTotal);
688 m->mothurOut("[ERROR]: Your count table contains more than 1 sequence named " + seqName + ", sequence names must be unique. Please correct."); m->mothurOutEndLine(); m->control_pressed = true;
693 catch(exception& e) {
694 m->errorOut(e, "CountTable", "push_back");
698 /************************************************************/
699 //add sequence with group info
700 int CountTable::push_back(string seqName, vector<int> groupCounts) {
702 map<string, int>::iterator it = indexNameMap.find(seqName);
703 if (it == indexNameMap.end()) {
704 if ((hasGroups) && (groupCounts.size() != getNumGroups())) { m->mothurOut("[ERROR]: Your count table has a " + toString(getNumGroups()) + " groups and " + seqName + " has " + toString(groupCounts.size()) + ", please correct."); m->mothurOutEndLine(); m->control_pressed = true; }
706 for (int i = 0; i < getNumGroups(); i++) { totalGroups[i] += groupCounts[i]; thisTotal += groupCounts[i]; }
707 if (hasGroups) { counts.push_back(groupCounts); }
708 indexNameMap[seqName] = uniques;
709 totals.push_back(thisTotal);
713 m->mothurOut("[ERROR]: Your count table contains more than 1 sequence named " + seqName + ", sequence names must be unique. Please correct."); m->mothurOutEndLine(); m->control_pressed = true;
718 catch(exception& e) {
719 m->errorOut(e, "CountTable", "push_back");
724 /************************************************************/
725 //create ListVector from uniques
726 ListVector CountTable::getListVector() {
728 ListVector list(indexNameMap.size());
729 for (map<string, int>::iterator it = indexNameMap.begin(); it != indexNameMap.end(); it++) {
730 if (m->control_pressed) { break; }
731 list.set(it->second, it->first);
735 catch(exception& e) {
736 m->errorOut(e, "CountTable", "getListVector");
741 /************************************************************/
742 //returns the names of all unique sequences in file
743 vector<string> CountTable::getNamesOfSeqs() {
745 vector<string> names;
746 for (map<string, int>::iterator it = indexNameMap.begin(); it != indexNameMap.end(); it++) {
747 names.push_back(it->first);
752 catch(exception& e) {
753 m->errorOut(e, "CountTable", "getNamesOfSeqs");
757 /************************************************************/
758 //returns the names of all unique sequences in file mapped to their seqCounts
759 map<string, int> CountTable::getNameMap() {
761 map<string, int> names;
762 for (map<string, int>::iterator it = indexNameMap.begin(); it != indexNameMap.end(); it++) {
763 names[it->first] = totals[it->second];
768 catch(exception& e) {
769 m->errorOut(e, "CountTable", "getNameMap");
773 /************************************************************/
774 //returns the names of all unique sequences in file
775 vector<string> CountTable::getNamesOfSeqs(string group) {
777 vector<string> names;
779 map<string, int>::iterator it = indexGroupMap.find(group);
780 if (it == indexGroupMap.end()) {
781 m->mothurOut("[ERROR]: " + group + " is not in your count table. Please correct.\n"); m->control_pressed = true;
783 for (map<string, int>::iterator it2 = indexNameMap.begin(); it2 != indexNameMap.end(); it2++) {
784 if (counts[it2->second][it->second] != 0) { names.push_back(it2->first); }
787 }else{ m->mothurOut("[ERROR]: Your count table does not have group info. Please correct.\n"); m->control_pressed = true; }
791 catch(exception& e) {
792 m->errorOut(e, "CountTable", "getNamesOfSeqs");
796 /************************************************************/
797 //merges counts of seq1 and seq2, saving in seq1
798 int CountTable::mergeCounts(string seq1, string seq2) {
800 map<string, int>::iterator it = indexNameMap.find(seq1);
801 if (it == indexNameMap.end()) {
802 m->mothurOut("[ERROR]: " + seq1 + " is not in your count table. Please correct.\n"); m->control_pressed = true;
804 map<string, int>::iterator it2 = indexNameMap.find(seq2);
805 if (it2 == indexNameMap.end()) {
806 m->mothurOut("[ERROR]: " + seq2 + " is not in your count table. Please correct.\n"); m->control_pressed = true;
809 for (int i = 0; i < groups.size(); i++) { counts[it->second][i] += counts[it2->second][i]; }
810 totals[it->second] += totals[it2->second];
812 indexNameMap.erase(it2);
817 catch(exception& e) {
818 m->errorOut(e, "CountTable", "getNamesOfSeqs");
822 /************************************************************/
823 int CountTable::copy(CountTable* ct) {
825 vector<string> thisGroups = ct->getNamesOfGroups();
826 for (int i = 0; i < thisGroups.size(); i++) { addGroup(thisGroups[i]); }
827 vector<string> names = ct->getNamesOfSeqs();
829 for (int i = 0; i < names.size(); i++) {
830 vector<int> thisCounts = ct->getGroupCounts(names[i]);
831 push_back(names[i], thisCounts);
836 catch(exception& e) {
837 m->errorOut(e, "CountTable", "copy");
842 /************************************************************/