Commit 8ab98271 authored by omid's avatar omid
Browse files

new merge

parents e8246a03 8ad6e7b5
1. Look at the Gitlab page / issues section (https://gitlab.isb-sib.ch/phylo/fastcodeml/issues)
Look at the Gitlab page / issues section (https://gitlab.isb-sib.ch/phylo/fastcodeml/issues)
......@@ -352,10 +352,9 @@ void BranchSiteModel::initFromParams(void) {
throw FastCodeMLFatal("Invalid p0 and p1 values"); //
if (p0 + p1 > 1)
throw FastCodeMLFatal("Invalid p0 and p1 values");
mVar[0] = log((p0) / (1 - p0 - p1)); // log(p0); // p0 -> x0
mVar[mNumTimes + 0] = log((p0) / (1 - p0 - p1)); // log(p0); // p0 -> x0
mVar[1] =
log((p1) / (1 - p0 - p1)); // log(p1); // p1 -> x1
mVar[mNumTimes + 1] = log((p1) / (1 - p0 - p1)); // log(p1); // p1 -> x1
#else
if (p0 < 0 || p1 < 0 || (p0 + p1) < 1e-15)
throw FastCodeMLFatal("Invalid p0 and p1 values");
......
......@@ -161,28 +161,28 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal) {
"only; 2: normal info; 3: MPI trace; 4: "
"more debug) (default: 1)"},
{OPT_VERBOSE, "--verbose", SO_REQ_SEP, ""},
{OPT_QUIET, "-q", SO_NONE, "No messages except results"},
{OPT_QUIET, "--quiet", SO_NONE, ""},
//{OPT_QUIET, "-q", SO_NONE, "No messages except results"},
//{OPT_QUIET, "--quiet", SO_NONE, ""},
{OPT_EXPORT, "-e", SO_REQ_SEP, "Export forest in GML format (if %03d or "
"@03d is present, one is created for each "
"fg branch)"},
{OPT_EXPORT, "--export", SO_REQ_SEP, ""},
{OPT_TRACE, "-r", SO_NONE, "Trace the maximization run"},
{OPT_TRACE, "--trace", SO_NONE, ""},
{OPT_EXTRA_DEBUG, "-x", SO_REQ_SEP,
"Extra debug parameter (zero disables it)"},
{OPT_EXTRA_DEBUG, "--extra-debug", SO_REQ_SEP, ""},
//{OPT_EXTRA_DEBUG, "-x", SO_REQ_SEP,
//"Extra debug parameter (zero disables it)"},
//{OPT_EXTRA_DEBUG, "--extra-debug", SO_REQ_SEP, ""},
{OPT_OUT_RESULTS, "-ou", SO_REQ_SEP,
"Write results formatted to this file"},
{OPT_OUT_RESULTS, "--output", SO_REQ_SEP, ""},
{OPT_CLEAN_DATA, "-cl", SO_NONE,
"Remove ambiguous or missing sites from the MSA (default: no)"},
"Skip ambiguous or missing sites from the MSA (default: no)"},
{OPT_CLEAN_DATA, "--clean-data", SO_NONE, ""},
// configuration parameters
{OPT_SEED, "-s", SO_REQ_SEP,
"Random number generator seed (0 < seed < 1000000000)"},
"Random number generator seed (0 < seed < 1000000000, seed=0 -> random seed)"},
{OPT_SEED, "--seed", SO_REQ_SEP, ""},
{OPT_NUM_THREADS, "-nt", SO_REQ_SEP,
"Number of threads (1 for non parallel execution)"},
......@@ -242,25 +242,25 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal) {
// initialization parameters
{OPT_TIMES_FROM_FILE, "-l", SO_NONE,
"Initial branch lengths from tree file"},
"Initial branch lengths from tree file (otherwise random initial branch lengths)"},
{OPT_TIMES_FROM_FILE, "--blengths-from-file", SO_NONE, ""},
{OPT_BRANCH_LENGTH, "-bl", SO_NONE,
"The length of the branches is fixed"},
"Initial branch lengths from tree file and fixed"},
{OPT_BRANCH_LENGTH, "--branch-lengths-fixed", SO_NONE, ""},
{OPT_BRANCH_ALL, "-ba", SO_NONE,
"Do for all branches as foreground branch (including leaves)"},
{OPT_BRANCH_ALL, "--branch-all", SO_NONE, ""},
{OPT_COMP_TIMES, "-c", SO_REQ_SEP, "Export the computed times from H0 if "
"0, H1 if 1, otherwise the one read "
"in the phylo tree"},
{OPT_COMP_TIMES, "--export-comp-times", SO_REQ_SEP, ""},
//{OPT_COMP_TIMES, "-c", SO_REQ_SEP, "Export the computed times from H0 if "
// "0, H1 if 1, otherwise the one read "
// "in the phylo tree"},
//{OPT_COMP_TIMES, "--export-comp-times", SO_REQ_SEP, ""},
{OPT_INIT_PARAM, "-p", SO_REQ_SEP, "Pass initialization parameter in the "
"form: P=value (P: w0, k, p0, p1, w2) "
"form (otherwise random): P=value (P: w0, k, p0, p1, w2) "
"-> e.g. -p w0=1.1 -p p0=2.1 ..."},
{OPT_INIT_PARAM, "--init-param", SO_REQ_SEP, ""},
{OPT_INIT_DEFAULT, "-ic", SO_NONE,
"Start from default parameter values and times from tree file"},
{OPT_INIT_DEFAULT, "--init-default", SO_NONE, ""},
//{OPT_INIT_DEFAULT, "-ic", SO_NONE,
//"Start from default parameter values and times from tree file"},
//{OPT_INIT_DEFAULT, "--init-default", SO_NONE, ""},
SO_END_OF_OPTIONS};
......
......@@ -38,7 +38,7 @@ public:
mIgnoreFreq(false), mDoNotReduceForest(false),
mBranchLengthsFromFile(false), mNoMaximization(false), mTrace(false),
#ifdef _OPENMP
mNumThreads(omp_get_max_threads()),
mNumThreads(omp_get_max_threads()/2 + 1 ), // to prevent possible false sharing
#else
mNumThreads(1),
#endif
......
......@@ -258,23 +258,25 @@ void Newick::printTreeUnformatted(std::ostream &aOut, TreeNode *aNode) const {
}
int Newick::printTreeAnnotated(std::ostream &aOut, TreeNode *aNode, int aBranch,
bool wLeaves) const {
bool wLeaves, bool bNumber) const {
TreeNode *m;
unsigned int idx;
int branch_idx = aBranch;
// Special case for the root
if (!aNode) {
if (wLeaves)
aOut << "Annotated Newick Tree (*N marks the branch N)" << std::endl;
if (bNumber){
if (wLeaves)
aOut << "Annotated Newick Tree (*N marks the branch N)" << std::endl << std::endl;
else
aOut << "Annotated Newick Tree (*N marks the internal branch N)"
<< std::endl;
<< std::endl << std::endl;
}
aOut << '(';
for (idx = 0; (m = mTreeRoot.getChild(idx)) != NULL; ++idx) {
if (idx > 0)
aOut << ',';
branch_idx = printTreeAnnotated(aOut, m, branch_idx, wLeaves);
branch_idx = printTreeAnnotated(aOut, m, branch_idx, wLeaves, bNumber);
}
aOut << ')';
mTreeRoot.printNode();
......@@ -284,7 +286,7 @@ int Newick::printTreeAnnotated(std::ostream &aOut, TreeNode *aNode, int aBranch,
if (wLeaves)
branch_idx = aBranch + 1;
aNode->printNode();
if (wLeaves)
if (wLeaves && bNumber)
aOut << '*' << aBranch;
} else {
branch_idx = aBranch + 1;
......@@ -292,11 +294,11 @@ int Newick::printTreeAnnotated(std::ostream &aOut, TreeNode *aNode, int aBranch,
for (idx = 0; (m = aNode->getChild(idx)) != NULL; ++idx) {
if (idx > 0)
aOut << ',';
branch_idx = printTreeAnnotated(aOut, m, branch_idx, wLeaves);
branch_idx = printTreeAnnotated(aOut, m, branch_idx, wLeaves, bNumber);
}
aOut << ')';
aNode->printNode();
aOut << '*' << aBranch;
if (bNumber) aOut << '*' << aBranch;
}
return branch_idx;
......@@ -304,24 +306,26 @@ int Newick::printTreeAnnotated(std::ostream &aOut, TreeNode *aNode, int aBranch,
int Newick::printTreeAnnotatedWithEstLens(std::ostream &aOut, TreeNode *aNode,
int aBranch, bool wLeaves,
std::vector<double> *mVar) const {
std::vector<double> *mVar, bool bNumber) const {
TreeNode *m;
unsigned int idx;
int branch_idx = aBranch;
// Special case for the root
if (!aNode) {
if (wLeaves)
aOut << "Annotated Newick Tree (*N marks the branch N)" << std::endl;
if (bNumber){
if (wLeaves)
aOut << "Annotated Newick Tree (*N marks the branch N)" << std::endl << std::endl;
else
aOut << "Annotated Newick Tree (*N marks the internal branch N)"
<< std::endl;
<< std::endl << std::endl;
}
aOut << '(';
for (idx = 0; (m = mTreeRoot.getChild(idx)) != NULL; ++idx) {
if (idx > 0)
aOut << ',';
branch_idx =
printTreeAnnotatedWithEstLens(aOut, m, branch_idx, wLeaves, mVar);
printTreeAnnotatedWithEstLens(aOut, m, branch_idx, wLeaves, mVar, bNumber);
}
aOut << ')';
mTreeRoot.printNodeWoutLen();
......@@ -333,7 +337,7 @@ int Newick::printTreeAnnotatedWithEstLens(std::ostream &aOut, TreeNode *aNode,
branch_idx = aBranch + 1;
aNode->printNodeWoutLen();
std::cout << std::setprecision(6) << ":" << (*mVar)[aBranch];
if (wLeaves)
if (wLeaves && bNumber)
aOut << '*' << aBranch;
} else {
branch_idx = aBranch + 1;
......@@ -342,12 +346,12 @@ int Newick::printTreeAnnotatedWithEstLens(std::ostream &aOut, TreeNode *aNode,
if (idx > 0)
aOut << ',';
branch_idx =
printTreeAnnotatedWithEstLens(aOut, m, branch_idx, wLeaves, mVar);
printTreeAnnotatedWithEstLens(aOut, m, branch_idx, wLeaves, mVar, bNumber);
}
aOut << ')';
aNode->printNodeWoutLen();
std::cout << std::setprecision(6) << ":" << (*mVar)[aBranch];
aOut << '*' << aBranch;
if (bNumber) aOut << '*' << aBranch;
}
return branch_idx;
......
......@@ -62,12 +62,13 @@ public:
/// @param[in] aInternalBranch Internal branch identifier to annotate the
/// current branch.
/// @param[in] whether leaves should be labeled or not.
/// @param[in] whether branch numbers should be shown or not.
///
/// @return The new branch id
///
virtual int printTreeAnnotated(std::ostream &aOut, TreeNode *aNode = NULL,
int aInternalBranch = 0,
bool wLeaves = false) const;
bool wLeaves = false, bool bNumber=true) const;
/// Print the phylogenetic tree completed with all the info loaded in the same
/// format as read in and annotated with the branch numbers.
......@@ -80,13 +81,14 @@ public:
/// @param[in] whether leaves should be labeled or not.
/// @param[in] array of branch lengths after estimation to be labeled in the
/// tree.
/// @param[in] whether branch numbers should be shown or not.
///
/// @return The new branch id
///
virtual int
printTreeAnnotatedWithEstLens(std::ostream &aOut, TreeNode *aNode = NULL,
int aInternalBranch = 0, bool wLeaves = false,
std::vector<double> *mVar = NULL) const;
std::vector<double> *mVar = NULL, bool bNumber=true) const;
private:
/// Load a phylo tree definition from a Newick formatted string.
......
......@@ -61,12 +61,13 @@ public:
/// @param[in] aInternalBranch Internal branch identifier to annotate the
/// current branch.
/// @param[in] whether branch leaves should be considered or not
/// @param[in] whether branch numbers should be printed or not
///
/// @return The new internal branch id
///
virtual int printTreeAnnotated(std::ostream &aOut, TreeNode *aNode = NULL,
int aInternalBranch = 0,
bool wLeaves = false) const = 0;
bool wLeaves = false, bool bNumber = true) const = 0;
/// Return the list of species.
///
......
......@@ -23,10 +23,14 @@ LnL0: -2393.300017592994664 Function calls: 365
p0: 0.4858354 p1: 0.5141646 p2a: 0.0000000 p2b: 0.0000000
w0: 0.0000010 k: 5.1252258
H1 Final Annotated Newick Tree (*N marks the branch N)
Final Annotated Newick Tree (*N marks the branch N)
((a001:0.169176*1,a002:0.199833*2)#1:0.254441*0,(((a003:0.005008*6,a004:0.008439*7):0.010175*5,a005:0.025300*8):0.015333*4,a006:0.130950*9):0.044605*3,a007:0.074303*10):0.000000;
Time used: 0:4
((a001:0.169176,a002:0.199833)#1:0.254441,(((a003:0.005008,a004:0.008439):0.010175,a005:0.025300):0.015333,a006:0.130950):0.044605,a007:0.074303):0.000000;
Time used: 0m:22s
Cores used: 1
===
......
......@@ -29,6 +29,7 @@
export NLOPT_LIB_DIR="/software/Development/Libraries/nlopt/2.4.2/lib64"
export MATH_LIB_NAMES="openblas;lapack;gfortranbegin;gfortran"
export BOOST_ROOT="/software/lib64/"
export CXX=g++ # or to a cpp compiler with mpi support e.g. "/home/kali/lib/mpi/bin/mpicxx"
export CXX=g++ # or to a cpp compiler with mpi support e.g. "/home/kali/lib/mpi/bin/mpicxx"
- Group similar options in help (e.g. options about branch lengths)
- Unit Tests (a general test suite)
- More details in INSTALL file
to help users!!!
- For cmake, need a CMakeLists.txt example file with other compilers
- Add an option to deal with different genetic code
and maybe user own genetic code file
- Could we deal with Selenocystein and other "new" Amino acids?
- Display estimated tree (not only branch lengths) in default
output
- Promote FastCodeML in Bio* packages:
BioPerl, BioPython, BioJava, BioRuby
Open questions:
- Test if FastCodeML can avoid leaf computation
- Test what FastCodeML does with branch around root (pseudoroot)?
Does it compute only one of them in rooted tree case?
- How to force H0 computation if H1 is not significant?
Look at the Gitlab page / issues section (https://gitlab.isb-sib.ch/phylo/fastcodeml/issues)
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment