Skip to content

Commit

Permalink
convert templates and tests, fix build.xml #8
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Nov 11, 2022
1 parent b1dc41a commit 999c974
Show file tree
Hide file tree
Showing 18 changed files with 132 additions and 112 deletions.
98 changes: 67 additions & 31 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@

<!-- Location to check for local copy of beast2 repository -->
<property name="beastDir" location="../beast2"/>
<property name="beastFX" location="../BeastFX" />
<property name="lib" location="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"/>

<property name="ZuluJDK" location="../../Downloads/zulu17.36.13-ca-fx-jdk17.0.4-macosx_x64/zulu-17.jdk/Contents/Home/bin/javac" />

<!-- Directories necessary for all BEAST 2 packages -->
<property name="doc" location="doc"/>
Expand All @@ -33,7 +37,7 @@
<property name="pack" location="${dist}/package"/>

<!-- Prepare for compilation -->
<target name="init">
<target name="init" depends="clean">

<available file="version.xml" property="versionAvailable"/>
<fail unless="versionAvailable">
Expand All @@ -45,16 +49,13 @@

<!-- 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}"/>
<mkdir dir="${dist}"/>

<!--copy todir="${build-lib}">
<fileset dir="${lib}" includes="*.jar"/>
</copy-->
</target>

<!-- Get beast -->
Expand Down Expand Up @@ -83,6 +84,7 @@
<jar jarfile="${build-lib}/beast2.jar" basedir="${build-beast}/beast2-${beast-version}/build" />
<copy todir="${build-lib}">
<fileset dir="${build-beast}/beast2-${beast-version}/lib" includes="*.jar"/>
<fileset dir="${build-beast}/beast2-${beast-version}/lib/junit" includes="junit-*.jar"/>
</copy>

<delete dir="${build-beast}" />
Expand All @@ -91,43 +93,84 @@
<target name="build-local-beast" depends="find-beast" if="localBeastAvailable">
<echo>Compiling against beast2 source found at ${beastDir}.</echo>

<!-- Read package name and version from xml file -->
<xmlproperty file="${beastDir}/version.xml" prefix="BeastVersionFile" />
<property name="beastName" value="${BeastVersionFile.package(name)}" />
<property name="beastVersion" value="${BeastVersionFile.package(version)}" />

<mkdir dir="${build-beast}"/>

<javac target="${targetVersion}" source="${sourceVersion}"
srcdir="${beastDir}/src"
destdir="${build-beast}" includeantruntime="false">
srcdir="${beastDir}/src" destdir="${build-beast}"
includeantruntime="false">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${beastDir}/lib" includes="*.jar"/>
</classpath>
</javac>
<jar jarfile="${build-lib}/beast2.jar" basedir="${build-beast}" />
<jar jarfile="${build-lib}/beast.v${beastVersion}.jar" basedir="${build-beast}" />
<copy todir="${build-lib}">
<fileset dir="${beastDir}/lib" includes="*.jar"/>
<fileset dir="${beastDir}/lib/junit" includes="junit-*.jar"/>
</copy>

<delete dir="${build-beast}" />
</target>

<target name="build-beast" depends="build-local-beast,build-remote-beast"/>

<!-- Compile -->
<target name="compile" depends="build-beast">
<javac target="${targetVersion}" source="${sourceVersion}" srcdir="${src}" destdir="${build}" includeantruntime="false">
<target name="build-BeastFX" depends="build-beast">
<echo>Compiling BeastFX source found at ${beastFX}.</echo>

<!-- Read package name and version from xml file -->
<xmlproperty file="${beastFX}/version.xml" prefix="BeastFXVersionFile" />
<property name="beastFXName" value="${BeastFXVersionFile.package(name)}" />
<property name="beastFXVersion" value="${BeastFXVersionFile.package(version)}" />

<mkdir dir="${build-beast}"/>

<javac target="${targetVersion}" source="${sourceVersion}"
srcdir="${beastFX}/src" destdir="${build-beast}"
executable="${ZuluJDK}" fork="true" includeantruntime="false">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${build-lib}" includes="*.jar"/>
</classpath>
<include name="beastfx/**/**" />
</javac>
</target>

