Skip to content

Commit

Permalink
port to BEAST v2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Aug 8, 2022
1 parent b03d360 commit ec57e28
Show file tree
Hide file tree
Showing 19 changed files with 217 additions and 224 deletions.
86 changes: 31 additions & 55 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
</description>

<!-- set global properties for this build -->
<property name="srcNS" location="src" />
<property name="buildNS" location="build" />
<property name="libNS" location="lib" />
<property name="release_dir" value="release" />
<property name="NSdir" location="../nested-sampling/" />
<property name="srcNS" location="${NSdir}/src" />
<property name="buildNS" location="${NSdir}/build" />
<property name="libNS" location="${NSdir}/lib" />
<property name="release_dir" value="${NSdir}/release" />
<property name="distNS" location="${buildNS}/dist" />
<property name="beast2path" location="../beast2" />
<property name="libBeast2" location="${beast2path}/lib" />
<property name="srcBeast2" location="${beast2path}/src" />
<property name="beast2classpath" location="${beast2path}/build" />
<property name="beastappclasspath" location="../BeastFX/build" />
<property name="buildMODEL_SELECTION" location="../model-selection/build" />

<property name="Add_on_dir" value="${release_dir}/add-on" />
<property name="version" value="1.1.0" />

<property name="buildMODEL_SELECTION" location="../model-selection/build"/>
<property name="buildBEAST_LABS" location="../BEASTLabs/build"/>


<import file="${beast2path}/build.xml" />

Expand All @@ -31,22 +31,27 @@

<path id="classpath">
<pathelement path="${buildNS}"/>
<fileset dir="${libBeast2}" includes="antlr-runtime-4.7.jar"/>
<fileset dir="${libBeast2}" includes="junit-4.8.2.jar"/>
<fileset dir="${libBeast2}" includes="antlr-runtime-4.10.1.jar"/>
<fileset dir="${libBeast2}" includes="beagle.jar"/>
<fileset dir="${libBeast2}" includes="jam.jar"/>
<fileset dir="${libBeast2}" includes="ntlr-runtime-4.5.jar"/>
<fileset dir="${libBeast2}" includes="commons-math3-3.1.1.jar"/>
<fileset dir="${libBeast2}" includes="commons-math3-3.6.1.jar"/>
<fileset dir="${libBeast2}" includes="colt.jar"/>
<fileset dir="${libBeast2}" includes="debug-1.0.jar"/>
<fileset dir="${libBeast2}/junit/" includes="junit-platform-console-standalone-1.8.2.jar"/>
<pathelement path="${buildMODEL_SELECTION}"/>
<pathelement path="${buildBEAST_LABS}"/>
<pathelement path="${beastappclasspath}"/>
<pathelement path="${beast2classpath}"/>
</path>
</path>

<!-- start -->
<target name="initNS">
<echo message="${ant.project.name}: ${ant.file}" />
<available file="${NSdir}/version.xml" property="versionAvailable"/>
<fail unless="versionAvailable">
** Required file version.xml does not exist. **
</fail>

<!-- Read package name and version from xml file -->
<xmlproperty file="${NSdir}/version.xml" prefix="fromVersionFile" />
<property name="NSversion" value="${fromVersionFile.package(version)}" />
</target>

<target name="cleanNS">
Expand Down Expand Up @@ -85,9 +90,7 @@
fork="true"
memoryinitialsize="256m"
memorymaximumsize="256m">
<!--source="1.6"
target="1.6"-->
<include name="beast/**/**" />
<include name="nestedsampling/**/**" />
<!-- compile JUnit test classes -->
<include name="test/beast/**" />
</javac>
Expand All @@ -99,45 +102,19 @@
<!-- Create the distribution directory -->
<mkdir dir="${distNS}" />

