| 1 |
#include <iostream> |
| 2 |
#include <Beep.hh> |
| 3 |
#include <DLRSOrthoCalculator.hh> |
| 4 |
|
| 5 |
#include "OrthoUtils.hh" |
| 6 |
|
| 7 |
/* Namespaces used */ |
| 8 |
using namespace std; |
| 9 |
using namespace beep; |
| 10 |
using namespace boost::algorithm; |
| 11 |
|
| 12 |
int main(int argc, char *argv[]) { |
| 13 |
|
| 14 |
if (argc != 4) { |
| 15 |
cerr << "\nerror: wrong number of arguments\n" << endl; |
| 16 |
cerr << "usage: ortho_true_trees posterior_file specie_file true_tree" << endl; |
| 17 |
cerr << "posterior_file: DLRS posterior file containing samples from Pr[G,l,\\theta|D,S]" << endl; |
| 18 |
cerr << "specie_file: specie tree (a.k.a S in above formula)" << endl; |
| 19 |
cerr << "true_tree: true reconciliation for synthetic gene tree made of leaves represented by synthetic sequences (a.k.a D in above)" << endl; |
| 20 |
cerr << endl; |
| 21 |
exit(1); |
| 22 |
} |
| 23 |
|
| 24 |
//string specie_tree = "/home/ikramu/PrIME/trunk/src/cxx/tools/ortho_true_vertices/data/mhcLasse.stree"; |
| 25 |
//string true_tree = "/home/ikramu/PrIME/trunk/src/cxx/tools/ortho_true_vertices/data/g95.true"; |
| 26 |
//string posterior_file = "/home/ikramu/PrIME/trunk/src/cxx/tools/ortho_true_vertices/data/g95.all.test"; |
| 27 |
|
| 28 |
string posterior_file = argv[1]; |
| 29 |
string specie_tree = argv[2]; |
| 30 |
string true_tree = argv[3]; |
| 31 |
|
| 32 |
OrthoUtils outils; |
| 33 |
|
| 34 |
/* |
| 35 |
vector<string> lst; |
| 36 |
lst.push_back("gene_homo_1"); |
| 37 |
lst.push_back("gene_mus_1"); |
| 38 |
lst.push_back("gene_homo_2"); |
| 39 |
lst.push_back("gene_mus_2"); |
| 40 |
lst.push_back("gene_mus_3"); |
| 41 |
|
| 42 |
outils.print_vector(lst); |
| 43 |
cout << endl; |
| 44 |
std::sort(lst.begin(), lst.end()); |
| 45 |
outils.print_vector(lst); |
| 46 |
*/ |
| 47 |
|
| 48 |
vector<map<string, double> > ortho_list; |
| 49 |
|
| 50 |
TreeIO tio = TreeIO::fromFile(specie_tree); |
| 51 |
Tree sptree = tio.readHostTree(); |
| 52 |
|
| 53 |
//vector<string> leaves = outils.get_leaves_from_true_file(true_tree); |
| 54 |
vector<string> leaves = outils.get_gene_pair_from_true_tree(true_tree); |
| 55 |
outils.set_orthology_map(leaves); |
| 56 |
outils.print_vector(leaves); |
| 57 |
|
| 58 |
outils.estimate_orthologies(posterior_file, true_tree, specie_tree, leaves, ortho_list); |
| 59 |
|
| 60 |
cout << "total samples are " << ortho_list.size() << endl; |
| 61 |
|
| 62 |
map<string, double> norm_ortho = outils.normalize_orthologies(ortho_list); |
| 63 |
outils.write_orthologies(norm_ortho, posterior_file); |
| 64 |
return 0; |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|