Skip to content

Commit

Permalink
issue #3 more sensible BEAUti defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Apr 30, 2015
1 parent 6d8e1ba commit 9d1a27a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/snap/likelihood/SnAPTreeLikelihood.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class SnAPTreeLikelihood extends TreeLikelihood {
//"If true, constant-sites in the data will be used as part of the likelihood calculation. " +
//"If false (the default) constant sites will be removed from the sequence data and a normalization factor is " +
//"calculated for the likelihood.",
false);
true);
public Input<IntegerParameter> ascSiteCountInput = new Input<IntegerParameter>("ascSiteCount", "Counts for number of ascertained sites");


Expand Down
11 changes: 10 additions & 1 deletion src/snap/likelihood/SnapSubstitutionModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import beast.core.Input;
import beast.core.Input.Validate;
import beast.core.parameter.RealParameter;
import beast.core.util.Log;
import beast.evolution.datatype.DataType;
import beast.evolution.substitutionmodel.EigenDecomposition;
import beast.evolution.substitutionmodel.SubstitutionModel;
Expand All @@ -18,7 +19,15 @@ public SnapSubstitutionModel() {
}

@Override
public void initAndValidate() {}
public void initAndValidate() {
double u = m_pU.get().getValue();
double v = m_pV.get().getValue();
if (Math.abs(2*u*v-u-v) > 1e-6) {
Log.warning.println("WARNING: Mutation rates are not normalised. "
+ "This means that the tree height may not be in units of substitution any more. "
+ "To ensure mutation rates are normalised, check that 2 * u * v = u + v, where v and u are the mutation rates.");
}
}

@Override
public void getTransitionProbabilities(Node node, double fStartTime, double fEndTime, double fRate, double[] matrix) {}
Expand Down
8 changes: 4 additions & 4 deletions templates/SNAPP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<distribution spec='snap.likelihood.SnAPPrior' name='distribution' id='snapprior.$(n)' rateprior='gamma'>
<parameter name='alpha' id='alpha' value='11.750' lower='0.0' estimate='false'/>
<parameter name='beta' id='beta' value='109.73' lower='0.0' estimate='false'/>
<parameter name='lambda' id='lambda' value='0.00765' lower='0.0' estimate='false'/>
<parameter name='lambda' id='lambda' value='0.01' lower='0.0' estimate='true'/>
<parameter name='kappa' id='kappa' value='1.0' lower='0.0' estimate='false'/>
<tree spec='beast.util.ClusterTree' id='Tree.$(n)' nodetype='snap.NodeData' clusterType='upgma' clock.rate="1.0">
<input name='taxa' idref='snap.$(n)'/>
Expand All @@ -146,14 +146,14 @@
<distribution id='vPrior.$(n)' spec='Prior' x='@v'><distr spec='OneOnX'/></distribution>
<snaptreelikelihood spec='snap.likelihood.SnAPTreeLikelihood' name='distribution' id='treeLikelihood.$(n)' initFromTree='false' pattern='coalescenceRate'>
<snaptreelikelihood spec='snap.likelihood.SnAPTreeLikelihood' name='distribution' id='treeLikelihood.$(n)' initFromTree='false' pattern='coalescenceRate' non-polymorphic='true'>
<siteModel spec='sitemodel.SiteModel' id="MutationSiteModel.$(n)">
<parameter name='mutationRate' id='mutationRate' value='1.0' estimate='false'/>
<parameter name='proportionInvariant' id='proportionInvariant' value='0.0' estimate='false'/>
<parameter name='shape' value='2.0' id='shape' estimate='false'/>
<substModel spec='snap.likelihood.SnapSubstitutionModel' id='MutationModel' coalescenceRate='@coalescenceRate'>
<parameter name='mutationRateV' id='v' value='0.588235' lower='0.0' estimate='false'/>
<parameter name='mutationRateU' id='u' value='3.33333' lower='0.0' estimate='false'/>
<parameter name='mutationRateV' id='v' value='1.0' lower='0.0' estimate='true'/>
<parameter name='mutationRateU' id='u' value='1.0' lower='0.0' estimate='true'/>
</substModel>
</siteModel>
<data idref='snap.$(n)'/>
Expand Down

0 comments on commit 9d1a27a

Please sign in to comment.