CAFE
Computational Analysis of gene Family Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reports.h
Go to the documentation of this file.
1 #ifndef REPORTS_C6B4B223_5C6D_459E_B2D8_CAC46A40A5B4
2 #define REPORTS_C6B4B223_5C6D_459E_B2D8_CAC46A40A5B4
3 
4 #include <vector>
5 #include <string>
6 
7 extern "C" {
8 #include "cafe_shell.h"
9 #include "family.h"
10 }
11 
12 #include "viterbi.h"
13 
14 
15 class Globals;
16 class viterbi_parameters;
17 
19 {
20  std::string node_id;
21  std::string tree;
22  double max_p_value;
23  std::vector<std::pair<double, double> > pvalues;
24  std::vector<double> cut_pvalues;
25  std::vector<double> likelihood_ratios;
26 
27  family_line_item(pCafeFamily family, pCafeTree pcafe, double** likelihoodRatios, viterbi_parameters& viterbi, int i, std::string node_id);
29 };
30 
32 {
33  virtual void serialize(std::ostream& ost) const = 0;
34  friend std::ostream& operator<<(std::ostream& ost, const tree_visualization& newick);
35 };
36 
38 {
39  pTree _tree;
40 public:
41  newick_visualization(pTree tree) : _tree(tree)
42  {
43 
44  }
45  virtual void serialize(std::ostream& ost) const;
46 
47 };
48 
49 struct coord
50 {
51  double x;
52  double y;
53  coord() {}
54  coord(double _x, double _y) : x(_x), y(_y)
55  {
56 
57  }
58 };
59 
61 {
62  pTree _tree;
63  int width;
64  int left_margin;
65  int right_margin;
66  int top_margin;
67  double legend_ratio;
68  double _font_size;
69  double precision;
70  int tip_space;
71  int longest_label;
72  double scaler;
73  void set_xcoord(pTreeNode node);
74  void set_ycoord(pTreeNode node);
75 public:
77  virtual void serialize(std::ostream& ost) const;
78  std::map<int, coord> coordinates;
79  void plot_node(std::ostream& ost, pTreeNode node) const;
80  int height;
81  bool legend;
82 
83 };
84 
86 {
87  pTree _tree;
88  int _width;
89 public:
90  ascii_visualization(pTree tree, int width) : _tree(tree), _width(width) {}
91  virtual void serialize(std::ostream& ost) const;
92 };
93 
94 struct Report
95 {
96  enum Formats { Unknown, Text, HTML, JSON };
97  static int report_format;
98 
100  std::string tree;
101  std::string lambda_tree;
102  std::vector<double> lambdas;
103  std::vector<double> averageExpansion;
104  std::vector<change> changes;
105  std::vector<std::pair<int, int> > node_pairs;
106  std::vector<family_line_item> family_line_items;
108 
109  Report() {}
110  Report(pCafeParam param, viterbi_parameters& viterbi);
111 };
112 
114 {
117  bool lh2;
118  bool just_save;
120  std::string name;
121 };
122 
123 void update_depths(pTreeNode node, std::map<int, double>& depths, double curr_depth);
124 
125 report_parameters get_report_parameters(std::vector<std::string> tokens);
126 int cafe_cmd_report(Globals& globals, std::vector<std::string> tokens);
127 void write_viterbi(std::ostream& ost, const Report& viterbi);
128 void write_families_header(std::ostream& ost, bool cutPvalues, bool likelihoodRatios);
129 void cafe_do_report(Globals& globals, viterbi_parameters& viterbi, report_parameters* params);
130 int cafe_report_retrieve_data(const char* file, pCafeParam param, viterbi_parameters& viterbi);
131 
132 std::ostream& operator<<(std::ostream& ost, const family_line_item& item);
133 std::ostream& operator<<(std::ostream& ost, const Report& report);
134 
136 std::ios_base& json(std::ios_base& os);
137 std::ios_base& html(std::ios_base& os);
138 #endif
Definition: reports.h:85
Report()
Definition: reports.h:109
Definition: reports.h:60
Report::Formats format
Definition: reports.h:119
svg_visualization(pTree tree)
Definition: reports.cpp:1103
coord(double _x, double _y)
Definition: reports.h:54
virtual void serialize(std::ostream &ost) const
Definition: reports.cpp:1254
std::vector< double > lambdas
Definition: reports.h:102
bool branchcutting
Definition: reports.h:115
Formats
Definition: reports.h:96
std::vector< std::pair< double, double > > pvalues
Definition: reports.h:23
Definition: reports.h:37
std::vector< family_line_item > family_line_items
Definition: reports.h:106
std::string lambda_tree
Definition: reports.h:101
bool likelihood
Definition: reports.h:116
newick_visualization(pTree tree)
Definition: reports.h:41
void write_viterbi(std::ostream &ost, const Report &viterbi)
Definition: Globals.h:13
void write_families_header(std::ostream &ost, bool cutPvalues, bool likelihoodRatios)
Definition: reports.h:96
void update_depths(pTreeNode node, std::map< int, double > &depths, double curr_depth)
Definition: reports.cpp:959
Definition: reports.h:96
Definition: reports.h:96
std::map< int, coord > coordinates
Definition: reports.h:78
static int report_format
Definition: reports.h:97
friend std::ostream & operator<<(std::ostream &ost, const tree_visualization &newick)
Definition: reports.cpp:405
report_parameters get_report_parameters(std::vector< std::string > tokens)
Definition: reports.cpp:603
std::string tree
Definition: reports.h:100
std::ostream & operator<<(std::ostream &ost, const family_line_item &item)
Definition: reports.cpp:319
void plot_node(std::ostream &ost, pTreeNode node) const
Definition: reports.cpp:1198
pCafeTree aTree
Definition: reports.h:99
int cafe_report_retrieve_data(const char *file, pCafeParam param, viterbi_parameters &viterbi)
Definition: reports.cpp:744
std::vector< double > likelihood_ratios
Definition: reports.h:25
std::vector< std::pair< int, int > > node_pairs
Definition: reports.h:105
bool just_save
Definition: reports.h:118
std::string name
Definition: reports.h:120
double y
Definition: reports.h:52
Definition: reports.h:31
double x
Definition: reports.h:51
int cafe_cmd_report(Globals &globals, std::vector< std::string > tokens)
Report: Generates reports in various formats of the calculations completed
Definition: cafe_commands.cpp:1009
family_line_item()
Definition: reports.h:28
bool lh2
Definition: reports.h:117
int height
Definition: reports.h:80
Definition: viterbi.h:31
std::vector< change > changes
Definition: reports.h:104
Singleton structure that holds all of the global data that Cafe acts on.
Definition: family.h:115
std::string node_id
Definition: reports.h:20
double max_p_value
Definition: reports.h:22
std::ios_base & html(std::ios_base &os)
Definition: reports.cpp:313
std::vector< int > branch_cutting_output_format
Definition: reports.h:107
bool legend
Definition: reports.h:81
std::vector< double > cut_pvalues
Definition: reports.h:24
Definition: tree.h:11
Definition: reports.h:113
Definition: tree.h:26
std::string tree
Definition: reports.h:21
virtual void serialize(std::ostream &ost) const
Definition: reports.cpp:398
void cafe_do_report(Globals &globals, viterbi_parameters &viterbi, report_parameters *params)
Definition: reports.cpp:654
std::vector< double > averageExpansion
Definition: reports.h:103
Definition: reports.h:49
Definition: reports.h:18
virtual void serialize(std::ostream &ost) const
Definition: reports.cpp:1063
Structure representing a matrix of values of family sizes.
Definition: family.h:88
coord()
Definition: reports.h:53
ascii_visualization(pTree tree, int width)
Definition: reports.h:90
Definition: reports.h:96
Definition: family.h:17
std::ios_base & json(std::ios_base &os)
These I/O manipulators allow selecting the report format.
Definition: reports.cpp:307
Definition: reports.h:94