<!-- Put everything in ${buildNS} into the beast.jar file -->
<jar jarfile="${distNS}/NS.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main_class_BEAST}" />
</manifest>
<fileset dir="${buildNS}">
<include name="**/*.class" />
</fileset>
<fileset dir="${buildMODEL_SELECTION}">
<include name="**/*.class" />
</fileset>
<fileset dir="${buildBEAST_LABS}">
<include name="**/*.class" />
</fileset>
<fileset dir="${beast2classpath}">
<include name="**/*.class" />
<include name="**/*.properties" />
<include name="**/*.png" />
</fileset>
<zipgroupfileset dir="${lib}" includes="jam.jar" />
<zipgroupfileset dir="${lib}" includes="beagle.jar" />
<zipgroupfileset dir="${lib}" includes="colt.jar" />
<zipgroupfileset dir="${lib}" includes="commons-math3-3.1.1.jar" />
<zipgroupfileset dir="${lib}" includes="antlr-runtime-4.7.jar"/>
</jar>
<jar jarfile="${distNS}/NS.src.jar">
<fileset dir="${srcNS}">
<include name="beast/**/*.java" />
<include name="beast/**/*.png" />
<include name="beast/**/*.xsl" />
<include name="nestedsampling/**/*.java" />
<include name="nestedsampling/**/*.png" />
<include name="nestedsampling/**/*.xsl" />
</fileset>
</jar>
<jar jarfile="${distNS}/NS.addon.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
</manifest>
<fileset dir="${buildNS}">
<include name="beast/**/*.class" />
<include name="nestedsampling/**/*.class" />
<include name="util/**/*.class" />
<include name="**/*.properties" />
</fileset>
Expand Down Expand Up @@ -193,7 +170,7 @@
<mkdir dir="${Add_on_dir}" />
<mkdir dir="${Add_on_dir}/lib" />
<mkdir dir="${Add_on_dir}/examples" />
<mkdir dir="${Add_on_dir}/templates" />
<mkdir dir="${Add_on_dir}/fxtemplates" />

<copy todir="${Add_on_dir}">
<fileset file="version.xml"/>
Expand All @@ -207,17 +184,16 @@
<copy todir="${Add_on_dir}">
<fileset dir="${distNS}" includes="NS.src.jar" />
</copy>
<copy todir="${Add_on_dir}/templates">
<fileset file="templates/NS.xml" />
<fileset file="templates/AutoPartition.xml" />
<copy todir="${Add_on_dir}/fxtemplates">
<fileset file="fxtemplates/NS.xml" />
</copy>

<jar jarfile="${distNS}/NS.addon.v${version}.zip">
<jar jarfile="${distNS}/NS.addon.v${NSversion}.zip">
<fileset dir="${Add_on_dir}">
<include name="**/*" />
</fileset>
</jar>
<echo message="Add-on version v${version} release is finished." />
<echo message="Add-on version v${NSversion} release is finished." />
</target>

</project>
42 changes: 21 additions & 21 deletions examples/NS_4taxa_NormalBirthRate.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><beast beautitemplate='Standard' beautistatus='' namespace="beast.core:beast.evolution.alignment:beast.evolution.tree.coalescent:beast.core.util:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel:beast.evolution.substitutionmodel:beast.evolution.likelihood" required="" version="2.5">
<?xml version="1.0" encoding="UTF-8" standalone="no"?><beast beautitemplate='Standard' beautistatus='' namespace="beast.pkgmgmt:beast.base.core:beast.base.inference:beast.base.evolution.alignment:beast.base.evolution.tree.coalescent:beast.pkgmgmt:beast.base.core:beast.base.inference.util:beast.evolution.nuc:beast.base.evolution.operator:beast.base.inference.operator:beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood" required="" version="2.5">


<data
Expand Down Expand Up @@ -34,16 +34,16 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)



