1 #ifndef Mothur_counttable_h
2 #define Mothur_counttable_h
9 // Created by Sarah Westcott on 6/26/12.
10 // Copyright (c) 2012 Schloss Lab. All rights reserved.
13 //This class is designed to read a count table file and store its data.
14 //count table files look like:
17 Representative_Sequence total F003D000 F003D002 F003D004 F003D006 F003D008 F003D142 F003D144 F003D146 F003D148 F003D150 MOCK.GQY1XT001
18 GQY1XT001C296C 6051 409 985 923 937 342 707 458 439 387 464 0
19 GQY1XT001A3TJI 4801 396 170 413 442 306 769 581 576 497 651 0
20 GQY1XT001CS2B8 3018 263 226 328 460 361 336 248 290 187 319 0
21 GQY1XT001CD9IB 2736 239 177 256 405 306 286 263 248 164 392 0
23 or if no group info was used to create it
25 Representative_Sequence total
39 #include "mothurout.h"
40 #include "listvector.hpp"
46 CountTable() { m = MothurOut::getInstance(); hasGroups = false; total = 0; }
49 int readTable(string);
50 bool testGroups(string file); //used to check if file has group data without reading it.
52 bool hasGroupInfo() { return hasGroups; }
53 int getNumGroups() { return groups.size(); }
54 vector<string> getNamesOfGroups() { return groups; } //returns group names, if no group info vector is blank.
56 int push_back(string); //add a sequence
57 int push_back(string, int); //add a sequence
58 int push_back(string, vector<int>); //add a sequence with group info
59 int get(string); //returns unique sequence index for reading distance matrices like NameAssignment
60 int size() { return indexNameMap.size(); }
62 vector<int> getGroupCounts(string); //returns group counts for a seq passed in, if no group info is in file vector is blank. Order is the same as the groups returned by getGroups function.
63 int getGroupCount(string, string); //returns number of seqs for that group for that seq
64 int getGroupCount(string); // returns total seqs for that group
65 int getNumSeqs(string); //returns total seqs for that seq
66 int getNumSeqs() { return total; } //return total number of seqs
67 int getNumUniqueSeqs() { return uniques; } //return number of unique/representative seqs
68 int getGroupIndex(string); //returns index in getGroupCounts vector of specific group
70 vector<string> getNamesOfSeqs();
71 int mergeCounts(string, string); //combines counts for 2 seqs, saving under the first name passed in.
72 ListVector getListVector();
79 vector<string> groups;
80 vector< vector<int> > counts;
82 vector<int> totalGroups;
83 map<string, int> indexNameMap;
84 map<string, int> indexGroupMap;