Commit d6205ef5 authored by omid's avatar omid
Browse files

Some correction in reporting the final tree (based on the chosen

hypothesis)
parent 78a52c80
...@@ -93,7 +93,7 @@ int main(int aRgc, char **aRgv) { ...@@ -93,7 +93,7 @@ int main(int aRgc, char **aRgv) {
// std::cout<<"num of thr: "<< num_threads <<std::endl; // std::cout<<"num of thr: "<< num_threads <<std::endl;
omp_set_num_threads(num_threads); omp_set_num_threads(num_threads);
/*if (num_threads < 2) /*if (num_threads < 2)
cmd.mForceSerial = true; cmd.mForceSerial = true;
else else
cmd.mForceSerial = false;*/ cmd.mForceSerial = false;*/
...@@ -103,7 +103,7 @@ int main(int aRgc, char **aRgv) { ...@@ -103,7 +103,7 @@ int main(int aRgc, char **aRgv) {
cmd.mForceSerial = true; cmd.mForceSerial = true;
#endif #endif
/*#ifdef _OPENMP /*#ifdef _OPENMP
int num_threads = omp_get_max_threads(); int num_threads = omp_get_max_threads();
if(num_threads < 2 || cmd.mForceSerial) if(num_threads < 2 || cmd.mForceSerial)
{ {
...@@ -135,7 +135,8 @@ int main(int aRgc, char **aRgv) { ...@@ -135,7 +135,8 @@ int main(int aRgc, char **aRgv) {
std::cout << "Tree file: " << cmd.mTreeFile << std::endl; std::cout << "Tree file: " << cmd.mTreeFile << std::endl;
std::cout << "Gene file: " << cmd.mGeneFile << std::endl; std::cout << "Gene file: " << cmd.mGeneFile << std::endl;
std::cout << "Verbose level: " << cmd.mVerboseLevel << " (" std::cout << "Verbose level: " << cmd.mVerboseLevel << " ("
<< decodeVerboseLevel(cmd.mVerboseLevel) << ')' << std::endl; << decodeVerboseLevel(cmd.mVerboseLevel) << ')'
<< std::endl;
if (cmd.mSeed) if (cmd.mSeed)
std::cout << "Seed: " << cmd.mSeed << std::endl; std::cout << "Seed: " << cmd.mSeed << std::endl;
if (cmd.mBranchFromFile) if (cmd.mBranchFromFile)
...@@ -165,14 +166,15 @@ int main(int aRgc, char **aRgv) { ...@@ -165,14 +166,15 @@ int main(int aRgc, char **aRgv) {
if (cmd.mInitH0fromH1) if (cmd.mInitH0fromH1)
std::cout << "Starting val.: From H1" << std::endl; std::cout << "Starting val.: From H1" << std::endl;
else if (cmd.mInitFromParams && cmd.mBranchLengthsFromFile) else if (cmd.mInitFromParams && cmd.mBranchLengthsFromFile)
std::cout << "Starting val.: Times from tree file and params from " std::cout
"const (see below)" << "Starting val.: Times from tree file and params from "
<< std::endl; "const (see below)" << std::endl;
else if (cmd.mInitFromParams) else if (cmd.mInitFromParams)
std::cout << "Starting val.: Params from const (see below)" std::cout << "Starting val.: Params from const (see below)"
<< std::endl; << std::endl;
else if (cmd.mBranchLengthsFromFile) else if (cmd.mBranchLengthsFromFile)
std::cout << "Starting val.: Times from tree file" << std::endl; std::cout << "Starting val.: Times from tree file"
<< std::endl;
if (cmd.mNoMaximization) if (cmd.mNoMaximization)
std::cout << "Maximization: No" << std::endl; std::cout << "Maximization: No" << std::endl;
if (cmd.mTrace) if (cmd.mTrace)
...@@ -187,17 +189,21 @@ int main(int aRgc, char **aRgv) { ...@@ -187,17 +189,21 @@ int main(int aRgc, char **aRgv) {
std::cout << "Graph times: From H" << cmd.mExportComputedTimes std::cout << "Graph times: From H" << cmd.mExportComputedTimes
<< std::endl; << std::endl;
if (!cmd.mNoMaximization) if (!cmd.mNoMaximization)
std::cout << "Optimizer: " << cmd.mOptimizationAlgo << std::endl; std::cout << "Optimizer: " << cmd.mOptimizationAlgo
<< std::endl;
if (cmd.mMaxIterations != MAX_ITERATIONS) if (cmd.mMaxIterations != MAX_ITERATIONS)
std::cout << "Max iterations: " << cmd.mMaxIterations << std::endl; std::cout << "Max iterations: " << cmd.mMaxIterations
<< std::endl;
if (cmd.mDeltaValueForGradient > 0.0) if (cmd.mDeltaValueForGradient > 0.0)
std::cout << "Delta value: " << cmd.mDeltaValueForGradient std::cout << "Delta value: " << cmd.mDeltaValueForGradient
<< std::endl; << std::endl;
std::cout << "Relative error: " << cmd.mRelativeError << std::endl; std::cout << "Relative error: " << cmd.mRelativeError << std::endl;
if (cmd.mResultsFile) if (cmd.mResultsFile)
std::cout << "Results file: " << cmd.mResultsFile << std::endl; std::cout << "Results file: " << cmd.mResultsFile
<< std::endl;
if (cmd.mNumThreads) if (cmd.mNumThreads)
std::cout << "Number of threads: " << cmd.mNumThreads << std::endl; std::cout << "Number of threads: " << cmd.mNumThreads
<< std::endl;
if (cmd.mFixedBranchLength) if (cmd.mFixedBranchLength)
std::cout << "Branch lengths are fixed" << std::endl; std::cout << "Branch lengths are fixed" << std::endl;
#ifdef _OPENMP #ifdef _OPENMP
...@@ -248,8 +254,7 @@ int main(int aRgc, char **aRgv) { ...@@ -248,8 +254,7 @@ int main(int aRgc, char **aRgv) {
#endif #endif
std::cout << std::endl << std::endl; std::cout << std::endl << std::endl;
if (cmd.mInitFromParams) { if (cmd.mInitFromParams) {
std::cout << "Param initial values:" << std::endl std::cout << "Param initial values:" << std::endl << std::endl
<< std::endl
<< ParseParameters::getInstance(); << ParseParameters::getInstance();
} }
} }
...@@ -305,9 +310,11 @@ int main(int aRgc, char **aRgv) { ...@@ -305,9 +310,11 @@ int main(int aRgc, char **aRgv) {
if (zero_on_leaf_cnt > 0 || zero_on_int_cnt > 0) { if (zero_on_leaf_cnt > 0 || zero_on_int_cnt > 0) {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
std::cout << "Found null or missing branch length in tree file: on " std::cout
<< "Found null or missing branch length in tree file: on "
<< zero_on_leaf_cnt << " leave(s) and on " << zero_on_leaf_cnt << " leave(s) and on "
<< zero_on_int_cnt << " internal branch(es)." << std::endl; << zero_on_int_cnt << " internal branch(es)."
<< std::endl;
} }
} }
} }
...@@ -317,9 +324,10 @@ int main(int aRgc, char **aRgv) { ...@@ -317,9 +324,10 @@ int main(int aRgc, char **aRgv) {
tree.printTreeAnnotated(std::cout); tree.printTreeAnnotated(std::cout);
// Load the forest // Load the forest
forest.loadTreeAndGenes( forest.loadTreeAndGenes(tree, msa,
tree, msa, cmd.mIgnoreFreq ? CodonFrequencies::CODON_FREQ_MODEL_UNIF cmd.mIgnoreFreq ?
: CodonFrequencies::CODON_FREQ_MODEL_F3X4); CodonFrequencies::CODON_FREQ_MODEL_UNIF :
CodonFrequencies::CODON_FREQ_MODEL_F3X4);
// Reduce the forest merging common subtrees. Add also more reduction, then // Reduce the forest merging common subtrees. Add also more reduction, then
// clean the no more useful data. // clean the no more useful data.
...@@ -357,9 +365,9 @@ int main(int aRgc, char **aRgv) { ...@@ -357,9 +365,9 @@ int main(int aRgc, char **aRgv) {
// Get the time needed by data preprocessing // Get the time needed by data preprocessing
if (cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT) { if (cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT) {
timer.stop(); timer.stop();
std::cout << std::endl std::cout << std::endl << "TIMER (preprocessing) ncores: "
<< "TIMER (preprocessing) ncores: " << std::setw(2) << std::setw(2) << num_threads << " time: " << timer.get()
<< num_threads << " time: " << timer.get() << std::endl; << std::endl;
} }
// Print few statistics // Print few statistics
...@@ -398,9 +406,7 @@ int main(int aRgc, char **aRgv) { ...@@ -398,9 +406,7 @@ int main(int aRgc, char **aRgv) {
// getBranchRange function // getBranchRange function
std::vector<double> mVar; // to save optimization variables std::vector<double> mVar; // to save optimization variables
forest.getBranchRange( forest.getBranchRange(cmd, branch_start, branch_end, fg_set, ib_set); // fgset is added to save a list of fg branches
cmd, branch_start, branch_end, fg_set,
ib_set); // fgset is added to save a list of fg branches
// for (std::set<int>::iterator it=ib_set.begin(); it!=ib_set.end(); ++it) // for (std::set<int>::iterator it=ib_set.begin(); it!=ib_set.end(); ++it)
// std::cout << " " << *it << ","; // std::cout << " " << *it << ",";
...@@ -415,13 +421,15 @@ int main(int aRgc, char **aRgv) { ...@@ -415,13 +421,15 @@ int main(int aRgc, char **aRgv) {
{ {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS)
std::cout << std::endl std::cout << std::endl
<< "Doing foreground branch(es) from tree file " << std::endl; << "Doing foreground branch(es) from tree file "
<< std::endl;
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS)
std::cout << "-------------------------------------------" << std::endl; std::cout << "-------------------------------------------"
<< std::endl;
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
std::cout << "Doing foreground branch(es) "; std::cout << "Doing foreground branch(es) ";
for (std::set<int>::iterator it = fg_set.begin(); it != fg_set.end(); for (std::set<int>::iterator it = fg_set.begin();
++it) it != fg_set.end(); ++it)
std::cout << " " << *it << " "; std::cout << " " << *it << " ";
std::cout << std::endl; std::cout << std::endl;
} }
...@@ -460,7 +468,8 @@ int main(int aRgc, char **aRgv) { ...@@ -460,7 +468,8 @@ int main(int aRgc, char **aRgv) {
h0.initFromTree(); h0.initFromTree();
} }
lnl0 = h0(fg_set, cmd.mStopIfNotLRT && cmd.mComputeHypothesis != 0, lnl0 = h0(fg_set,
cmd.mStopIfNotLRT && cmd.mComputeHypothesis != 0,
lnl1 - THRESHOLD_FOR_LRT); lnl1 - THRESHOLD_FOR_LRT);
// std::cout << "lnl0 = " << lnl0 << std::endl; // std::cout << "lnl0 = " << lnl0 << std::endl;
...@@ -476,7 +485,8 @@ int main(int aRgc, char **aRgv) { ...@@ -476,7 +485,8 @@ int main(int aRgc, char **aRgv) {
if (lnl0 == std::numeric_limits<double>::infinity()) if (lnl0 == std::numeric_limits<double>::infinity())
std::cout << "**Invalid result**"; std::cout << "**Invalid result**";
else if (lnl0 < DBL_MAX) else if (lnl0 < DBL_MAX)
std::cout << std::setprecision(15) << std::fixed << lnl0; std::cout << std::setprecision(15) << std::fixed
<< lnl0;
else else
std::cout << "(Doesn't pass LRT, skipping)"; std::cout << "(Doesn't pass LRT, skipping)";
std::cout << " Function calls: " << h0.getNumEvaluations() std::cout << " Function calls: " << h0.getNumEvaluations()
...@@ -494,7 +504,8 @@ int main(int aRgc, char **aRgv) { ...@@ -494,7 +504,8 @@ int main(int aRgc, char **aRgv) {
if (lnl1 == std::numeric_limits<double>::infinity()) if (lnl1 == std::numeric_limits<double>::infinity())
std::cout << "**Invalid result**"; std::cout << "**Invalid result**";
else else
std::cout << std::setprecision(15) << std::fixed << lnl1; std::cout << std::setprecision(15) << std::fixed
<< lnl1;
std::cout << " Function calls: " << h1.getNumEvaluations(); std::cout << " Function calls: " << h1.getNumEvaluations();
std::cout << std::endl << std::endl; std::cout << std::endl << std::endl;
if (lnl1 != std::numeric_limits<double>::infinity()) { if (lnl1 != std::numeric_limits<double>::infinity()) {
...@@ -505,17 +516,17 @@ int main(int aRgc, char **aRgv) { ...@@ -505,17 +516,17 @@ int main(int aRgc, char **aRgv) {
std::cout << std::endl; std::cout << std::endl;
} }
if (cmd.mComputeHypothesis > 1) { if (cmd.mComputeHypothesis > 1) {
if (lnl0 == std::numeric_limits<double>::infinity() || if (lnl0 == std::numeric_limits<double>::infinity()
lnl1 == std::numeric_limits<double>::infinity()) || lnl1 == std::numeric_limits<double>::infinity())
std::cout << "LRT: **Invalid result**"; std::cout << "LRT: **Invalid result**";
else if (lnl0 < DBL_MAX) else if (lnl0 < DBL_MAX)
std::cout << "LRT: " << std::setprecision(15) << std::fixed std::cout << "LRT: " << std::setprecision(15)
<< lnl1 - lnl0 << std::fixed << lnl1 - lnl0 << " (threshold: "
<< " (threshold: " << std::setprecision(15) << std::setprecision(15) << std::fixed
<< std::fixed << THRESHOLD_FOR_LRT << ')'; << THRESHOLD_FOR_LRT << ')';
else else
std::cout << "LRT: < " << std::setprecision(15) << std::fixed std::cout << "LRT: < " << std::setprecision(15)
<< THRESHOLD_FOR_LRT; << std::fixed << THRESHOLD_FOR_LRT;
std::cout << std::endl; std::cout << std::endl;
} }
} }
...@@ -543,13 +554,12 @@ int main(int aRgc, char **aRgv) { ...@@ -543,13 +554,12 @@ int main(int aRgc, char **aRgv) {
// If the two hypothesis are computed, H0 has not been stopped and the run // If the two hypothesis are computed, H0 has not been stopped and the run
// passes the LRT, then compute the BEB // passes the LRT, then compute the BEB
if (cmd.mComputeHypothesis > 1 && lnl0 < DBL_MAX && if (cmd.mComputeHypothesis > 1 && lnl0 < DBL_MAX
BranchSiteModel::performLRT(lnl0, lnl1)) { && BranchSiteModel::performLRT(lnl0, lnl1)) {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS)
std::cout << std::endl std::cout << std::endl
<< "LRT is significant. Computing sites under positive " << "LRT is significant. Computing sites under positive "
"selection ... " "selection ... " << std::endl;
<< std::endl;
// Get the scale values from the latest optimized h1. // Get the scale values from the latest optimized h1.
std::vector<double> scales(2); std::vector<double> scales(2);
...@@ -602,7 +612,7 @@ int main(int aRgc, char **aRgv) { ...@@ -602,7 +612,7 @@ int main(int aRgc, char **aRgv) {
{ {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
std::cout << std::endl << "H1 Final "; std::cout << std::endl << "Final ";
tree.printTreeAnnotated(std::cout, NULL, 0, true); tree.printTreeAnnotated(std::cout, NULL, 0, true);
} }
} }
...@@ -610,10 +620,18 @@ int main(int aRgc, char **aRgv) { ...@@ -610,10 +620,18 @@ int main(int aRgc, char **aRgv) {
else else
{ {
mVar = h1.getVariables();
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
std::cout << std::endl << "H1 Final "; if (cmd.mComputeHypothesis == 0)
tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0, true, &mVar); mVar = h0.getVariables();
else
mVar = h1.getVariables();
if (cmd.mComputeHypothesis == 0)
std::cout << std::endl << "H0 Final ";
else
std::cout << std::endl << "H0 Final ";
tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0, true,
&mVar);
} }
// tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0, true, // tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0, true,
// &h1.getVariables()); // &h1.getVariables());
...@@ -634,10 +652,12 @@ int main(int aRgc, char **aRgv) { ...@@ -634,10 +652,12 @@ int main(int aRgc, char **aRgv) {
std::cout << "lnl1 (multiple fg) = " << lnl1 << std::endl;*/ std::cout << "lnl1 (multiple fg) = " << lnl1 << std::endl;*/
timer_app.stop(); timer_app.stop();
std::cout << std::endl if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
<< "Time used: " << timer_app.get() / 60000 << ":" std::cout << std::endl << "Time used: "
<< timer_app.get() / 60000 << ":"
<< (timer_app.get() / 1000) % 60 << std::endl; << (timer_app.get() / 1000) % 60 << std::endl;
std::cout << "Cores used: " << num_threads << std::endl; std::cout << "Cores used: " << num_threads << std::endl;
}
return 0; return 0;
} }
...@@ -656,23 +676,26 @@ int main(int aRgc, char **aRgv) { ...@@ -656,23 +676,26 @@ int main(int aRgc, char **aRgv) {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
if (cmd.mBranchAll) if (cmd.mBranchAll)
std::cout << std::endl << "Doing all foreground branches" << std::endl; std::cout << std::endl << "Doing all foreground branches"
<< std::endl;
else else
std::cout << std::endl std::cout << std::endl << "Doing internal foreground branches"
<< "Doing internal foreground branches" << std::endl; << std::endl;
std::cout << "------------------------------------" << std::endl; std::cout << "------------------------------------" << std::endl;
} }
for (size_t fg_branch = branch_start; fg_branch <= branch_end; for (size_t fg_branch = branch_start; fg_branch <= branch_end;
++fg_branch) { ++fg_branch) {
if (cmd.mBranchAll or if (cmd.mBranchAll
(!cmd.mBranchAll and ib_set.find(fg_branch) != ib_set.end())) or (!cmd.mBranchAll
and ib_set.find(fg_branch) != ib_set.end()))
{ {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS)
std::cout << "Doing foreground branch " << fg_branch << std::endl; std::cout << "Doing foreground branch " << fg_branch
<< std::endl;
// Compute the alternate model maximum loglikelihood // Compute the alternate model maximum loglikelihood
double lnl1 = 0.; double lnl1 = 0.;
...@@ -702,7 +725,8 @@ int main(int aRgc, char **aRgv) { ...@@ -702,7 +725,8 @@ int main(int aRgc, char **aRgv) {
h0.initFromTree(); h0.initFromTree();
} }
lnl0 = h0(fg_branch, cmd.mStopIfNotLRT && cmd.mComputeHypothesis != 0, lnl0 = h0(fg_branch,
cmd.mStopIfNotLRT && cmd.mComputeHypothesis != 0,
lnl1 - THRESHOLD_FOR_LRT); lnl1 - THRESHOLD_FOR_LRT);
// Save the value for formatted output (only if has not be forced to // Save the value for formatted output (only if has not be forced to
...@@ -717,11 +741,12 @@ int main(int aRgc, char **aRgv) { ...@@ -717,11 +741,12 @@ int main(int aRgc, char **aRgv) {
if (lnl0 == std::numeric_limits<double>::infinity()) if (lnl0 == std::numeric_limits<double>::infinity())
std::cout << "**Invalid result**"; std::cout << "**Invalid result**";
else if (lnl0 < DBL_MAX) else if (lnl0 < DBL_MAX)
std::cout << std::setprecision(15) << std::fixed << lnl0; std::cout << std::setprecision(15) << std::fixed
<< lnl0;
else else
std::cout << "(Doesn't pass LRT, skipping)"; std::cout << "(Doesn't pass LRT, skipping)";
std::cout << " Function calls: " << h0.getNumEvaluations() std::cout << " Function calls: "
<< " "; << h0.getNumEvaluations() << " ";
std::cout << std::endl << std::endl; std::cout << std::endl << std::endl;
if (lnl0 != std::numeric_limits<double>::infinity()) { if (lnl0 != std::numeric_limits<double>::infinity()) {
std::string s0 = h0.printFinalVars(std::cout); std::string s0 = h0.printFinalVars(std::cout);
...@@ -734,8 +759,10 @@ int main(int aRgc, char **aRgv) { ...@@ -734,8 +759,10 @@ int main(int aRgc, char **aRgv) {
if (lnl1 == std::numeric_limits<double>::infinity()) if (lnl1 == std::numeric_limits<double>::infinity())
std::cout << "**Invalid result**"; std::cout << "**Invalid result**";
else else
std::cout << std::setprecision(15) << std::fixed << lnl1; std::cout << std::setprecision(15) << std::fixed
std::cout << " Function calls: " << h1.getNumEvaluations(); << lnl1;
std::cout << " Function calls: "
<< h1.getNumEvaluations();
std::cout << std::endl << std::endl; std::cout << std::endl << std::endl;
if (lnl1 != std::numeric_limits<double>::infinity()) { if (lnl1 != std::numeric_limits<double>::infinity()) {
std::string s1 = h1.printFinalVars(std::cout); std::string s1 = h1.printFinalVars(std::cout);
...@@ -744,17 +771,18 @@ int main(int aRgc, char **aRgv) { ...@@ -744,17 +771,18 @@ int main(int aRgc, char **aRgv) {
std::cout << std::endl; std::cout << std::endl;
} }
if (cmd.mComputeHypothesis > 1) { if (cmd.mComputeHypothesis > 1) {
if (lnl0 == std::numeric_limits<double>::infinity() || if (lnl0 == std::numeric_limits<double>::infinity()
lnl1 == std::numeric_limits<double>::infinity()) || lnl1
== std::numeric_limits<double>::infinity())
std::cout << "LRT: **Invalid result**"; std::cout << "LRT: **Invalid result**";
else if (lnl0 < DBL_MAX) else if (lnl0 < DBL_MAX)
std::cout << "LRT: " << std::setprecision(15) << std::fixed std::cout << "LRT: " << std::setprecision(15)
<< lnl1 - lnl0 << std::fixed << lnl1 - lnl0
<< " (threshold: " << std::setprecision(15) << " (threshold: " << std::setprecision(15)
<< std::fixed << THRESHOLD_FOR_LRT << ')'; << std::fixed << THRESHOLD_FOR_LRT << ')';
else else
std::cout << "LRT: < " << std::setprecision(15) << std::fixed std::cout << "LRT: < " << std::setprecision(15)
<< THRESHOLD_FOR_LRT; << std::fixed << THRESHOLD_FOR_LRT;
std::cout << std::endl; std::cout << std::endl;
} }
} }
...@@ -782,13 +810,12 @@ int main(int aRgc, char **aRgv) { ...@@ -782,13 +810,12 @@ int main(int aRgc, char **aRgv) {
// If the two hypothesis are computed, H0 has not been stopped and the // If the two hypothesis are computed, H0 has not been stopped and the
// run passes the LRT, then compute the BEB // run passes the LRT, then compute the BEB
if (cmd.mComputeHypothesis > 1 && lnl0 < DBL_MAX && if (cmd.mComputeHypothesis > 1 && lnl0 < DBL_MAX
BranchSiteModel::performLRT(lnl0, lnl1)) { && BranchSiteModel::performLRT(lnl0, lnl1)) {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS)
std::cout << std::endl std::cout << std::endl
<< "LRT is significant. Computing sites under positive " << "LRT is significant. Computing sites under positive "
"selection ... " "selection ... " << std::endl;
<< std::endl;
// Get the scale values from the latest optimized h1. // Get the scale values from the latest optimized h1.
std::vector<double> scales(2); std::vector<double> scales(2);
...@@ -811,8 +838,8 @@ int main(int aRgc, char **aRgv) { ...@@ -811,8 +838,8 @@ int main(int aRgc, char **aRgv) {
std::vector<double> positive_sel_sites_prob; std::vector<double> positive_sel_sites_prob;
beb.extractPositiveSelSites(positive_sel_sites, beb.extractPositiveSelSites(positive_sel_sites,
positive_sel_sites_prob); positive_sel_sites_prob);
output_results.savePositiveSelSites(fg_branch, positive_sel_sites, output_results.savePositiveSelSites(fg_branch,
positive_sel_sites_prob); positive_sel_sites, positive_sel_sites_prob);
} }
} }
...@@ -820,7 +847,7 @@ int main(int aRgc, char **aRgv) { ...@@ -820,7 +847,7 @@ int main(int aRgc, char **aRgv) {
{ {
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
std::cout << std::endl << "H1 Final "; std::cout << std::endl << "Final ";
tree.printTreeAnnotated(std::cout, NULL, 0, true); tree.printTreeAnnotated(std::cout, NULL, 0, true);
std::cout << std::endl; std::cout << std::endl;
} }
...@@ -829,10 +856,17 @@ int main(int aRgc, char **aRgv) { ...@@ -829,10 +856,17 @@ int main(int aRgc, char **aRgv) {
else { else {
// std :: cout << std::endl; // std :: cout << std::endl;
if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) { if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
if (cmd.mComputeHypothesis == 0)
mVar = h0.getVariables();
else
mVar = h1.getVariables(); mVar = h1.getVariables();
std::cout << std::endl << "H1 Final ";
tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0, true, &mVar); if (cmd.mComputeHypothesis == 0)
std::cout << std::endl; std::cout << std::endl << "H0 Final ";
else
std::cout << std::endl << "H0 Final ";
tree.printTreeAnnotatedWithEstLens(std::cout, NULL, 0,
true, &mVar);
} }
} }
} }
...@@ -841,16 +875,17 @@ int main(int aRgc, char **aRgv) { ...@@ -841,16 +875,17 @@ int main(int aRgc, char **aRgv) {
// Get the time needed by the parallel part // Get the time needed by the parallel part
if (cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT) { if (cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT) {
timer.stop(); timer.stop();
std::cout << std::endl std::cout << std::endl << "TIMER (processing) ncores: "
<< "TIMER (processing) ncores: " << std::setw(2) << num_threads << std::setw(2) << num_threads << " time: " << timer.get()
<< " time: " << timer.get() << std::endl; << std::endl;
} }
timer_app.stop(); timer_app.stop();
std::cout << std::endl if (cmd.mVerboseLevel >= VERBOSE_ONLY_RESULTS) {
<< "Time used: " << timer_app.get() / 60000 << ":" std::cout << std::endl << "Time used: " << timer_app.get() / 60000
<< (timer_app.get() / 1000) % 60 << std::endl; << ":" << (timer_app.get() / 1000) % 60 << std::endl;
std::cout << "Cores used: " << num_threads << std::endl; std::cout << "Cores used: " << num_threads << std::endl;
}
// Output the results // Output the results
// output_results.outputResults(); // output_results.outputResults();
...@@ -870,8 +905,7 @@ int main(int aRgc, char **aRgv) { ...@@ -870,8 +905,7 @@ int main(int aRgc, char **aRgv) {
std::cout << std::endl << e.what() << std::endl << std::endl; std::cout << std::endl << e.what() << std::endl << std::endl;
return 1; return 1;
} catch (...) { } catch (...) {
std::cout << std