<map name="Uniform" >beast.math.distributions.Uniform</map>
<map name="Exponential" >beast.math.distributions.Exponential</map>
<map name="LogNormal" >beast.math.distributions.LogNormalDistributionModel</map>
<map name="Normal" >beast.math.distributions.Normal</map>
<map name="Beta" >beast.math.distributions.Beta</map>
<map name="Gamma" >beast.math.distributions.Gamma</map>
<map name="LaplaceDistribution" >beast.math.distributions.LaplaceDistribution</map>
<map name="prior" >beast.math.distributions.Prior</map>
<map name="InverseGamma" >beast.math.distributions.InverseGamma</map>
<map name="OneOnX" >beast.math.distributions.OneOnX</map>
<map name="Uniform" >beast.base.inference.distribution.Uniform</map>
<map name="Exponential" >beast.base.inference.distribution.Exponential</map>
<map name="LogNormal" >beast.base.inference.distribution.LogNormalDistributionModel</map>
<map name="Normal" >beast.base.inference.distribution.Normal</map>
<map name="Beta" >beast.base.inference.distribution.Beta</map>
<map name="Gamma" >beast.base.inference.distribution.Gamma</map>
<map name="LaplaceDistribution" >beast.base.inference.distribution.LaplaceDistribution</map>
<map name="prior" >beast.base.inference.distribution.Prior</map>
<map name="InverseGamma" >beast.base.inference.distribution.InverseGamma</map>
<map name="OneOnX" >beast.base.inference.distribution.OneOnX</map>


<run id="mcmc" spec="beast.gss.NS" subChainLength="10000" chainLength="250000" preBurnin="0" particleCount="100" epsilon="1e-10"
Expand All @@ -62,22 +62,22 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)
<parameter id="freqParameter.s:dna" dimension="4" lower="0.0" name="stateNode" upper="1.0">0.25</parameter>
</state>

<init id="RandomTree.t:dna" spec="beast.evolution.tree.RandomTree" estimate="false" initial="@Tree.t:dna" taxa="@dna">
<init id="RandomTree.t:dna" spec="beast.base.evolution.tree.coalescent.RandomTree" estimate="false" initial="@Tree.t:dna" taxa="@dna">
<populationModel id="ConstantPopulation0.t:dna" spec="ConstantPopulation">
<parameter id="randomPopSize.t:dna" name="popSize">1.0</parameter>
</populationModel>
</init>

<distribution id="posterior" spec="util.CompoundDistribution">
<distribution id="prior" spec="util.CompoundDistribution">
<distribution id="YuleModel.t:dna" spec="beast.evolution.speciation.YuleModel" birthDiffRate="@birthRate.t:dna" tree="@Tree.t:dna"/>
<distribution id="posterior" spec="beast.base.inference.CompoundDistribution">
<distribution id="prior" spec="beast.base.inference.CompoundDistribution">
<distribution id="YuleModel.t:dna" spec="beast.base.evolution.speciation.YuleModel" birthDiffRate="@birthRate.t:dna" tree="@Tree.t:dna"/>
<prior id="YuleBirthRatePrior.t:dna" name="distribution" x="@birthRate.t:dna">
<Normal name="distr" mean="6.5" sigma="0.1" spec="beast.math.distributions.Normal"/>
<Normal name="distr" mean="6.5" sigma="0.1" spec="beast.base.inference.distribution.Normal"/>
</prior>
<prior id="KappaPrior.s:dna" name="distribution" x="@kappa.s:dna">
<Normal id="LogNormalDistributionModel.0" name="distr" mean="2.5" sigma="0.1"/>
</prior>
<distribution id="root.prior" spec="beast.math.distributions.MRCAPrior" monophyletic="true" tree="@Tree.t:dna">
<distribution id="root.prior" spec="beast.base.evolution.tree.MRCAPrior" monophyletic="true" tree="@Tree.t:dna">
<taxonset id="root" spec="TaxonSet">
<taxon id="Cow" spec="Taxon"/>
<taxon id="Human" spec="Taxon"/>
Expand All @@ -87,7 +87,7 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)
<Normal name="distr" mean="0.19" sigma="0.05"/>
</distribution>
</distribution>
<distribution id="likelihood" spec="util.CompoundDistribution" useThreads="true">
<distribution id="likelihood" spec="beast.base.inference.CompoundDistribution" useThreads="true">
<distribution id="treeLikelihood.dna" spec="ThreadedTreeLikelihood" data="@dna" tree="@Tree.t:dna">
<siteModel id="SiteModel.s:dna" spec="SiteModel">
<parameter id="mutationRate.s:dna" estimate="false" name="mutationRate">1.0</parameter>
Expand All @@ -97,7 +97,7 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)
<frequencies id="estimatedFreqs.s:dna" spec="Frequencies" frequencies="@freqParameter.s:dna"/>
</substModel>
</siteModel>
<branchRateModel id="StrictClock.c:dna" spec="beast.evolution.branchratemodel.StrictClockModel">
<branchRateModel id="StrictClock.c:dna" spec="beast.base.evolution.branchratemodel.StrictClockModel">
<parameter id="clockRate.c:dna" estimate="false" name="clock.rate">1.0</parameter>
</branchRateModel>
</distribution>
Expand Down Expand Up @@ -131,7 +131,7 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)
<log idref="likelihood"/>
<log idref="prior"/>
<log idref="treeLikelihood.dna"/>
<log id="TreeHeight.t:dna" spec="beast.evolution.tree.TreeHeightLogger" tree="@Tree.t:dna"/>
<log id="TreeHeight.t:dna" spec="beast.base.evolution.tree.TreeHeightLogger" tree="@Tree.t:dna"/>
<log idref="YuleModel.t:dna"/>
<log idref="birthRate.t:dna"/>
<log idref="kappa.s:dna"/>
Expand All @@ -147,7 +147,7 @@ ML: -2349.814260249774 Information: 14.442480805674677 (SD ~ 0.12)
</logger>

