Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
phylo
fastcodeml
Commits
2d9f69bb
Commit
2d9f69bb
authored
Mar 02, 2016
by
omid
Browse files
Some extra manual formatting of automated formatted code !
parent
42e91b83
Changes
4
Hide whitespace changes
Inline
Side-by-side
BranchSiteModel.h
View file @
2d9f69bb
...
...
@@ -81,7 +81,8 @@ protected:
public:
/// Set the times on the tree from the variables
///
void
saveComputedTimes
(
void
)
const
{
mForest
.
setLengthsFromTimes
(
mVar
);
}
void
saveComputedTimes
(
void
)
// const
{
mForest
.
setLengthsFromTimes
(
mVar
);
}
/// Formatted print of the maximizer variables array
///
...
...
@@ -98,7 +99,7 @@ public:
///
std
::
string
printFinalVars
(
std
::
ostream
&
aOut
=
std
::
cout
)
const
;
/// Compute the maximum likelihood for the given forest
/// Compute the maximum likelihood for the given forest
(single foreground)
///
/// @param[in] aFgBranch The number of the internal branch to be marked as
/// foreground
...
...
@@ -564,6 +565,112 @@ private:
double
mScaleQ1
;
///< Scale value for Q1
};
/// Null Hypothesis test (multiple foreground branches).
///
/// @author Mario Valle - Swiss National Supercomputing Centre
///(CSCS)
/// @date 2010-12-23 (initial version)
/// @version 1.1
///
///
class
MfgBranchSiteModelNullHyp
:
public
BranchSiteModel
{
public:
/// Constructor.
///
/// @param[in] aForest The forest for which the maximum likelihood should be
/// computed
/// @param[in] aCmdLine The command line parameters
///
MfgBranchSiteModelNullHyp
(
Forest
&
aForest
,
const
CmdLine
&
aCmdLine
)
:
BranchSiteModel
(
aForest
,
aForest
.
getNumBranches
(),
aForest
.
getNumSites
(),
aCmdLine
.
mSeed
,
4
,
aCmdLine
.
mNoMaximization
,
aCmdLine
.
mTrace
,
aCmdLine
.
mOptimizationAlgo
,
aCmdLine
.
mDeltaValueForGradient
,
aCmdLine
.
mRelativeError
,
aCmdLine
.
mForceSerial
||
aCmdLine
.
mDoNotReduceForest
,
aCmdLine
.
mVerboseLevel
,
aCmdLine
.
mExtraDebug
,
aCmdLine
.
mMaxIterations
,
aCmdLine
.
mFixedBranchLength
),
mfgmSet
(
aForest
.
getNumBranches
()),
mfgmSetForGradient
(
aForest
.
getNumBranches
()),
mPrevK
(
DBL_MAX
),
mPrevOmega0
(
DBL_MAX
)
{
// Initialize the dependency set
mDependencies
.
computeDependencies
(
3
,
mNoParallel
);
mDependencies
.
print
(
"TEST FOR H0 (before optimization)"
);
mDependencies
.
optimizeDependencies
();
mDependencies
.
print
(
"TEST FOR H0"
);
}
/// Compute the null hypothesis log likelihood (multiple fg branches).
///
/// @param[in] aFgBranchSet The identifier for the branch marked as foreground
/// branch
/// @param[in] aStopIfBigger If true stop computation as soon as lnl is over
/// aThreshold
/// @param[in] aThreshold The threshold at which the maximization should be
/// stopped
///
/// @return The log likelihood under the null hypothesis
///
double
operator
()(
std
::
set
<
int
>
aFgBranchSet
,
bool
aStopIfBigger
=
false
,
double
aThreshold
=
0.
);
/// Compute the likelihood for the given forest and the given set of
/// parameters when computing gradient.
///
/// @param[in] aVar The optimizer variables
/// @param[in] aTrace If set visualize the best result so far
/// @param[in] aGradientVar Used in gradient computation to avoid unneeded
/// computations.
///
/// @return The maximum Likelihood value
///
double
computeLikelihoodForGradient
(
const
std
::
vector
<
double
>
&
aVar
,
bool
aTrace
,
size_t
aGradientVar
);
/// Compute the likelihood for the given forest and the given set of
/// parameters.
///
/// @param[in] aVar The optimizer variables
/// @param[in] aTrace If set visualize the best result so far
///
/// @return The maximum Likelihood value
///
double
computeLikelihood
(
const
std
::
vector
<
double
>
&
aVar
,
bool
aTrace
);
private:
/// Disabled assignment operator to avoid warnings on Windows
///
/// @fn BranchSiteModelNullHyp& operator=(const BranchSiteModelNullHyp& aObj)
///
/// @param[in] aObj The object to be assigned
///
/// @return The object receiving the assignment
///
MfgBranchSiteModelNullHyp
&
operator
=
(
const
MfgBranchSiteModelNullHyp
&
/*aObj*/
);
/// Combine the sites' various codon classes likelihoods into one
/// log-likelihood value
///
/// @return The tree log-likelihood value
///
double
combineSiteLikelihoods
(
void
);
private:
TransitionMatrix
mQw0
;
///< Q matrix for the omega0 case
TransitionMatrix
mQ1
;
///< Q matrix for the omega1 == 1 case
mfgProbabilityMatrixSetH0
mfgmSet
;
///< Set of matrices used for the tree
///visits (multiple foregrounds)
mfgProbabilityMatrixSetH0
mfgmSetForGradient
;
///< Set of matrices used for
///the tree visits (multiple
///foregrounds)
double
mPrevK
;
///< Previous k value used to compute matrices
double
mPrevOmega0
;
///< Previous w0 value used to compute matrices
double
mScaleQw0
;
///< Scale value for Qw0
double
mScaleQ1
;
///< Scale value for Q1
};
/// Alternate Hypothesis test.
///
/// @author Mario Valle - Swiss National Supercomputing Centre (CSCS)
...
...
CodeMLoptimizer.cpp
View file @
2d9f69bb
...
...
@@ -71,8 +71,8 @@ double Ming2::minimizeFunction(std::vector<double> &aVars) {
double
lnL
=
0
;
int
sts
=
ming2
(
mTrace
?
stdout
:
NULL
,
&
lnL
,
&
aVars
[
0
],
&
mLowerBound
[
0
],
&
mUpperBound
[
0
],
&
space
[
0
],
&
ispace
[
0
],
mRelativeError
,
np
);
if
(
sts
<
0
&&
mVerbose
>
0
)
std
::
cout
<<
"Check ming2 convergence"
<<
std
::
endl
;
//
if (sts < 0 && mVerbose > 0)
//
std::cout << "Check ming2 convergence" << std::endl;
std
::
cout
.
sync_with_stdio
(
sy
);
return
-
lnL
;
...
...
TreeAndSetsDependencies.h
View file @
2d9f69bb
...
...
@@ -121,8 +121,7 @@ private:
TreeAndSetsDependencies
&
operator
=
(
const
TreeAndSetsDependencies
&
/*aObj*/
);
private:
const
Forest
&
mForest
;
///< The forest for which dependencies should be calculated
const
Forest
&
mForest
;
///< The forest for which dependencies should be calculated
ListDependencies
mDependenciesClassesAndTrees
;
///< The groups of dependencies
/// between trees
bool
mNoParallel
;
///< Set if the execution is sequential, so no tree
...
...
format.sh
View file @
2d9f69bb
#!/bin/bash
ls
*
.cpp
*
.h |
grep
-Ev
"^(blas[.]h|lapack[.]h|nlopt[.]h)$"
| xargs clang-format
-3.6
-i
ls
*
.cpp
*
.h |
grep
-Ev
"^(blas[.]h|lapack[.]h|nlopt[.]h)$"
| xargs clang-format
-i
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment