Commit 2bf443bb authored by mvalle's avatar mvalle
Browse files

Few corrections to CMakeLists and NewickGrammar to accept pipe character also.


git-svn-id: https://svn.vital-it.ch/svn/hp2c/trunk/Codeml_Variants/Fastcodeml@7171 95c5a404-1f88-0410-a6b0-c3f062b6f34a
parent a6eaa3d7
......@@ -168,11 +168,12 @@ link_directories(${LINK_DIR_NLOPT})
include_directories(${INCLUDE_DIR_NLOPT})
###########################################################
if(NOT WIN32)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_BUILD_TYPE DEBUG)
#set(CMAKE_VERBOSE_MAKEFILE ON)
#set(CMAKE_CXX_FLAGS_DEBUG "-g -error -pg -O -Wall -std=c++98 -Wextra -Wno-unused-parameter -Wunused" CACHE "Debug mode options" STRING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -g -pg -O0 -Wall -std=c++98 -Wextra -Wno-unused-parameter -Wunused")
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -g -pg -O0 -Wall -std=c++98 -Wextra -Wno-unused-parameter -Wunused")
endif(NOT WIN32)
###########################################################
......
......@@ -38,8 +38,7 @@ struct NewickGrammar : public grammar<NewickGrammar>
full_label = no_node_d[ch_p('#')] >> marker | label >> !(no_node_d[ch_p('#')] >> marker);
//label = leaf_node_d[alpha_p >> *(alnum_p|'.'|'_')];
label = leaf_node_d[alnum_p >> *(alnum_p|'.'|'_')];
label = leaf_node_d[alnum_p >> *(alnum_p|'.'|'_'|'|')];
marker = leaf_node_d[+alnum_p];
}
......
......@@ -4,6 +4,7 @@
#include <fstream>
#include <limits>
#include "WriteResults.h"
#include <string>
void WriteResults::outputResults(void)
{
......@@ -12,7 +13,7 @@ void WriteResults::outputResults(void)
// Range of branches to be output (for H0 and H1)
std::map<size_t, double>::const_iterator im;
std::map<size_t, std::string>::const_iterator ims;
std::map<size_t, std::string>::const_iterator ims;
size_t min_branch = std::numeric_limits<size_t>::max();
size_t max_branch = 0;
......@@ -54,9 +55,10 @@ void WriteResults::outputResults(void)
else
{
out << std::setw(22) << std::setprecision(15) << std::fixed << im->second;
ims = mParamStr[0].find(branch);
out << std::endl<< std::fixed <<"Branch lengths:" << ims->second << std::endl;
ims = mParamStr[0].find(branch);
out << std::endl<< std::fixed <<"Branch lengths:" << ims->second << std::endl;
}
out << " LnL1: ";
......@@ -69,9 +71,9 @@ void WriteResults::outputResults(void)
else
{
out << std::setw(22) << std::setprecision(15) << std::fixed << im->second;
ims = mParamStr[1].find(branch);
out << std::endl<< std::fixed <<"Branch lengths:" <<ims->second << std::endl;
ims = mParamStr[1].find(branch);
out << std::endl<< std::fixed <<"Branch lengths:" << ims->second << std::endl;
}
out << std::endl;
}
......@@ -136,8 +138,8 @@ void WriteResults::savePositiveSelSites(size_t aFgBranch, const std::vector<unsi
// Save the positive selection sites and corresponding probabilities for later printing
mPositiveSelSites[aFgBranch] = std::make_pair(aPositiveSelSites, aPositiveSelSitesProb);
}
}
void WriteResults::saveParameters(size_t aFgBranch, std::string& aParamStr, unsigned int aHypothesis)
{
// If no file set, then do nothing
......
......@@ -65,14 +65,14 @@ public:
///
const std::vector<size_t>& orderSites(const std::vector<unsigned int>& aSites) const;
/// Save the parameters string for later printing.
///
/// @param[in] aFgBranch The foreground branch to which the log-likelihood refers
/// @param[in] aParamStr The parameters string
/// @param[in] aHypothesis The hypothesis (0 for H0 and 1 for H1) for which the log-likelihood has been computed
///
void saveParameters(size_t aFgBranch, std::string& aParamStr, unsigned int aHypothesis);
///
void saveParameters(size_t aFgBranch, std::string& aParamStr, unsigned int aHypothesis);
private:
const char* mFilename; ///< The file to which the results should be written. If null, no printing appear
......@@ -80,7 +80,7 @@ private:
std::map<size_t, std::pair<std::vector<unsigned int>, std::vector<double> > >
mPositiveSelSites; ///< The sites under positive selection and the corresponding probabilities for a given fg branch
mutable std::vector<size_t> mSiteOrder; ///< The new site+prob order computed by orderSites routine
std::map<size_t, std::string> mParamStr[2]; ///< The parameters string for the given fg branch and for the two hypothesis
};
......
......@@ -26,7 +26,7 @@
#include "BranchSiteModel.h"
#include "ParseParameters.h"
#include "VerbosityLevels.h"
#include "WriteResults.h"
#include "WriteResults.h"
#ifndef VTRACE
#ifdef _OPENMP
......@@ -49,14 +49,14 @@
///
/// @param[in] aRgc Number of command line parameters
/// @param[in] aRgv Command line parameters
///
const char* version="1.1.0";
///
const char* version="1.1.0";
int main(int aRgc, char **aRgv)
{
try
{
{
#ifdef USE_MKL_VML
// If used, intitialize the MKL VML library
......@@ -74,23 +74,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();
......@@ -103,13 +103,13 @@ 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
if(!hlc.isMaster()) cmd.mVerboseLevel = VERBOSE_NONE;
#endif
#endif
std::cout <<std::endl<<"------------------"<< std::endl<<"FastCodeML V"<<version<<std::endl<<"------------------"<<std::endl;
// Write out command line parameters (if not quiet i.e. if verbose level > 0)
if(cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT)
......@@ -147,7 +147,7 @@ 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.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)
......@@ -384,11 +384,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;
}
......@@ -401,11 +401,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;
}
......@@ -601,8 +601,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
......@@ -641,9 +641,9 @@ Usage:
Don't stop H0 maximization even if it cannot satisfy LRT (default: stop)
-mi --max-iterations (required argument)
Maximum number of iterations for the maximizer (default: 10000)
-bl --branch-lengths-fixed (no argument)
Maximum number of iterations for the maximizer (default: 10000)
-bl --branch-lengths-fixed (no argument)
The length of the brances is fixed
@endverbatim
......
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