Commit 9fafe16c authored by akalantz's avatar akalantz
Browse files

warning message for unrooted tree and codeML algorithm is set as the default one

git-svn-id: https://svn.vital-it.ch/svn/hp2c/trunk/Codeml_Variants/Fastcodeml@7147 95c5a404-1f88-0410-a6b0-c3f062b6f34a
parent 53093a0b
......@@ -138,7 +138,8 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
OPT_OUT_RESULTS,
OPT_CLEAN_DATA,
OPT_NO_PRE_STOP,
OPT_MAX_ITER
OPT_MAX_ITER,
OPT_BRANCH_LENGTH
};
// Then the definitions of each command line option
......@@ -205,6 +206,8 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
{ OPT_NO_PRE_STOP, "--no-pre-stop", SO_NONE, "" },
{ OPT_MAX_ITER, "-mi", SO_REQ_SEP, "Maximum number of iterations for the maximizer (default: 10000)" },
{ OPT_MAX_ITER, "--max-iterations", SO_REQ_SEP, "" },
{OPT_BRANCH_LENGTH, "-bl", SO_NONE, "The length of the brances is fixed (only for KCM and algorithms LBFGS and SLSQP)"},
{OPT_BRANCH_LENGTH, "--branch-lengths-fixed", SO_NONE, ""},
SO_END_OF_OPTIONS
};
......@@ -375,6 +378,10 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
mForceSerial = true;*/
if (mNumThreads <=0) throw FastCodeMLFatal("Invalid number of threads");
break;
case OPT_BRANCH_LENGTH:
//mFixedBranchLength = true;
break;
}
}
......
......@@ -41,7 +41,7 @@ public:
mBranchEnd(UINT_MAX),
mExportComputedTimes(UINT_MAX),
mComputeHypothesis(UINT_MAX),
mOptimizationAlgo(0),
mOptimizationAlgo(22),
mExtraDebug(0),
mMaxIterations(MAX_ITERATIONS),
mIgnoreFreq(false),
......
((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.0;
((a001:0.169176,a002:0.199833)#1:0.091420,((((a003:0.005008,a004:0.008439):0.010175,a005:0.025300):0.015333,a006:0.130950):0.044605,a007:0.074303):0.163021):0.0;
......@@ -194,6 +194,10 @@ void PhyloTree::checkRootBranches(void) const
std::cout << std::endl << "Root has " << cnt_root_branches << " children of which " << cnt_root_leaves << " are leaves" << std::endl;
}
if (cnt_root_branches == 2)
{
std::cout << std::endl << "This is a rooted tree. Please check!" << std::endl;
}
// if it is an invalid tree then raise exception
if(cnt_root_branches < 2) throw FastCodeMLFatal("Root has only one branch. Invalid tree. Quitting.");
......
......@@ -70,23 +70,23 @@ int main(int aRgc, char **aRgv)
// Adjust and report the number of threads that will be used
#ifdef _OPENMP
int num_threads = omp_get_max_threads();
//std::cout<<"max num of thr: "<< num_threads <<std::endl;
if((cmd.mNumThreads >=1)&&(cmd.mNumThreads <= num_threads))
num_threads = cmd.mNumThreads;
// std::cout<<"num of thr: "<< num_threads <<std::endl;
omp_set_num_threads(num_threads);
/*if (num_threads < 2)
cmd.mForceSerial = true;
else
int num_threads = omp_get_max_threads();
//std::cout<<"max num of thr: "<< num_threads <<std::endl;
if((cmd.mNumThreads >=1)&&(cmd.mNumThreads <= num_threads))
num_threads = cmd.mNumThreads;
// std::cout<<"num of thr: "<< num_threads <<std::endl;
omp_set_num_threads(num_threads);
/*if (num_threads < 2)
cmd.mForceSerial = true;
else
cmd.mForceSerial = false;*/
#else
#else
cmd.mNumThreads=1;
int num_threads = 1;
int num_threads = 1;
cmd.mForceSerial = true;
#endif
#endif
/*#ifdef _OPENMP
int num_threads = omp_get_max_threads();
......@@ -99,7 +99,7 @@ int main(int aRgc, char **aRgv)
#else
cmd.mForceSerial = true;
int num_threads = 1;
#endif*/
#endif*/
#ifdef USE_MPI
// Shutdown messages from all MPI processes except the master
......@@ -142,7 +142,8 @@ int main(int aRgc, char **aRgv)
if(cmd.mDeltaValueForGradient > 0.0) std::cout << "Delta value: " << cmd.mDeltaValueForGradient << std::endl;
std::cout << "Relative error: " << cmd.mRelativeError << std::endl;
if(cmd.mResultsFile) std::cout << "Results file: " << cmd.mResultsFile << std::endl;
if(cmd.mNumThreads) std::cout << "Number of threads: " << cmd.mNumThreads << std::endl;
// if(cmd.mFixedBranchLength) std::cerr << "Branch lengths are fixed" << std::endl;
#ifdef _OPENMP
if(num_threads > 1)
{
......@@ -378,11 +379,11 @@ int main(int aRgc, char **aRgv)
std::cout << "(Doesn't pass LRT, skipping)";
std::cout << " Function calls: " << h0.getNumEvaluations() << " ";
std::cout << std::endl << std::endl;
if(lnl0 != std::numeric_limits<double>::infinity())
{
std::string s0 = h0.printFinalVars(std::cout);
//std::cout<<"EDW0: "<< s0 <<std::endl;
output_results.saveParameters(fg_branch, s0, 0);
if(lnl0 != std::numeric_limits<double>::infinity())
{
std::string s0 = h0.printFinalVars(std::cout);
//std::cout<<"EDW0: "<< s0 <<std::endl;
output_results.saveParameters(fg_branch, s0, 0);
}
std::cout << std::endl;
}
......@@ -395,11 +396,11 @@ int main(int aRgc, char **aRgv)
std::cout << std::setprecision(15) << std::fixed << lnl1;
std::cout << " Function calls: " << h1.getNumEvaluations();
std::cout << std::endl << std::endl;
if(lnl1 != std::numeric_limits<double>::infinity())
{
std::string s1= h1.printFinalVars(std::cout);
//std::cout<<"EDW1: "<< s1 <<std::endl;
output_results.saveParameters(fg_branch, s1, 1);
if(lnl1 != std::numeric_limits<double>::infinity())
{
std::string s1= h1.printFinalVars(std::cout);
//std::cout<<"EDW1: "<< s1 <<std::endl;
output_results.saveParameters(fg_branch, s1, 1);
}
std::cout << std::endl;
}
......@@ -595,8 +596,8 @@ Usage:
-r --trace (no argument)
Trace the maximization run
-nt --number-of-threads (required argument)
Number of threads (1 for non parallel execution)
-nt --number-of-threads (required argument)
Number of threads (1 for non parallel execution)
-bf --branch-from-file (no argument)
Do only the branch marked in the file as foreground branch
......@@ -608,7 +609,7 @@ Usage:
Start H0 optimization from H1 results
-m --maximizer (required argument)
Optimizer algorithm (0:LBFGS, 1:VAR1, 2:VAR2, 3:SLSQP, 11:BOBYQA, 22:FromCodeML, 99:MLSL_LDS) (default: 0)
Optimizer algorithm (0:LBFGS, 1:VAR1, 2:VAR2, 3:SLSQP, 11:BOBYQA, 22:FromCodeML, 99:MLSL_LDS) (default: 22)
-sd --small-diff (required argument)
Delta used in gradient computation (default: 1.49e-8)
......
Supports Markdown
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