<target name="copy-resources" depends="compile">
<copy todir="${build}">
<fileset dir="${src}"
includes="**/*.png" />
<jar jarfile="${build-lib}/beastFX.v${beastFXVersion}.jar" basedir="${build-beast}" />
<copy todir="${build-lib}">
<!-- <fileset dir="${beastFX}/locallib" includes="*.jar"/>-->
<fileset dir="${beastFX}/src" includes="**/*.png" />
<fileset dir="${beastFX}/src" includes="**/*.fxml" />
<fileset dir="${beastFX}/resources" includes="**/*.css" />
</copy>

<delete dir="${build-beast}" />

<echo message="Successfully compiled beastFX v${beastFXVersion}." />
</target>

<!-- Compile -->
<target name="compile" depends="build-BeastFX">
<javac target="${targetVersion}" source="${sourceVersion}" srcdir="${src}" destdir="${build}"
executable="${ZuluJDK}" fork="true" includeantruntime="false">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${build-lib}" includes="*.jar"/>
</classpath>
<include name="codonmodels/**/**" />
</javac>
</target>

<!-- <target name="copy-resources" depends="compile">-->
<!-- <copy todir="${build}">-->
<!-- <fileset dir="${src}"-->
<!-- includes="**/*.png" />-->
<!-- </copy>-->
<!-- </target>-->

<!-- Prepare for unit test compilation -->
<target name="init-test" depends="init">
<mkdir dir="${build-test}"/>
Expand All @@ -136,7 +179,7 @@


<!-- Compile unit tests -->
<target name="compile-test" depends="init-test,compile,copy-resources">
<target name="compile-test" depends="init-test,compile">
<javac target="${targetVersion}" source="${sourceVersion}" srcdir="${test}" destdir="${build-test}" includeantruntime="false">
<classpath>
<pathelement path="${classpath}"/>
Expand All @@ -151,7 +194,6 @@
<target name="test" depends="compile-test">
<junit printsummary="yes" failureproperty="testFailed" showoutput="true">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${build}" />
<pathelement path="${build-test}" />
<fileset dir="${build-lib}" includes="*.jar"/>
Expand All @@ -170,7 +212,7 @@


<!-- Create BEAST 2 package -->
<target name="build" depends="compile,copy-resources">
<target name="build" depends="compile">
<property name="fullName" value="${projName}.v${projVersion}"/>

<mkdir dir="${pack}"/>
Expand All @@ -181,30 +223,24 @@

<jar jarfile="${pack}/${fullName}.src.jar" basedir="${src}" />

<!--mkdir dir="${lib}" />
<!--
<copy todir="${pack}/lib">
<fileset dir="${lib}" includes="*.jar" />
</copy-->
<jar jarfile="${pack}/lib/${fullName}.jar" basedir="${build}" />

<copy file="README.md" tofile="${pack}/README" />
<!--copy file="COPYING" todir="${pack}" /-->
<!--copy todir="${pack}">
<fileset dir="${lib}" includes="LICENSE*" />
</copy-->
<copy file="LICENSE" tofile="${pack}/LICENSE" />

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

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

<mkdir dir="${doc}" />
<copy todir="${pack}/doc">
<fileset dir="${doc}" includes="*.tex,*.doc,*.lyx,*.txt"/>
</copy>
Expand Down
15 changes: 9 additions & 6 deletions fxtemplates/CMSubstModels.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<beast version='2.0'
namespace='beast.app.beauti:beast.pkgmgmt:beast.base.core:beast.base.inference:beast.base.evolution.branchratemodel
:beast.evolution.speciation:beast.evolution.tree.coalescent:beast.core.util
:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel
:beast.evolution.substitutionmodel:beast.evolution.likelihood:beast.evolution:beast.math.distributions
:beast.evolution.alignment:beast.evolution.datatype:codonmodels'>
<beast version='2.7'
namespace='beast.base.core:beast.base.inference:beast.base.inference.util:
beast.evolution.nuc:beast.base.evolution.alignment:beast.base.evolution.datatype:
beast.base.evolution.branchratemodel:beast.base.evolution.speciation:beast.base.evolution.tree.coalescent:
beast.base.evolution.operator:beast.base.inference.operator:beast.evolution:beast.base.math.distributions:
beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood:
codonmodels:codonmodels.evolution:codonmodels.evolution.alignment:codonmodels.evolution.datatype:
codonmodels.evolution.likelihood:codonmodels.evolution.operators:codonmodels.evolution.tree'
templateinfo='sub-template for codon substitution models'>


