1 /***************************************************************************
2  *   Copyright (C) 2009-2015 by                                            *
3  *   BUI Quang Minh <minh.bui@univie.ac.at>                                *
4  *   Lam-Tung Nguyen <nltung@gmail.com>                                    *
5  *                                                                         *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21  ***************************************************************************/
22 
23 #ifndef PHYLOANALYSIS_H
24 #define PHYLOANALYSIS_H
25 
26 #include "utils/tools.h"
27 #include "tree/mexttree.h"
28 #include "phylotesting.h"
29 #include "treetesting.h"
30 #include "tree/upperbounds.h" // Olga: functions for Upper Bounds analysis
31 #include "utils/pllnni.h"
32 
33 class PhyloTree;
34 class IQTree;
35 
36 /**
37 	main function to carry out phylogenetic inference
38 	@param params program parameters
39 */
40 void runPhyloAnalysis(Params &params, Checkpoint *checkpoint);
41 
42 /**
43     Perform separate tree inference across partitions
44  */
45 void runUnlinkedPhyloAnalysis(Params &params, Checkpoint *checkpoint);
46 
47 void startTreeReconstruction(Params &params, IQTree* &iqtree,
48         ModelCheckpoint &model_info);
49 
50 void runTreeReconstruction(Params &params, IQTree* &tree);
51 
52 /**
53 	take the collection of trees from input_trees, it assign support values to target_tree
54 	and print resulting tree to output_tree.
55 	@param input_trees collection of input trees to infer split supports
56 	@param burnin the number trees at the beginning of input_trees to be discarded
57 	@param max_count max number of trees to load
58 	@param target_tree tree to assign support value
59 	@param output_tree (OUT, OVERWRITE IF EXIST) Resulting will be written to this file. If NULL,
60 		output_tree will be named target_tree appended with ".suptree"
61 */
62 void assignBootstrapSupport(const char *input_trees, int burnin, int max_count, const char *target_tree,
63 	bool rooted, const char *output_tree, const char *out_prefix, MExtTree &mytree,
64 	const char* tree_weight_file, Params *params);
65 
66 /**
67  * assign branch supports from params.user_tree trees file to params.second_tree
68  * @param params program parameters
69  */
70 void assignBranchSupportNew(Params &params);
71 
72 /**
73 	Compute the consensus tree from the collection of trees from input_trees
74 	and print resulting tree to output_tree.
75 	@param phylo_tree used to optimize branch lengths of the consensus tree. Can be NULL
76 	@param input_trees collection of input trees to infer split supports
77 	@param burnin the number trees at the beginning of input_trees to be discarded
78 	@param max_count max number of trees to load
79 	@param cutoff only incorporate those splits that have support values more than cutoff
80 	@param weight_threshold minimum weight cutoff
81 	@param output_tree (OUT, OVERWRITE IF EXIST) Resulting consensus tree will be written to this file. If NULL,
82 		output_tree will be named input_trees appended with ".contree"
83 */
84 void computeConsensusTree(const char *input_trees, int burnin, int max_count, double cutoff, double weight_threshold,
85 	const char *output_tree, const char *out_prefix, const char* tree_weight_file, Params *params);
86 
87 /**
88 	Compute the consensus network from the collection of trees in input_trees.
89 	print consensus network to output_tree
90 	@param input_trees collection of input trees to infer split supports
91 	@param burnin the number trees at the beginning of input_trees to be discarded
92 	@param max_count max number of trees to load
93 	@param cutoff only incorporate those splits that have support values more than cutoff
94 	@param weight_threshold minimum weight cutoff
95 	@param output_tree (OUT, OVERWRITE IF EXIST) Resulting consensus tree will be written to this file. If NULL,
96 		output_tree will be named input_trees appended with ".connetwork"
97 */
98 void computeConsensusNetwork(const char *input_trees, int burnin, int max_count, double cutoff,
99 		int weight_summary, double weight_threshold,
100 	const char *output_tree, const char *out_prefix, const char* tree_weight_file);
101 
102 #endif
103