<logger id="treelog.t:dna" fileName="$(tree).trees" logEvery="1000" mode="tree">
<log id="TreeWithMetaDataLogger.t:dna" spec="beast.evolution.tree.TreeWithMetaDataLogger" tree="@Tree.t:dna"/>
<log id="TreeWithMetaDataLogger.t:dna" spec="beast.base.evolution.TreeWithMetaDataLogger" tree="@Tree.t:dna"/>
</logger>


Expand Down
38 changes: 19 additions & 19 deletions examples/dna.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><beast beautitemplate='Standard' beautistatus='' namespace="beast.core:beast.evolution.alignment:beast.evolution.tree.coalescent:beast.core.util:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel:beast.evolution.substitutionmodel:beast.evolution.likelihood" required="" version="2.4">
<?xml version="1.0" encoding="UTF-8" standalone="no"?><beast beautitemplate='Standard' beautistatus='' namespace="beast.pkgmgmt:beast.base.core:beast.base.inference:beast.base.evolution.alignment:beast.base.evolution.tree.coalescent:beast.pkgmgmt:beast.base.core:beast.base.inference.util:beast.evolution.nuc:beast.base.evolution.operator:beast.base.inference.operator:beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood" required="" version="2.4">


<data
Expand All @@ -24,16 +24,16 @@ name="alignment">



<map name="Uniform" >beast.math.distributions.Uniform</map>
<map name="Exponential" >beast.math.distributions.Exponential</map>
<map name="LogNormal" >beast.math.distributions.LogNormalDistributionModel</map>
<map name="Normal" >beast.math.distributions.Normal</map>
<map name="Beta" >beast.math.distributions.Beta</map>
<map name="Gamma" >beast.math.distributions.Gamma</map>
<map name="LaplaceDistribution" >beast.math.distributions.LaplaceDistribution</map>
<map name="prior" >beast.math.distributions.Prior</map>
<map name="InverseGamma" >beast.math.distributions.InverseGamma</map>
<map name="OneOnX" >beast.math.distributions.OneOnX</map>
<map name="Uniform" >beast.base.inference.distribution.Uniform</map>
<map name="Exponential" >beast.base.inference.distribution.Exponential</map>
<map name="LogNormal" >beast.base.inference.distribution.LogNormalDistributionModel</map>
<map name="Normal" >beast.base.inference.distribution.Normal</map>
<map name="Beta" >beast.base.inference.distribution.Beta</map>
<map name="Gamma" >beast.base.inference.distribution.Gamma</map>
<map name="LaplaceDistribution" >beast.base.inference.distribution.LaplaceDistribution</map>
<map name="prior" >beast.base.inference.distribution.Prior</map>
<map name="InverseGamma" >beast.base.inference.distribution.InverseGamma</map>
<map name="OneOnX" >beast.base.inference.distribution.OneOnX</map>


