File: phylosummary.h

package info (click to toggle)
mothur 1.33.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,248 kB
  • ctags: 12,231
  • sloc: cpp: 152,046; fortran: 665; makefile: 74; sh: 34
file content (70 lines) | stat: -rw-r--r-- 1,709 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef RAWTRAININGDATAMAKER_H
#define RAWTRAININGDATAMAKER_H

/*
 *  rawTrainingDataMaker.h
 *  Mothur
 *
 *  Created by westcott on 4/21/10.
 *  Copyright 2010 Schloss Lab. All rights reserved.
 *
 */

#include "mothur.h"
#include "mothurout.h"
#include "groupmap.h"
#include "counttable.h"

/**************************************************************************************************/

struct rawTaxNode {
	map<string, int> children;  //childs name to index in tree
	int parent, level;
	string name, rank;
	map<string, int> groupCount;
	int total;
	
	rawTaxNode(string n) : name(n), level(0), parent(-1), total(0) {}
	rawTaxNode(){}
};

/**************************************************************************************************/
//doesn't use MPI ifdefs since only pid 0 uses this class
class PhyloSummary {

public:
	PhyloSummary(GroupMap*, bool);
	PhyloSummary(string, GroupMap*, bool);
    PhyloSummary(CountTable*, bool);
	PhyloSummary(string, CountTable*, bool);
	~PhyloSummary() {}
	
	int summarize(string);  //pass it a taxonomy file and a group file and it makes the tree
	int addSeqToTree(string, string);
	int addSeqToTree(string, map<string, bool>);
	void print(ofstream&);
    void print(ofstream&, bool);
	int getMaxLevel() { return maxLevel; }
	
private:
	string getNextTaxon(string&);
	vector<rawTaxNode> tree;
	void print(int, ofstream&);
    void print(int, ofstream&, bool);
	void assignRank(int);
	void readTreeStruct(ifstream&);
	GroupMap* groupmap;
    CountTable* ct;
	bool ignore, relabund;
	
	int numNodes;
	int numSeqs;
	int maxLevel;
	MothurOut* m;
};

/**************************************************************************************************/

#endif