<mergewith point='codonSubstModelTemplates'>
Expand Down
47 changes: 24 additions & 23 deletions fxtemplates/CodonSubstModels.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<beast version='2.0'
namespace='beast.app.beauti:beast.pkgmgmt:beast.base.core:beast.base.inference:beast.base.evolution.branchratemodel
:beast.evolution.speciation:beast.evolution.tree.coalescent:beast.base.util:beast.util
:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel
:beast.evolution.substitutionmodel:beast.evolution.likelihood:beast.evolution:beast.math.distributions
:beast.evolution.alignment:beast.evolution.datatype:codonmodels'
<beast version='2.7'
namespace='beast.base.core:beast.base.inference:beast.base.inference.util:
beast.evolution.nuc:beast.base.evolution.alignment:beast.base.evolution.datatype:
beast.base.evolution.branchratemodel:beast.base.evolution.speciation:beast.base.evolution.tree.coalescent:
beast.base.evolution.operator:beast.base.inference.operator:beast.evolution:beast.base.math.distributions:
beast.base.evolution.sitemodel:beast.base.evolution.substitutionmodel:beast.base.evolution.likelihood:
codonmodels:codonmodels.evolution:codonmodels.evolution.alignment:codonmodels.evolution.datatype:
codonmodels.evolution.likelihood:codonmodels.evolution.operators:codonmodels.evolution.tree'
templateinfo='template for codon substitution models'>

<map name='connect' reserved='true'>beastfx.app.inputeditor.BeautiConnector</map>
Expand All @@ -19,7 +21,7 @@
<map name='InverseGamma'>beast.base.inference.distribution.InverseGamma</map>
<map name='prior'>beast.base.inference.distribution.Prior</map>

<beauticonfig spec='BeautiConfig'
<beauticonfig spec='beastfx.app.inputeditor.BeautiConfig'
inputLabelMap='beast.base.inference.MCMC.operator=Operators,
beast.base.inference.MCMC.logger=Loggers,
beast.base.evolution.sitemodel.SiteModel.mutationRate =Substitution Rate,
Expand Down Expand Up @@ -82,10 +84,7 @@
beast.base.evolution.substitutionmodel.MTREV.frequencies,
beast.base.evolution.substitutionmodel.GTR.rates,
beast.base.evolution.substitutionmodel.JukesCantor.frequencies,
codonmodels.M0Model.rates,
codonmodels.M0Model.eigenSystem,
codonmodels.M0Model.verbose,
beast.base.inference.distribution.Prior.x,
beast.base.inference.distribution.Prior.x,
beast.base.evolution.tree.MRCAPrior.tree,
beast.base.evolution.tree.MRCAPrior.monophyletic,
beast.base.evolution.tree.MRCAPrior.taxonset,
Expand All @@ -101,71 +100,73 @@
beast.base.evolution.tree.coalescent.BayesianSkyline.treeIntervals,
beast.base.evolution.tree.coalescent.BayesianSkyline.groupSizes,
beast.base.evolution.tree.coalescent.BayesianSkyline.popSizes,
beast.base.evolution.speciation.YuleModel.originHeight
'
beast.base.evolution.speciation.YuleModel.originHeight,
codonmodels.M0Model.rates,
codonmodels.M0Model.eigenSystem,
codonmodels.M0Model.verbose'
buttonLabelMap='beast.app.beauti.BeautiInitDlg.&gt;&gt; details=Edit parameters'
>
<!--disableMenus='Mode'-->

<panel spec='BeautiPanelConfig' panelname="Partitions" tiptext="Codon Data Partitions"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Partitions" tiptext="Codon Data Partitions"
path='distribution/distribution[id="likelihood"]/distribution/data'
hasPartitions="none" icon='2220.png.x' forceExpansion='FALSE'
type='beast.base.evolution.alignment.Alignment'
/>
<mergepoint id='aux-partitions-panels'/>

<panel spec='BeautiPanelConfig' panelname="Tip Dates" tiptext="Allows to specify data that a taxon was sampled"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Tip Dates" tiptext="Allows to specify data that a taxon was sampled"
path='tree'
hasPartitions="Tree" icon='2.png.x' forceExpansion='TRUE'
isVisible='true'
/>
<mergepoint id='aux-tipdates-panels'/>