<!-- stepping stone
Expand All @@ -56,28 +56,28 @@ name="alignment">
<parameter id="birthRate.t:dna" name="stateNode">1.0</parameter>
</state>

<init id="RandomTree.t:dna" spec="beast.evolution.tree.RandomTree" estimate="false" initial="@Tree.t:dna" taxa="@dna">
<init id="RandomTree.t:dna" spec="beast.base.evolution.tree.coalescent.RandomTree" estimate="false" initial="@Tree.t:dna" taxa="@dna">
<populationModel id="ConstantPopulation0.t:dna" spec="ConstantPopulation">
<parameter id="randomPopSize.t:dna" name="popSize">1.0</parameter>
</populationModel>
</init>

<distribution id="posterior" spec="util.CompoundDistribution">
<distribution id="prior" spec="util.CompoundDistribution">
<distribution id="YuleModel.t:dna" spec="beast.evolution.speciation.YuleModel" birthDiffRate="@birthRate.t:dna" tree="@Tree.t:dna"/>
<distribution id="posterior" spec="beast.base.inference.CompoundDistribution">
<distribution id="prior" spec="beast.base.inference.CompoundDistribution">
<distribution id="YuleModel.t:dna" spec="beast.base.evolution.speciation.YuleModel" birthDiffRate="@birthRate.t:dna" tree="@Tree.t:dna"/>
<prior id="YuleBirthRatePrior.t:dna" name="distribution" x="@birthRate.t:dna">
<Uniform id="Uniform.1" name="distr" upper="10"/>
</prior>
</distribution>
<distribution id="likelihood" spec="util.CompoundDistribution" useThreads="true">
<distribution id="likelihood" spec="beast.base.inference.CompoundDistribution" useThreads="true">
<distribution id="treeLikelihood.dna" spec="ThreadedTreeLikelihood" data="@dna" tree="@Tree.t:dna">
<siteModel id="SiteModel.s:dna" spec="SiteModel">
<parameter id="mutationRate.s:dna" estimate="false" name="mutationRate">1.0</parameter>
<parameter id="gammaShape.s:dna" estimate="false" name="shape">1.0</parameter>
<parameter id="proportionInvariant.s:dna" estimate="false" lower="0.0" name="proportionInvariant" upper="1.0">0.0</parameter>
<substModel id="JC69.s:dna" spec="JukesCantor"/>
</siteModel>
<branchRateModel id="StrictClock.c:dna" spec="beast.evolution.branchratemodel.StrictClockModel">
<branchRateModel id="StrictClock.c:dna" spec="beast.base.evolution.branchratemodel.StrictClockModel">
<parameter id="clockRate.c:dna" estimate="false" name="clock.rate">1.0</parameter>
</branchRateModel>
</distribution>
Expand Down Expand Up @@ -105,7 +105,7 @@ name="alignment">
<log idref="likelihood"/>
<log idref="prior"/>
<log idref="treeLikelihood.dna"/>
<log id="TreeHeight.t:dna" spec="beast.evolution.tree.TreeHeightLogger" tree="@Tree.t:dna"/>
<log id="TreeHeight.t:dna" spec="beast.base.evolution.tree.TreeHeightLogger" tree="@Tree.t:dna"/>
<log idref="YuleModel.t:dna"/>
<log idref="birthRate.t:dna"/>
</logger>
Expand All @@ -118,7 +118,7 @@ name="alignment">
</logger>

<logger id="treelog.t:dna" fileName="$(tree).trees" logEvery="10000" mode="tree">
<log id="TreeWithMetaDataLogger.t:dna" spec="beast.evolution.tree.TreeWithMetaDataLogger" tree="@Tree.t:dna"/>
<log id="TreeWithMetaDataLogger.t:dna" spec="beast.base.evolution.TreeWithMetaDataLogger" tree="@Tree.t:dna"/>
</logger>

</run>
Expand Down
Loading

0 comments on commit ec57e28

Please sign in to comment.