Skip to content

Commit

Permalink
Merge pull request #34 from jordandouglas/master
Browse files Browse the repository at this point in the history
bdmm port to beast 2.7
  • Loading branch information
denisekuehnert authored Dec 19, 2022
2 parents 360654e + c0d3e54 commit f4793d7
Show file tree
Hide file tree
Showing 47 changed files with 1,675 additions and 1,228 deletions.
38 changes: 30 additions & 8 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

<!-- Location to check for local copy of beast2 repository -->
<property name="beastDir" location="../beast2"/>
<property name="libBeast2" location="${beastDir}/lib" />

<!-- BEAST 2 currently uses Java 1.8 -->
<property name="sourceVersion" value="1.8"/>
<property name="targetVersion" value="1.8"/>
<!-- BEAST 2 currently uses Java 17 -->
<property name="sourceVersion" value="17"/>
<property name="targetVersion" value="17"/>

<!-- Directories necessary for all BEAST 2 packages -->
<property name="doc" location="doc"/>
<property name="examples" location="examples"/>
<property name="scripts" location="scripts"/>
<property name="templates" location="templates"/>
<property name="templates" location="fxtemplates"/>

<!-- BEAST branch and version to build against
(only different for version tags because of
Expand Down Expand Up @@ -45,8 +46,8 @@

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

<mkdir dir="${build}"/>
<mkdir dir="${build-lib}"/>
Expand Down Expand Up @@ -102,6 +103,11 @@
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${beastDir}/lib" includes="*.jar"/>
<fileset dir="${libBeast2}/junit" includes="*.jar"/>
<pathelement path="../BeastFX/build"/>
<pathelement path="../MultiTypeTree/build"/>
<pathelement path="../MASTER/build"/>

</classpath>
</javac>
<jar jarfile="${build-lib}/beast2.jar" basedir="${build-beast}" />
Expand All @@ -117,6 +123,8 @@
<target name="get-dependencies">
<echo>Downloading dependencies...</echo>


<!--
<echo>MultiTypeTree:</echo>
<get src="https://github.com/tgvaughan/MultiTypeTree/releases/download/v7.0.1/MultiTypeTree.v7.0.1.zip"
dest="${build-lib}/MultiTypeTree.zip"/>
Expand All @@ -126,6 +134,7 @@
<fileset dir="${build-lib}/MultiTypeTree/lib" includes="*.jar"/>
</move>
<echo>MASTER:</echo>
<get src="https://github.com/tgvaughan/MASTER/releases/download/v6.1.1/MASTER.package.v6.1.1.zip"
dest="${build-lib}/MASTER.zip"/>
Expand All @@ -134,6 +143,8 @@
<move todir="${build-lib}">
<fileset dir="${build-lib}/MASTER/lib" includes="*.jar"/>
</move>
<echo>SA:</echo>
<get src="https://github.com/CompEvol/sampled-ancestors/releases/download/v2.0.2/SA.v2.0.2.zip"
Expand All @@ -143,6 +154,7 @@
<move todir="${build-lib}">
<fileset dir="${build-lib}/SA/lib" includes="*.jar"/>
</move>
-->

</target>

Expand All @@ -152,6 +164,11 @@
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${build-lib}" includes="*.jar"/>
<fileset dir="${libBeast2}" includes="*.jar"/>
<fileset dir="${libBeast2}/junit" includes="*.jar"/>
<pathelement path="../BeastFX/build"/>
<pathelement path="../MultiTypeTree/build"/>
<pathelement path="../MASTER/build"/>
</classpath>
</javac>
</target>
Expand All @@ -176,6 +193,11 @@
<pathelement path="${build}" />
<fileset dir="${build-lib}" includes="*.jar"/>
<fileset dir="${lib}" includes="*.jar"/>
<fileset dir="${libBeast2}" includes="*.jar"/>
<fileset dir="${libBeast2}/junit" includes="*.jar"/>
<pathelement path="../BeastFX/build"/>
<pathelement path="../MultiTypeTree/build"/>
<pathelement path="../MASTER/build"/>
</classpath>
<batchtest fork="yes" todir="${test-reports}">
<fileset dir="${build}">
Expand All @@ -197,7 +219,7 @@
<mkdir dir="${pack}"/>
<mkdir dir="${pack}/examples"/>
<mkdir dir="${pack}/scripts"/>
<mkdir dir="${pack}/templates"/>
<mkdir dir="${pack}/fxtemplates"/>
<mkdir dir="${pack}/lib"/>
<mkdir dir="${pack}/doc"/>

Expand Down Expand Up @@ -229,7 +251,7 @@


<mkdir dir="${templates}" />
<copy todir="${pack}/templates">
<copy todir="${pack}/fxtemplates">
<fileset dir="${templates}" includes="*.xml" />
</copy>

Expand Down
50 changes: 25 additions & 25 deletions examples/BDMM_migration_example.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?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:beast.evolution.tree:beast.core.parameter:multitypetree.operators:multitypetree.util:beast.math.distributions" version="2.0">
<?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.base.util:beast.base.math:beast.evolution.nuc:beast.base.evolution.operator:beast.base.inference.operator:beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood:beast.base.evolution.tree:beast.base.inference.parameter:multitypetree.operators:multitypetree.util:beast.base.math.distributions" version="2.0">

<!-- initial seed to get it started e.g. 1437659373994 -->

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

<alignment filter="1::3,2::3" id="Bahl_H3N2.CP1+2" spec="FilteredAlignment" data="@Bahl_H3N2"/>
<alignment filter="3::3" id="Bahl_H3N2.CP3" spec="FilteredAlignment" data="@Bahl_H3N2"/>
<branchRateModel clock.rate="@clockRate" id="StrictClock" spec="beast.evolution.branchratemodel.StrictClockModel"/>
<branchRateModel clock.rate="@clockRate" id="StrictClock" spec="beast.base.evolution.branchratemodel.StrictClockModel"/>

<data id="Bahl_H3N2" name="alignment">
<sequence id="SEA_2005.510_Cambodia/9/2005_H3N2" taxon="SEA_2005.510_Cambodia/9/2005_H3N2" totalcount="4" value="CAAAAACTTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGCACCATGCAGTACCAAACGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGCTACTGAGCTGGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGGCTTCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTACCCTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGGAGTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCACTTAAAATTCAAATACCCAGCATTGAACGTGACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGTCCACCACCCGGGTACGGACAATGACCAAATCTTCTTGTATGCTCAAGCATCAGGAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCTGGTCTAGACCCAGAGTAAGGAATATCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACATACTTTTGATTAACAGCACAGGGAATCTAATTGCTCCTAGGGGTTACTTCAAAATACGAAGTGGGAAAAGCTCAATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTCCCAATGACAAACCATTTCAAAATGTAAACAGGATCACATATGGGGCCTGTCCCAGATATGTTAAGCAAAACACTCTGAAATTGGCAACAGGGATGCGAAATGTACCAGAGAAACAAACTAGA"/>
Expand Down Expand Up @@ -75,7 +75,7 @@
<sequence id="Euro_France_2004.820_EU501527_A/POITIERS/719/2004" taxon="Euro_France_2004.820_EU501527_A/POITIERS/719/2004" totalcount="4" value="CAAAAACTTCCCGGAAATGACAACAGCATGGCAACGCTGTGCCTTGGGCACCATGCAGTACCAAACGGAACGATAGTGAAAACAATCACGAATGACCAAGTTGAAGTTACTAATGCTACTGAGCTGGTTCAGATTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGAAAACTGCACACTAATAGATGCTCTACTGGGAGACCCTCAGTGTGATGGCTTCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTACCCCTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGGAGTTTAACAATGAAAGCTTCGATTGGACTGGAGTCACTCAGAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTATTAAAAGTTTCTTTAGTAGATTGAATTGGTTGACCCACTTAAATTACAAATACCCAGCATTGAACGTGACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGTTCACCACCCGAGTACGGACAGTGACCAAATCAGCCTATATGCTCAAGCATCAGGAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATCTAGACCCAGGATAAGGGATATCTCCAGCCGAATAAGCATCTATTGGACAATAGTAAAACCGGGTGACATACTTTTGATTAACAGCACAGGGAATCTAATTGCTCCTCGGGGCTACTTCAAAATACGAAGTGGGAAAAGCTCAATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTCCCAATGACAAACCATTTCAAAATGTAAACAGGATCACATATGGGGCCTGTCCCAGATATGTTAAGCAAAACACTCTGAAATTGGCAACAGGGATGCGAAATGTACCAGAGAAACAAACTAGA"/>
</data>

<trait id="typeTrait" spec="beast.evolution.tree.TraitSet" traitname="type">
<trait id="typeTrait" spec="beast.base.evolution.tree.TraitSet" traitname="type">
<!-- 0=North, 1=Tropics, 2=South -->
SEA_2005.510_Cambodia/9/2005_H3N2=1,
SEA_2003.189_MALAYSIA/226/2003_H3N2=1,
Expand Down Expand Up @@ -137,7 +137,7 @@
</taxa>
</trait>

<trait id="dateTrait" spec="beast.evolution.tree.TraitSet" traitname="date">
<trait id="dateTrait" spec="beast.base.evolution.tree.TraitSet" traitname="date">
SEA_2005.510_Cambodia/9/2005_H3N2=2005.51,
SEA_2003.189_MALAYSIA/226/2003_H3N2=2003.189,
SEA_2004.123_MALAYSIA/2556/2004_H3N2=2004.123,
Expand Down Expand Up @@ -196,18 +196,18 @@
<taxa idref="TaxonSet"/>
</trait>

<model spec='MigrationModelForward' id="migModel" rateMatrixIsForward="true">
<typeSet spec="beast.evolution.tree.TypeSet" id="typeSet" typeTraitSet="@typeTrait"/>
<model spec='bdmm.evolution.tree.MigrationModelForward' id="migModel" rateMatrixIsForward="true">
<typeSet spec="multitypetree.evolution.tree.TypeSet" id="typeSet" typeTraitSet="@typeTrait"/>
<rateMatrix idref="rateMatrix"/>
<popSizes id="popSize" spec="RealParameter" value="1 1 1"/>
</model>


<run chainLength="100000000" id="mcmc" spec="MCMC" storeEvery="1000" numInitializationAttempts="100">

<init spec='beast.evolution.tree.StructuredCoalescentMultiTypeTree' id='tree' >
<init spec="multitypetree.evolution.tree.StructuredCoalescentMultiTypeTree" id='tree' >
<typeSet idref="typeSet"/>
<migrationModel spec="MigrationModelForward" popSizes="1 1 1" rateMatrix=".1 1 .1 1 .2 .2" rateMatrixIsForward="true">
<migrationModel spec="bdmm.evolution.tree.MigrationModelForward" popSizes="1 1 1" rateMatrix=".1 1 .1 1 .2 .2" rateMatrixIsForward="true">
<typeSet idref="typeSet"/>
</migrationModel>
<trait idref='typeTrait'/>
Expand All @@ -230,15 +230,15 @@
<!--stateNode idref="weightparameter"/-->
</state>

<distribution id="posterior" spec="util.CompoundDistribution">
<distribution id="prior" spec="util.CompoundDistribution">
<distribution spec="beast.evolution.speciation.BirthDeathMigrationModel"
<distribution id="posterior" spec="beast.base.inference.CompoundDistribution">
<distribution id="prior" spec="beast.base.inference.CompoundDistribution">
<distribution spec="bdmm.evolution.speciation.BirthDeathMigrationModel"
R0="@R0" becomeUninfectiousRate="@becomeUninfectiousRate" samplingProportion="@samplingProportion"
id="BDMM" tree="@tree" stateNumber="3">
<migrationMatrix id="rateMatrix" spec='RealParameter' value="1" dimension="6" lower="0" upper="1000"/>
<frequencies id="geo-frequencies" spec='RealParameter' value="0.334 0.333 0.333" lower="0" upper="1"/>
<parameter name="samplingRateChangeTimes" value="0. 2.63"/> <!-- earliest sample: 2003.019 , latest: 2005.641 (diff 2.622) -->
<reverseTimeArrays spec="beast.core.parameter.BooleanParameter" value="false false true false"/>
<reverseTimeArrays spec="beast.base.inference.parameter.BooleanParameter" value="false false true false"/>
</distribution>
<prior id="rateMatrixPrior" name="distribution" x="@rateMatrix">
<LogNormal name="distr" M="0" S="1"/>
Expand All @@ -258,7 +258,7 @@
<Beta id="Beta.0" name="distr" alpha="1." beta="9999."/>
</distribution>
</distribution>
<distribution id="likelihood" spec="util.CompoundDistribution">
<distribution id="likelihood" spec="beast.base.inference.CompoundDistribution">
<plate spec='util.Plate' var='n' range='1+2,3'>
<distribution data="@Bahl_H3N2.CP$(n)" branchRateModel="@StrictClock" id="treeLikelihood.CP$(n)" spec="TreeLikelihood" tree="@tree">
<siteModel id="SiteModel.s:Bahl_H3N2.CP$(n)" spec="SiteModel">
Expand Down Expand Up @@ -335,7 +335,7 @@
<log idref="likelihood"/>
<log idref="treeLikelihood.CP1+2"/>
<log idref="treeLikelihood.CP3"/>
<log id="TreeHeight" spec="beast.evolution.tree.TreeHeightLogger" tree="@tree"/>
<log id="TreeHeight" spec="beast.base.evolution.tree.TreeHeightLogger" tree="@tree"/>
<log id="TreeRootCol" spec="TreeRootTypeLogger" multiTypeTree="@tree"/>
<log id="MigCount" spec="TypeChangeCounts" multiTypeTree="@tree" migrationModel="@migModel"/>
<log idref="R0"/>
Expand Down Expand Up @@ -368,7 +368,7 @@
<logger fileName="BDMM_migration_example_$(seed).col.trees" id="coltreelog" log="@tree" logEvery="1000" mode="tree"/>

<logger fileName="BDMM_migration_example_$(seed).trees" id="treelog" logEvery="1000" mode="tree">
<log branchratemodel="@StrictClock" id="TreeWithMetaDataLogger.t:Bahl" spec="beast.evolution.tree.TreeWithMetaDataLogger" tree="@tree"/>
<log branchratemodel="@StrictClock" id="TreeWithMetaDataLogger.t:Bahl" spec="beast.base.evolution.TreeWithMetaDataLogger" tree="@tree"/>
</logger>

</run>
Expand Down
Loading

0 comments on commit f4793d7

Please sign in to comment.