<panel spec='BeautiPanelConfig' panelname="Site Model"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Site Model"
tiptext="Site model and codon substitution model specifications"
path='siteModel' hasPartitions="SiteModel" icon='3.png.x' forceExpansion='TRUE'
/>

<mergepoint id='aux-sitemodel-panels'/>

<panel spec='BeautiPanelConfig' panelname="Clock Model" tiptext="Clock model"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Clock Model" tiptext="Clock model"
path='branchRateModel'
hasPartitions="ClockModel" icon='4.png.x' forceExpansion='TRUE'
/>
<mergepoint id='aux-clockmodel-panels'/>
<panel spec='BeautiPanelConfig' panelname="Initialization" tiptext="Initial state"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Initialization" tiptext="Initial state"
path='state/stateNode'
hasPartitions="none" icon='6.png.x' forceExpansion='TRUE_START_COLLAPSED'
isVisible='false'
/>
<mergepoint id='aux-initilisation-panels'/>
<panel spec='BeautiPanelConfig' panelname="Starting tree" tiptext="Starting tree"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Starting tree" tiptext="Starting tree"
path='init'
hasPartitions="none" icon='6.png.x' forceExpansion='TRUE'
isVisible='false'
/>

<panel spec='BeautiPanelConfig' panelname="Priors" tiptext="Other priors"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Priors" tiptext="Other priors"
path='distribution/distribution[id="prior"]/distribution'
hasPartitions="none" icon='7.png.x' forceExpansion='TRUE_START_COLLAPSED'
type='beast.base.inference.Distribution'
/>
<mergepoint id='aux-priors-panels'/>

<panel spec='BeautiPanelConfig' panelname="Operators" tiptext="MCMC Operator details"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="Operators" tiptext="MCMC Operator details"
path='operator'
hasPartitions="none" icon='8.png.x' forceExpansion='TRUE_START_COLLAPSED'
isVisible='false' buttonStatus='ADD_ONLY'
/>
<mergepoint id='aux-operators-panels'/>

<panel spec='BeautiPanelConfig' panelname="MCMC" tiptext="MCMC parameters"
<panel spec='beastfx.app.inputeditor.BeautiPanelConfig' panelname="MCMC" tiptext="MCMC parameters"
path=''
hasPartitions="none" icon='9.png.x' forceExpansion='TRUE'
/>
<mergepoint id='aux-panels'/>

<alignmentProvider id="Codon Alignment" spec='CodonAlignmentProvider' template='@CodonPartitionTemplate'/>
<alignmentProvider id="Codon Alignment" spec='codonmodels.app.beauti.CodonAlignmentProvider' template='@CodonPartitionTemplate'/>


<partitiontemplate id='CodonPartitionTemplate' spec='BeautiSubTemplate' class='beast.base.evolution.likelihood.ThreadedTreeLikelihood' mainid='mcmc'>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package test.beast.evolution;
package codonmodels.evolution;

import beast.base.inference.parameter.RealParameter;
import beast.base.evolution.alignment.Alignment;
import beast.base.evolution.alignment.Sequence;
import beast.base.evolution.likelihood.TreeLikelihood;
import beast.base.evolution.sitemodel.SiteModel;
import beast.base.evolution.tree.Tree;
import beast.base.evolution.tree.TreeParser;
import beast.base.inference.parameter.RealParameter;
import codonmodels.CodonFrequencies;
import codonmodels.M0Model;
import codonmodels.evolution.datatype.Codon;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package test.beast.evolution.alignment;
package codonmodels.evolution.alignment;

import beast.base.evolution.alignment.Alignment;
import beast.base.evolution.alignment.Sequence;
import codonmodels.evolution.alignment.CodonAlignment;
import codonmodels.evolution.CodonData;
import codonmodels.evolution.datatype.Codon;

import org.junit.Test;
import test.beast.evolution.CodonData;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package test.beast.evolution.datatype;
package codonmodels.evolution.datatype;

import beast.base.evolution.datatype.DataType;
import beast.base.evolution.datatype.Nucleotide;
import codonmodels.evolution.datatype.Codon;

import codonmodels.evolution.CodonData;
import org.junit.Before;
import org.junit.Test;
import test.beast.evolution.CodonData;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Loading

0 comments on commit 999c974

Please sign in to comment.