diff --git a/ci/build_beagle.sh b/.github/scripts/build_beagle.sh similarity index 100% rename from ci/build_beagle.sh rename to .github/scripts/build_beagle.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3b1a59423..7d2467202f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,41 +1,127 @@ name: BEAST CI +#on: +# push: +# branches: +# - main +# pull_request: on: [push] +# Cancel if a newer run is started +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + BEAGLE_DIR: beagle-lib + BEAGLE_LIB: beagle-lib/usr/local/lib + LD_LIBRARY_PATH: beagle-lib/usr/local/lib + BEAGLE_BRANCH: v4_release + jobs: - build: - runs-on: ubuntu-latest - env: - BEAGLE_DIR: beagle-lib - BEAGLE_LIB: beagle-lib/usr/local/lib - LD_LIBRARY_PATH: beagle-lib/usr/local/lib - BEAGLE_BRANCH: v4_release + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: "8" + distribution: "adopt" + - name: Setup cmake + uses: lukka/get-cmake@latest + - name: Cache BEAGLE + id: cache + uses: actions/cache@v4 + with: + path: | + ${{ env.BEAGLE_DIR }} + build/dist + key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }} + - name: Build BEAGLE + run: | + chmod +x ./.github/scripts/build_beagle.sh + ./.github/scripts/build_beagle.sh + - name: Build BEAST + run: ant dist + - name: Check BEAGLE + run: | + ls ${BEAGLE_LIB} + java -jar -Djava.library.path=${BEAGLE_LIB} build/dist/beast.jar -beagle_info + - name: Set up test matrices + id: set-matrices + run: | + echo "xml-matrix=$(ls tests/TestXML/*.xml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT + echo "xml-load-state-matrix=$(ls tests/TestXMLwithLoadState/*.xml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT + outputs: + xml-matrix: ${{ steps.set-matrices.outputs.xml-matrix }} + xml-load-state-matrix: ${{ steps.set-matrices.outputs.xml-load-state-matrix }} + + test-xml: + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + file: ${{fromJson(needs.build.outputs.xml-matrix)}} + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ${{ env.BEAGLE_DIR }} + build/dist + key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }} + restore-keys: | + beagle-beast + - name: Rebuild project + run: ant dist + - name: Run test for ${{ matrix.file }} + run: java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -overwrite ${{ matrix.file }} + test-xml-load-state: + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + file: ${{fromJson(needs.build.outputs.xml-load-state-matrix)}} + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ${{ env.BEAGLE_DIR }} + build/dist + key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }} + restore-keys: | + beagle-beast + - name: Rebuild project + run: ant dist + - name: Run test with load state for ${{ matrix.file }} + run: | + checkpoint=tests/TestXMLwithLoadState/$(basename ${{ matrix.file }} .xml).chkpt + java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -load_state $checkpoint -overwrite ${{ matrix.file }} - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - - name: Setup cmake - uses: lukka/get-cmake@latest - # - name: Build BEAGLE -# - run: git clone -b $BEAGLE_BRANCH --depth 1 https://github.com/beagle-dev/beagle-lib.git $BEAGLE_DIR -# - run: cd $BEAGLE_DIR -# - run: mkdir build -# - run: cd build -# - run: echo $PWD -# - run: cmake -DBUILD_CUDA=OFF -DBUILD_OPENCL=OFF .. -# - run: make DESTDIR=BEAGLE_DIR - - run: chmod +x ci/build_beagle.sh - - run: ci/build_beagle.sh - - run: ant dist - - run: ls ${BEAGLE_LIB} - - run: java -jar -Djava.library.path=${BEAGLE_LIB} build/dist/beast.jar -beagle_info - - run: chmod +x ci/test.sh - - run: ci/test.sh -# - run: chmod +x ci/test_with_load_state.sh -# - run: ci/test_with_load_state.sh - - run: ant -Djava.library.path=${BEAGLE_LIB} junit + test-junit: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: "8" + distribution: "adopt" + - uses: actions/cache@v4 + with: + path: | + ${{ env.BEAGLE_DIR }} + build/dist + key: beagle-beast-${{ hashFiles('**/build_beagle.sh', '**/build.xml') }} + restore-keys: | + beagle-beast + - name: Rebuild project + run: ant dist + - name: Run JUnit tests + run: | + ant -Djava.library.path=${BEAGLE_LIB} junit diff --git a/.gitignore b/.gitignore index 3aec6320e6..4bc95ac153 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ out/ *.tree *.xml !examples/**/*.xml -!ci/**/*.xml +!tests/**/*.xml zig_zag src/revision.txt diff --git a/build.xml b/build.xml index e5be36085d..51c490c1be 100644 --- a/build.xml +++ b/build.xml @@ -198,7 +198,7 @@ - + @@ -414,7 +414,7 @@ --> - + @@ -724,7 +724,10 @@ - + + + + diff --git a/release_tempest/Linux/icons/tempest.png b/release_tempest/Linux/icons/tempest.png deleted file mode 100644 index 90d8e42813..0000000000 Binary files a/release_tempest/Linux/icons/tempest.png and /dev/null differ diff --git a/release_tempest/Linux/scripts/tempest b/release_tempest/Linux/scripts/tempest deleted file mode 100755 index d6bbad0f4a..0000000000 --- a/release_tempest/Linux/scripts/tempest +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -if [ -z "$TEMPEST" ]; then - ## resolve links - $0 may be a link to application - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - # make it fully qualified - saveddir=`pwd` - TEMPEST0=`dirname "$PRG"`/.. - TEMPEST=`cd "$TEMPEST0" && pwd` - cd "$saveddir" -fi - -TEMPEST_LIB=$TEMPEST/lib -java -Xms64m -Xmx1024m -Djava.library.path="$TEMPEST_LIB:/usr/local/lib" -jar $TEMPEST_LIB/tempest.jar $* - diff --git a/release_tempest/Mac/icons/TempEst.icns b/release_tempest/Mac/icons/TempEst.icns deleted file mode 100644 index ee346b6041..0000000000 Binary files a/release_tempest/Mac/icons/TempEst.icns and /dev/null differ diff --git a/release_tempest/Windows/icons/TempEst.ico b/release_tempest/Windows/icons/TempEst.ico deleted file mode 100644 index 71c6a270e9..0000000000 Binary files a/release_tempest/Windows/icons/TempEst.ico and /dev/null differ diff --git a/release_tempest/Windows/tempest_launch4j.xml b/release_tempest/Windows/tempest_launch4j.xml deleted file mode 100644 index 3915174ecc..0000000000 --- a/release_tempest/Windows/tempest_launch4j.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - gui - icons/TempEst.ico - - - 1.6.0 - 64 - 1024 - - - TempEst - 2006-2018 - TempEst - TempEst - TempEst.exe - - diff --git a/release_tempest/common/README.txt b/release_tempest/common/README.txt deleted file mode 100644 index eeb5695a2d..0000000000 --- a/release_tempest/common/README.txt +++ /dev/null @@ -1,109 +0,0 @@ - TempEst v1.5.1 2016 - Temporal Signal Investigation Tool - by - Andrew Rambaut - - Institute of Evolutionary Biology - University of Edinburgh - a.rambaut@ed.ac.uk - -UNIX / Mac OS X / Linux / Windows README -a.rambaut@ed.ac.uk - 22 August 2016 - -Contents: -1) INTRODUCTION -2) INSTALLING AND RUNNING PATH-O-GEN -3) ANALYSING TREES -4) VERSION HISTORY -5) SUPPORT & LINKS -6) CITATION -7) ACKNOWLEDGMENTS - -___________________________________________________________________________ -1) INTRODUCTION - -TempEst is a tool for investigating the temporal signal and 'clocklikeness' of molecular phylogenies. It can read and analyse contemporaneous trees (where all sequences have been collected at the same time) and dated-tip trees (where sequences have been collected at different dates). It is designed for analysing trees that have not been inferred under a molecular-clock assumption to see how valid this assumption may be. It can also root the tree at the position that is likely to be the most compatible with the assumption of the molecular clock. - -This software was formerly known as "Path-O-Gen". -___________________________________________________________________________ -2) INSTALLING AND RUNNING TEMPEST - -Mac OS X: To install TempEst, simply drag the program file to where you normally put applications. Then double click to run. - -Windows: To install TempEst, simply drag the program file to where you normally put applications. Then double click to run. - -Linux / UNIX: Copy or move the folder to where you normally put applications and then double click the "tempest.jar" file (in the lib/ directory) to run or type "./tempest" at the command-line. - -___________________________________________________________________________ -3) ANALYSING TREES - -Once TempEst is running it will ask for a tree file to load. This should be in NEXUS format and should have been constructed using a phylogenetic method that does not assume a molecular clock (such as Neighbor-Joining or Maximum Likelihood or Bayesian methods with the molecular clock option off. It is also important that the trees contain branch lengths as genetic distance (substitutions per site). - -When the tree is loaded you will see a table containg all the taxa (sequence labels). If the sequences are contemporaneous (i.e., not sampled through time) then you can leave this as it is. If the sequences have dates associated with them you can enter them into this table. If the taxon labels have the dates encoded in them, you can use the "Guess Dates" button to try and extract them. The final thing you need to set here is whether the dates are "Since some time in the past" - which they will be for calendar dates or days since some time etc. or "Before the present" - most likely the case for carbon dated samples. - -You can now select the "Trees" tab at the top of the window and you will see your tree, along with a table of statistics on the left. The nature of the statistics will depend on whether the tree has contemporaneous tips or dated tips. If it is a contemporaneous tree then the statistics will include the mean and variance of the root-to-tip distances for all tips. If it has dated tips then the table will contain various details of a regression of root-to-tip distances against dates of sampling. For example the slope of this regression is an estimate of the rate of evolution, the X-Intercept an estimate of the time of the most recent common ancestor of the sample. The variance for the contemporaneous trees and the correlation coefficient for the dated tips will give you some idea about how 'clocklike' the data are (i.e., how much variation in rate there is). - -Selecting the "Best-fitting root" button at the top left of the window will attempt to find the root of the tree that gives the best fit to the hypothesis that the data have a roughly constant rate of evolution. For contemporaneous trees this will find the root which minimizes the variance of root-to-tip variance. For dated tips this will be the root which maximizes the correlation of root-to-tip distance to sampling date. You can also select the "Root-to-tip" tab which will show you a chart of the distribution of root-to-tip distances (a regression against sampling date for dated tips). - -Finally, you can export the tree (rooted as displayed) using the "Export Tree..." option in the file menu and export the raw root to tip data using the "Export Data..." option. To obtain a graphic of the displayed tree or chart, you can use the Print option and then "Save as PDF..." or similar option depending on the operating system being used. - -___________________________________________________________________________ -4) VERSION HISTORY - ----Version 1.5.1 22 August 2016--- - -* Repackaged to allow use on older Java versions (including older Mac OS X). - ----Version 1.5 22 April 2016--- - -* New name, TempEst (formerly Path-O-Gen) -* Re-organization of user-interface - ----Version 1.4 23 April 2013--- - -* Improved the date parsing. Will now read dates with variable precision. -* Can specify date precision in table. These are shown as bars in the plot -* Minor other tweaks - ----Version 1.3 3 November 2010--- - -* Improved the root optimization to use linear regression - should be more robust -* Can import Newick as well as NEXUS tree files -* A new feature: MRCA trace which shows a trace from selected tips to the interpolated position of their MRCA. This can help find anomalous tips (perhaps indicating contamination or mislabelling). - ----Version 1.2 27 November 2009--- - -* Added the ability to select points in the plots and the equivalent taxa will be highlighted in the tree (and vice-versa). -* Added a residual plot for time-sampled trees. This shows the distribution of residual from the regression line to look for outliers. - ----Version 1.1 23 February 2009--- - -* Added a more flexible tree viewing component (based on FigTree) -* Tips of a dated tip tree are now shown coloured by their residual from the root to tip regression line (blue: above, red: below, black on the regression). - ----Version 1.0 12 February 2009--- - -* First released verson - -___________________________________________________________________________ -5) SUPPORT & LINKS - -Please email me to discuss any problems: - -a.rambaut@ed.ac.uk - -___________________________________________________________________________ -6) CITATION - -Rambaut, Lam, de Carvalho & Pybus (2016) Exploring the temporal structure of heterochronous sequences using TempEst. Virus Evolution, 2: vew007 -DOI: http://dx.doi.org/10.1093/ve/vew007 - -___________________________________________________________________________ -7) ACKNOWLEDGMENTS - -Tommy T. Lam, Luiz Max Carvalho & Oliver Pybus -Co-authors of TempEst Manuscript http://dx.doi.org/10.1093/ve/vew007 - -Alexei Drummond, Marc Suchard, Philippe Lemey, and Simon Frost -made significant contributions to development of Path-O-Gen/TempEst. - diff --git a/src/dr/app/beast/BeastVersion.java b/src/dr/app/beast/BeastVersion.java index 272d85d513..47cdd3c274 100644 --- a/src/dr/app/beast/BeastVersion.java +++ b/src/dr/app/beast/BeastVersion.java @@ -60,7 +60,7 @@ public class BeastVersion implements Version, Citable { /** * Version string: assumed to be in format x.x.x */ - private static final String VERSION = "10.5.0-beta4"; + private static final String VERSION = "10.5.0-beta5"; private static final String DATE_STRING = "2002-2024"; diff --git a/src/dr/app/beauti/clockmodelspanel/PartitionClockModelPanel.java b/src/dr/app/beauti/clockmodelspanel/PartitionClockModelPanel.java index a1230fdc4c..f546517252 100644 --- a/src/dr/app/beauti/clockmodelspanel/PartitionClockModelPanel.java +++ b/src/dr/app/beauti/clockmodelspanel/PartitionClockModelPanel.java @@ -36,9 +36,12 @@ import jam.panels.OptionsPanel; import javax.swing.*; +import javax.swing.border.MatteBorder; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.EnumSet; +import java.util.Vector; /** * @author Andrew Rambaut @@ -48,7 +51,8 @@ public class PartitionClockModelPanel extends OptionsPanel { // Components private static final long serialVersionUID = -1645661616353099424L; - private JComboBox clockTypeCombo = new JComboBox(); + private JComboBox clockTypeCombo = new JComboBox<>(); + private JComboBox clockDistributionCombo = new JComboBox (new ClockDistributionType[] { ClockDistributionType.LOGNORMAL, ClockDistributionType.GAMMA, @@ -76,12 +80,15 @@ public PartitionClockModelPanel(final PartitionClockModel partitionModel) { for (ClockType clockType : EnumSet.range(ClockType.STRICT_CLOCK, ClockType.MIXED_EFFECTS_CLOCK)) { clockTypeCombo.addItem(clockType); - if (clockType == ClockType.STRICT_CLOCK || clockType == ClockType.HMC_CLOCK) { + /*if (clockType == ClockType.STRICT_CLOCK || clockType == ClockType.HMC_CLOCK) { clockTypeCombo.addItem(new JSeparator(JSeparator.HORIZONTAL)); - } + }*/ } - PanelUtils.setupComponent(clockTypeCombo); + //PanelUtils.setupComponent(clockTypeCombo); + clockTypeCombo.putClientProperty("JButton.buttonType", "textured"); + clockTypeCombo.setRenderer(new ClockComboBoxRenderer()); + clockTypeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setClockType((ClockType) clockTypeCombo.getSelectedItem()); @@ -131,7 +138,6 @@ public void itemStateChanged(ItemEvent ev) { } - /** * Lays out the appropriate components in the panel for this partition model. */ @@ -194,4 +200,25 @@ public void setOptions() { } + /** + * + */ + static class ClockComboBoxRenderer extends JLabel implements ListCellRenderer { + + public Component getListCellRendererComponent(JList list, + Object value, int index, boolean isSelected, boolean cellHasFocus) { + + if (value == ClockType.UNCORRELATED || value == ClockType.HMC_CLOCK){ + setBackground(new Color(0, 100, 255, 30)); + setOpaque(true); + } else { + setOpaque(false); + } + + setText(" " + value.toString() + " "); + + return this; + } + } + } diff --git a/src/dr/app/beauti/components/marginalLikelihoodEstimation/MarginalLikelihoodEstimationGenerator.java b/src/dr/app/beauti/components/marginalLikelihoodEstimation/MarginalLikelihoodEstimationGenerator.java index 3377725269..8838f9cc06 100644 --- a/src/dr/app/beauti/components/marginalLikelihoodEstimation/MarginalLikelihoodEstimationGenerator.java +++ b/src/dr/app/beauti/components/marginalLikelihoodEstimation/MarginalLikelihoodEstimationGenerator.java @@ -1191,20 +1191,20 @@ public void writeMLE(XMLWriter writer, MarginalLikelihoodEstimationOptions optio writer.writeOpenTag(WorkingPriorParsers.NORMAL_REFERENCE_PRIOR, new Attribute[]{ new Attribute.Default("fileName", beautiOptions.logFileName), - new Attribute.Default("parameterColumn", "skygrid.logPopSize"), + new Attribute.Default("parameterColumn", GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE), new Attribute.Default("dimension", model.getSkyGridCount()), new Attribute.Default("burnin", "" + (int) (beautiOptions.chainLength * 0.10)) }); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.logPopSize"); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE); writer.writeCloseTag(WorkingPriorParsers.NORMAL_REFERENCE_PRIOR); writer.writeOpenTag(WorkingPriorParsers.LOG_TRANSFORMED_NORMAL_REFERENCE_PRIOR, new Attribute[]{ new Attribute.Default("fileName", beautiOptions.logFileName), - new Attribute.Default("parameterColumn", "skygrid.precision"), + new Attribute.Default("parameterColumn", GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION), new Attribute.Default("burnin", "" + (int) (beautiOptions.chainLength * 0.10)) }); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.precision"); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION); writer.writeCloseTag(WorkingPriorParsers.LOG_TRANSFORMED_NORMAL_REFERENCE_PRIOR); break; diff --git a/src/dr/app/beauti/datapanel/DataPanel.java b/src/dr/app/beauti/datapanel/DataPanel.java index ab486aae66..ccc49e1f5b 100644 --- a/src/dr/app/beauti/datapanel/DataPanel.java +++ b/src/dr/app/beauti/datapanel/DataPanel.java @@ -470,7 +470,9 @@ public boolean createPartitionFromTraits(List selectedTraits, String continue; } - selectedTraits = selectTraitDialog.getTraits(); + if (selectTraits) { + selectedTraits = selectTraitDialog.getTraits(); + } done = true; } diff --git a/src/dr/app/beauti/generator/ClockModelGenerator.java b/src/dr/app/beauti/generator/ClockModelGenerator.java index 00521886e2..093411b4e5 100644 --- a/src/dr/app/beauti/generator/ClockModelGenerator.java +++ b/src/dr/app/beauti/generator/ClockModelGenerator.java @@ -30,46 +30,44 @@ import dr.app.beauti.components.ComponentFactory; import dr.app.beauti.options.*; import dr.app.beauti.types.ClockType; +import dr.app.beauti.types.OperatorType; import dr.app.beauti.util.XMLWriter; import dr.evolution.util.Taxa; import dr.evomodel.branchratemodel.ArbitraryBranchRates; import dr.evomodel.branchratemodel.BranchRateModel; import dr.evomodel.branchratemodel.BranchSpecificFixedEffects; import dr.evomodel.tree.DefaultTreeModel; +import dr.evomodel.treedatalikelihood.discrete.LocationGradient; +import dr.evomodel.treedatalikelihood.discrete.ScaleGradient; import dr.evomodelxml.branchmodel.BranchSpecificBranchModelParser; -import dr.evomodelxml.continuous.hmc.BranchRateGradientParser; -import dr.evomodelxml.tree.TransformedTreeTraitParser; -import dr.evomodelxml.treedatalikelihood.TreeDataLikelihoodParser; -import dr.inference.distribution.DistributionLikelihood; -import dr.inference.distribution.RandomField; -import dr.inference.hmc.GradientWrtIncrement; -import dr.inference.hmc.GradientWrtParameterProvider; -import dr.inference.model.CompoundParameter; -import dr.inference.model.Likelihood; -import dr.inference.model.StatisticParser; -import dr.inferencexml.SignTransformParser; -import dr.inferencexml.distribution.*; -import dr.inferencexml.distribution.shrinkage.BayesianBridgeDistributionModelParser; -import dr.inferencexml.hmc.GradientWrtIncrementParser; -import dr.inferencexml.operators.shrinkage.BayesianBridgeShrinkageOperatorParser; -import dr.oldevomodel.clock.RateEvolutionLikelihood; import dr.evomodelxml.branchratemodel.*; -import dr.oldevomodelxml.clock.ACLikelihoodParser; +import dr.evomodelxml.continuous.hmc.LocationScaleGradientParser; +import dr.evomodelxml.tree.CTMCScalePriorParser; import dr.evomodelxml.tree.RateCovarianceStatisticParser; import dr.evomodelxml.tree.RateStatisticParser; import dr.evomodelxml.tree.TreeModelParser; +import dr.evomodelxml.treedatalikelihood.TreeDataLikelihoodParser; import dr.evoxml.TaxaParser; +import dr.inference.distribution.DistributionLikelihood; import dr.inference.distribution.ExponentialDistributionModel; import dr.inference.distribution.GammaDistributionModel; import dr.inference.model.ParameterParser; +import dr.inference.model.StatisticParser; +import dr.inferencexml.SignTransformParser; +import dr.inferencexml.distribution.*; +import dr.inferencexml.distribution.shrinkage.BayesianBridgeDistributionModelParser; +import dr.inferencexml.hmc.CompoundGradientParser; +import dr.inferencexml.hmc.HessianWrapperParser; +import dr.inferencexml.hmc.JointGradientParser; import dr.inferencexml.model.CompoundParameterParser; import dr.inferencexml.model.SumStatisticParser; +import dr.oldevomodel.clock.RateEvolutionLikelihood; +import dr.oldevomodelxml.clock.ACLikelihoodParser; import dr.util.Attribute; import dr.xml.XMLParser; import java.util.Map; -import static dr.inference.model.ParameterParser.DIMENSION; import static dr.inference.model.ParameterParser.PARAMETER; import static dr.inferencexml.distribution.PriorParsers.*; import static dr.inferencexml.distribution.shrinkage.BayesianBridgeLikelihoodParser.*; @@ -134,26 +132,26 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ // tree writer.writeIDref(DefaultTreeModel.TREE_MODEL, treePrefix + DefaultTreeModel.TREE_MODEL); - writer.writeOpenTag("distribution"); + writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); writer.writeOpenTag(LogNormalDistributionModelParser.LOGNORMAL_DISTRIBUTION_MODEL, new Attribute.Default(LogNormalDistributionModelParser.MEAN_IN_REAL_SPACE, "true")); writeParameter("mean", ClockType.UCLD_MEAN, clockModel, writer); writeParameter("stdev", ClockType.UCLD_STDEV, clockModel, writer); writer.writeCloseTag(LogNormalDistributionModelParser.LOGNORMAL_DISTRIBUTION_MODEL); - writer.writeCloseTag("distribution"); + writer.writeCloseTag(DistributionLikelihoodParser.DISTRIBUTION); - writer.writeOpenTag("distribution"); + writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); writer.writeOpenTag(GammaDistributionModel.GAMMA_DISTRIBUTION_MODEL); writeParameter("mean", ClockType.UCGD_MEAN, clockModel, writer); writeParameter("shape", ClockType.UCGD_SHAPE, clockModel, writer); writer.writeCloseTag(GammaDistributionModel.GAMMA_DISTRIBUTION_MODEL); - writer.writeCloseTag("distribution"); + writer.writeCloseTag(DistributionLikelihoodParser.DISTRIBUTION); - writer.writeOpenTag("distribution"); + writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); writer.writeOpenTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL); writeParameter("mean", ClockType.UCED_MEAN, clockModel, writer); writer.writeCloseTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL); - writer.writeCloseTag("distribution"); + writer.writeCloseTag(DistributionLikelihoodParser.DISTRIBUTION); writer.writeOpenTag(MixtureModelBranchRatesParser.DISTRIBUTION_INDEX); writeParameter(clockModel.getParameter("branchRates.distributionIndex"), -1, writer); @@ -187,7 +185,7 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ // tree writer.writeIDref(DefaultTreeModel.TREE_MODEL, treePrefix + DefaultTreeModel.TREE_MODEL); - writer.writeOpenTag("distribution"); + writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); switch (clockModel.getClockDistributionType()) { @@ -220,7 +218,7 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ break; } - writer.writeCloseTag("distribution"); + writer.writeCloseTag(DistributionLikelihoodParser.DISTRIBUTION); if (clockModel.isContinuousQuantile()) { writer.writeOpenTag(ContinuousBranchRatesParser.RATE_QUANTILES); @@ -250,7 +248,7 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ attributes = new Attribute[] { new Attribute.Default<>(XMLParser.ID, prefix + BranchRateModel.BRANCH_RATES), - new Attribute.Default<>("centerAtOne", false) + new Attribute.Default<>(ArbitraryBranchRatesParser.CENTER_AT_ONE, false) }; writer.writeOpenTag(tag, attributes); // tree @@ -267,11 +265,12 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ writer.writeCloseTag(ArbitraryBranchRatesParser.SCALE); writer.writeCloseTag(tag); + //rates prior writer.writeOpenTag(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, new Attribute.Default<>(XMLParser.ID, - prefix + "ratesPrior")); + prefix + BranchSpecificFixedEffects.RATES_PRIOR)); - writeParameterRef(MixedDistributionLikelihoodParser.DATA, prefix + "branchRates.rates", writer); + writeParameterRef(MixedDistributionLikelihoodParser.DATA, prefix + ClockType.HMC_CLOCK_BRANCH_RATES, writer); writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); @@ -284,7 +283,7 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ writeParameter(null, 1, 1.0, 0.0, Double.NaN, writer); writer.writeCloseTag("mean"); writer.writeOpenTag("stdev"); - writeParameter(null, 1, 1.0, 0.0, Double.NaN, writer); + writeParameter(null, 1, 0.1, 0.0, Double.NaN, writer); writer.writeCloseTag("stdev"); writer.writeCloseTag(LogNormalDistributionModelParser.LOGNORMAL_DISTRIBUTION_MODEL); @@ -302,6 +301,91 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ writeCovarianceStatistic(writer, tag, prefix, treePrefix); + //TODO add more String constants for this type of code + boolean generateScaleGradient = false; + + for (Operator operator : options.selectOperators()) { + if (operator.getName().equals("HMC relaxed clock location and scale") && operator.isUsed()) { + generateScaleGradient = true; + } + } + + if (generateScaleGradient) { + + //scale prior + writer.writeOpenTag(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, + new Attribute.Default<>(XMLParser.ID, + prefix + BranchSpecificFixedEffects.SCALE_PRIOR)); + writeParameterRef(MixedDistributionLikelihoodParser.DATA, prefix + ClockType.HMCLN_SCALE, writer); + writer.writeOpenTag(DistributionLikelihoodParser.DISTRIBUTION); + writer.writeOpenTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL); + writer.writeOpenTag(ExponentialDistributionModelParser.MEAN); + writeParameter(null, 1, 1.0, 0.0, Double.NaN, writer); + writer.writeCloseTag(ExponentialDistributionModelParser.MEAN); + writer.writeCloseTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL); + writer.writeCloseTag(DistributionLikelihoodParser.DISTRIBUTION); + writer.writeCloseTag(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD); + + //compound parameter + writer.writeOpenTag(CompoundParameterParser.COMPOUND_PARAMETER, new Attribute.Default<>(XMLParser.ID, prefix + LocationScaleGradientParser.LOCATION_SCALE)); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_LOCATION); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMCLN_SCALE); + writer.writeCloseTag(CompoundParameterParser.COMPOUND_PARAMETER); + + //CTMC scale prior + writer.writeOpenTag(CTMCScalePriorParser.MODEL_NAME, new Attribute.Default<>(XMLParser.ID, prefix + BranchSpecificFixedEffects.LOCATION_PRIOR)); + writer.writeOpenTag(CTMCScalePriorParser.SCALEPARAMETER); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_LOCATION); + writer.writeCloseTag(CTMCScalePriorParser.SCALEPARAMETER); + writer.writeIDref(DefaultTreeModel.TREE_MODEL, treePrefix + DefaultTreeModel.TREE_MODEL); + writer.writeCloseTag(CTMCScalePriorParser.MODEL_NAME); + + //location gradient + writer.writeOpenTag(LocationScaleGradientParser.NAME, new Attribute[]{ + new Attribute.Default<>(XMLParser.ID, prefix + LocationGradient.LOCATION_GRADIENT), + new Attribute.Default<>("traitName", "Sequence"), + new Attribute.Default<>(LocationScaleGradientParser.USE_HESSIAN, "false") + }); + writer.writeIDref(TreeDataLikelihoodParser.TREE_DATA_LIKELIHOOD, treePrefix + "treeLikelihood"); + writer.writeOpenTag(LocationScaleGradientParser.LOCATION); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_LOCATION); + writer.writeCloseTag(LocationScaleGradientParser.LOCATION); + writer.writeCloseTag(LocationScaleGradientParser.NAME); + + //scale gradient + writer.writeOpenTag(LocationScaleGradientParser.NAME, new Attribute[]{ + new Attribute.Default<>(XMLParser.ID, prefix + ScaleGradient.SCALE_GRADIENT), + new Attribute.Default<>("traitName", "Sequence"), + new Attribute.Default<>(LocationScaleGradientParser.USE_HESSIAN, "false") + }); + writer.writeIDref(TreeDataLikelihoodParser.TREE_DATA_LIKELIHOOD, treePrefix + "treeLikelihood"); + writer.writeOpenTag(LocationScaleGradientParser.SCALE); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMCLN_SCALE); + writer.writeCloseTag(LocationScaleGradientParser.SCALE); + writer.writeCloseTag(LocationScaleGradientParser.NAME); + + //location scale (compound) gradient + writer.writeOpenTag(CompoundGradientParser.COMPOUND_GRADIENT, new Attribute.Default<>(XMLParser.ID, prefix + LocationScaleGradientParser.NAME)); + writer.writeIDref(LocationScaleGradientParser.NAME, prefix + LocationGradient.LOCATION_GRADIENT); + writer.writeIDref(LocationScaleGradientParser.NAME, prefix + ScaleGradient.SCALE_GRADIENT); + writer.writeCloseTag(CompoundGradientParser.COMPOUND_GRADIENT); + + //location scale (compound) prior gradient + writer.writeOpenTag(CompoundGradientParser.COMPOUND_GRADIENT, new Attribute.Default<>(XMLParser.ID, prefix + LocationScaleGradientParser.LOCATION_SCALE_PRIOR_GRADIENT)); + writer.writeIDref(CTMCScalePriorParser.MODEL_NAME, prefix + BranchSpecificFixedEffects.LOCATION_PRIOR); + writer.writeOpenTag(HessianWrapperParser.NAME); + writer.writeIDref(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, BranchSpecificFixedEffects.SCALE_PRIOR); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMCLN_SCALE); + writer.writeCloseTag(HessianWrapperParser.NAME); + writer.writeCloseTag(CompoundGradientParser.COMPOUND_GRADIENT); + + //location scale joint gradient + writer.writeOpenTag(JointGradientParser.JOINT_GRADIENT, new Attribute.Default<>(XMLParser.ID, prefix + LocationScaleGradientParser.LOCATION_SCALE_JOINT_GRADIENT)); + writer.writeIDref(CompoundGradientParser.COMPOUND_GRADIENT, prefix + LocationScaleGradientParser.LOCATION_SCALE_PRIOR_GRADIENT); + writer.writeIDref(CompoundGradientParser.COMPOUND_GRADIENT, prefix + LocationScaleGradientParser.NAME); + writer.writeCloseTag(JointGradientParser.JOINT_GRADIENT); + + } break; @@ -312,10 +396,10 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ attributes = new Attribute[] { new Attribute.Default<>(XMLParser.ID, - prefix + "substBranchRates"), - new Attribute.Default<>("centerAtOne", false), - new Attribute.Default<>("randomizeRates", true), - new Attribute.Default<>("randomScale", "0.1") + prefix + "substBranchRates"), + new Attribute.Default<>(ArbitraryBranchRatesParser.CENTER_AT_ONE, false), + new Attribute.Default<>(ArbitraryBranchRatesParser.RANDOMIZE_RATES, true), + new Attribute.Default<>(ArbitraryBranchRatesParser.RANDOM_SCALE, "0.1") }; writer.writeOpenTag(tag, attributes); // tree @@ -370,8 +454,8 @@ public void writeBranchRatesModel(PartitionClockModel clockModel, XMLWriter writ writer.writeOpenTag(ScaledByTreeTimeBranchRateModelParser.TREE_TIME_BRANCH_RATES, new Attribute.Default<>(XMLParser.ID, prefix + BranchRateModel.BRANCH_RATES)); writer.writeIDref(ArbitraryBranchRatesParser.ARBITRARY_BRANCH_RATES, prefix + "substBranchRates"); - writer.writeIDref(DefaultTreeModel.TREE_MODEL, prefix + "treeModel"); - writeParameter(clockModel.getParameter("branchRates.rate"), -1, writer); + writer.writeIDref(DefaultTreeModel.TREE_MODEL, prefix + DefaultTreeModel.TREE_MODEL); + writeParameter(clockModel.getParameter(ClockType.SHRINKAGE_CLOCK_LOCATION), -1, writer); writer.writeCloseTag(ScaledByTreeTimeBranchRateModelParser.TREE_TIME_BRANCH_RATES); // writeMeanRateStatistic(writer, tag, prefix, treePrefix); @@ -926,12 +1010,10 @@ public void writeAllMus(PartitionClockModel model, XMLWriter writer) { } } - public void writeAllClockRateRefs(PartitionClockModel model, XMLWriter writer) { writer.writeIDref(PARAMETER, getClockRateString(model)); } - public String getClockRateString(PartitionClockModel model) { String prefix = model.getPrefix(); @@ -1069,7 +1151,7 @@ public void writeLog(PartitionClockModel model, XMLWriter writer) { break; case AUTOCORRELATED: -// TODO + // TODO break; default: diff --git a/src/dr/app/beauti/generator/OperatorsGenerator.java b/src/dr/app/beauti/generator/OperatorsGenerator.java index 79596825ab..4234751be5 100644 --- a/src/dr/app/beauti/generator/OperatorsGenerator.java +++ b/src/dr/app/beauti/generator/OperatorsGenerator.java @@ -29,15 +29,15 @@ import dr.app.beauti.components.ComponentFactory; import dr.app.beauti.options.*; +import dr.app.beauti.types.ClockType; import dr.app.beauti.types.TreePriorType; import dr.app.beauti.util.XMLWriter; import dr.evolution.datatype.DataType; +import dr.evomodel.branchratemodel.BranchSpecificFixedEffects; import dr.evomodel.operators.BitFlipInSubstitutionModelOperator; import dr.evomodel.operators.EmpiricalTreeDistributionOperator; import dr.evomodel.tree.DefaultTreeModel; import dr.evomodel.tree.EmpiricalTreeDistributionModel; -import dr.evomodel.treedatalikelihood.TreeDataLikelihood; -import dr.evomodel.treedatalikelihood.continuous.BranchRateGradient; import dr.evomodelxml.branchratemodel.AutoCorrelatedBranchRatesDistributionParser; import dr.evomodelxml.branchratemodel.AutoCorrelatedGradientWrtIncrementsParser; import dr.evomodelxml.branchratemodel.BranchRateGradientWrtIncrementsParser; @@ -45,19 +45,15 @@ import dr.evomodelxml.coalescent.operators.GMRFSkyrideBlockUpdateOperatorParser; import dr.evomodelxml.coalescent.operators.SampleNonActiveGibbsOperatorParser; import dr.evomodelxml.continuous.hmc.BranchRateGradientParser; +import dr.evomodelxml.continuous.hmc.LocationScaleGradientParser; import dr.evomodelxml.operators.*; import dr.evomodelxml.treedatalikelihood.TreeDataLikelihoodParser; import dr.inference.distribution.DistributionLikelihood; -import dr.inference.hmc.GradientWrtIncrement; -import dr.inference.model.CompoundParameter; -import dr.inference.model.HessianProvider; import dr.inference.model.ParameterParser; import dr.inference.operators.*; import dr.inferencexml.SignTransformParser; -import dr.inferencexml.distribution.DistributionLikelihoodParser; import dr.inferencexml.distribution.shrinkage.BayesianBridgeDistributionModelParser; import dr.inferencexml.hmc.CompoundGradientParser; -import dr.inferencexml.hmc.GradientWrtIncrementParser; import dr.inferencexml.hmc.HessianWrapperParser; import dr.inferencexml.hmc.JointGradientParser; import dr.inferencexml.model.CompoundParameterParser; @@ -247,8 +243,11 @@ private void writeOperator(Operator operator, XMLWriter writer) { case ADAPTIVE_MULTIVARIATE: writeAdaptiveMultivariateOperator(operator, writer); break; - case RELAXED_CLOCK_HMC_OPERATOR: - writeRelaxedClockHMCOperator(operator, prefix,writer); + case RELAXED_CLOCK_HMC_RATE_OPERATOR: + writeRelaxedClockHMCRateOperator(operator, prefix,writer); + break; + case RELAXED_CLOCK_HMC_SCALE_OPERATOR: + writeRelaxedClockHMCScaleOperator(operator, prefix,writer); break; case SHRINKAGE_CLOCK_HMC_OPERATOR: writeShrinkageClockHMCOperator(operator, prefix, writer); @@ -476,7 +475,6 @@ private void writeIntegerUniformOperator(Operator operator, XMLWriter writer) { writer.writeOpenTag(UniformIntegerOperatorParser.UNIFORM_INTEGER_OPERATOR, getWeightAttribute(operator.getWeight())); writeParameter1Ref(writer, operator); -// writeOperatorRef(writer, operator); writer.writeCloseTag(UniformIntegerOperatorParser.UNIFORM_INTEGER_OPERATOR); } @@ -569,7 +567,7 @@ private void writeSkyGridHMCOperator(Operator operator, String treePriorPrefix, writer.writeCloseTag(HamiltonianMonteCarloOperatorParser.HMC_OPERATOR); } - private void writeRelaxedClockHMCOperator(Operator operator, String prefix, XMLWriter writer) { + private void writeRelaxedClockHMCRateOperator(Operator operator, String prefix, XMLWriter writer) { int nSteps = 4; double stepSize = 1E-2; String preconditioning = "diagonal"; @@ -582,6 +580,7 @@ private void writeRelaxedClockHMCOperator(Operator operator, String prefix, XMLW getWeightAttribute(operator.getWeight()), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.N_STEPS, nSteps), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.STEP_SIZE, stepSize), + new Attribute.Default<>("autoOptimize", true), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.MODE, "vanilla"), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.GRADIENT_CHECK_COUNT, gradientCheckCount), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING, preconditioning), @@ -590,8 +589,8 @@ private void writeRelaxedClockHMCOperator(Operator operator, String prefix, XMLW ); writer.writeOpenTag(JointGradientParser.JOINT_GRADIENT); writer.writeOpenTag(HessianWrapperParser.NAME); - writer.writeIDref(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, prefix + "ratesPrior"); - writer.writeIDref(ParameterParser.PARAMETER, prefix + "branchRates.rates"); + writer.writeIDref(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, prefix + BranchSpecificFixedEffects.RATES_PRIOR); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_BRANCH_RATES); writer.writeCloseTag(HessianWrapperParser.NAME); writer.writeOpenTag(BranchRateGradientParser.NAME, new Attribute.Default<>("traitName", "Sequence")); @@ -600,10 +599,40 @@ private void writeRelaxedClockHMCOperator(Operator operator, String prefix, XMLW writer.writeCloseTag(JointGradientParser.JOINT_GRADIENT); - writer.writeIDref(ParameterParser.PARAMETER, prefix + "branchRates.rates"); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_BRANCH_RATES); writer.writeOpenTag(SignTransformParser.NAME); - writer.writeIDref(ParameterParser.PARAMETER, prefix + "branchRates.rates"); + writer.writeIDref(ParameterParser.PARAMETER, prefix + ClockType.HMC_CLOCK_BRANCH_RATES); + writer.writeCloseTag(SignTransformParser.NAME); + writer.writeCloseTag(HamiltonianMonteCarloOperatorParser.HMC_OPERATOR); + } + + private void writeRelaxedClockHMCScaleOperator(Operator operator, String prefix, XMLWriter writer) { + int nSteps = 4; + double stepSize = 1E-2; + String preconditioning = "diagonal"; + int preconditioningUpdateFrequency = 10; + int preconditioningDelay = 0; + double drawVariance = 1.0; + + writer.writeOpenTag( + HamiltonianMonteCarloOperatorParser.HMC_OPERATOR, + new Attribute[]{ + getWeightAttribute(operator.getWeight()), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.N_STEPS, nSteps), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.STEP_SIZE, stepSize), + new Attribute.Default<>("autoOptimize", true), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.MODE, "vanilla"), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.DRAW_VARIANCE, drawVariance), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING, preconditioning), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING_DELAY, preconditioningDelay), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING_UPDATE_FREQUENCY, preconditioningUpdateFrequency) + } + ); + writer.writeIDref(JointGradientParser.JOINT_GRADIENT, prefix + LocationScaleGradientParser.LOCATION_SCALE_JOINT_GRADIENT); + writer.writeIDref(ParameterParser.PARAMETER, prefix + LocationScaleGradientParser.LOCATION_SCALE); + writer.writeOpenTag(SignTransformParser.NAME); + writer.writeIDref(ParameterParser.PARAMETER, prefix + LocationScaleGradientParser.LOCATION_SCALE); writer.writeCloseTag(SignTransformParser.NAME); writer.writeCloseTag(HamiltonianMonteCarloOperatorParser.HMC_OPERATOR); } @@ -620,8 +649,9 @@ private void writeShrinkageClockGibbsOperator(Operator operator, String prefix, private void writeShrinkageClockHMCOperator(Operator operator, String prefix, XMLWriter writer) { int nSteps = 5; double stepSize = 1E-2; - int gradientCheckCount = 0; int preconditioningUpdateFrequency = 1; + double drawVariance = 1.0; + int preconditioningDelay = 0; writer.writeOpenTag( HamiltonianMonteCarloOperatorParser.HMC_OPERATOR, @@ -630,9 +660,9 @@ private void writeShrinkageClockHMCOperator(Operator operator, String prefix, XM new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.N_STEPS, nSteps), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.STEP_SIZE, stepSize), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.MODE, "vanilla"), - new Attribute.Default<>("drawVariance", "1.0"), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.DRAW_VARIANCE, drawVariance), new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING_UPDATE_FREQUENCY, preconditioningUpdateFrequency), - new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.GRADIENT_CHECK_COUNT, gradientCheckCount), + new Attribute.Default<>(HamiltonianMonteCarloOperatorParser.PRECONDITIONING_DELAY, preconditioningDelay) } ); writer.writeOpenTag(JointGradientParser.JOINT_GRADIENT); diff --git a/src/dr/app/beauti/generator/ParameterPriorGenerator.java b/src/dr/app/beauti/generator/ParameterPriorGenerator.java index 92c377e7d7..339932202e 100644 --- a/src/dr/app/beauti/generator/ParameterPriorGenerator.java +++ b/src/dr/app/beauti/generator/ParameterPriorGenerator.java @@ -33,11 +33,16 @@ import dr.app.beauti.types.PriorType; import dr.app.beauti.util.XMLWriter; import dr.evolution.util.Taxa; +import dr.evomodel.branchratemodel.BranchSpecificFixedEffects; import dr.evomodel.tree.DefaultTreeModel; +import dr.evomodelxml.coalescent.GMRFSkyrideLikelihoodParser; import dr.evomodelxml.tree.CTMCScalePriorParser; import dr.evomodelxml.tree.MonophylyStatisticParser; +import dr.inference.distribution.DistributionLikelihood; import dr.inference.model.ParameterParser; -import dr.inferencexml.distribution.*; +import dr.inferencexml.distribution.CachedDistributionLikelihoodParser; +import dr.inferencexml.distribution.DistributionLikelihoodParser; +import dr.inferencexml.distribution.PriorParsers; import dr.inferencexml.model.BooleanLikelihoodParser; import dr.inferencexml.model.OneOnXPriorParser; import dr.util.Attribute; @@ -60,7 +65,12 @@ public ParameterPriorGenerator(BeautiOptions options, ComponentFactory[] compone super(options, components); //TODO don't like this being here, but will see how things pan out as more HMC approaches are added mapParameterToPrior = new HashMap(); - mapParameterToPrior.put("skygrid.precision", "skygrid.precision.prior"); + //HMC skygrid + mapParameterToPrior.put(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION_PRIOR); + //HMC relaxed clock + mapParameterToPrior.put(ClockType.HMC_CLOCK_LOCATION, BranchSpecificFixedEffects.LOCATION_PRIOR); + mapParameterToPrior.put(ClockType.HMC_CLOCK_BRANCH_RATES, BranchSpecificFixedEffects.RATES_PRIOR); + mapParameterToPrior.put(ClockType.HMCLN_SCALE, BranchSpecificFixedEffects.SCALE_PRIOR); } /** @@ -382,8 +392,16 @@ private void writePriorIdref(XMLWriter writer, Parameter parameter, String prior case INVERSE_GAMMA_PRIOR: writer.writeIDref(PriorParsers.INVGAMMA_PRIOR_CORRECT, priorID); break; + case CTMC_RATE_REFERENCE_PRIOR: + writer.writeIDref(CTMCScalePriorParser.MODEL_NAME, priorID); + break; + case LOGNORMAL_HPM_PRIOR: + case EXPONENTIAL_HPM_PRIOR: + case NORMAL_HPM_PRIOR: + writer.writeIDref(DistributionLikelihood.DISTRIBUTION_LIKELIHOOD, priorID); + break; default: - throw new IllegalArgumentException("Unknown or invalid prior defined on " + parameter.getName()); + throw new IllegalArgumentException("Unknown or invalid prior defined on " + parameter.getName() + ": " + parameter.priorType); } } diff --git a/src/dr/app/beauti/generator/TreePriorGenerator.java b/src/dr/app/beauti/generator/TreePriorGenerator.java index c39b0b4dd2..7706e107c1 100644 --- a/src/dr/app/beauti/generator/TreePriorGenerator.java +++ b/src/dr/app/beauti/generator/TreePriorGenerator.java @@ -28,37 +28,36 @@ package dr.app.beauti.generator; import dr.app.beauti.components.ComponentFactory; -import dr.app.beauti.options.*; -import dr.app.beauti.types.OperatorSetType; +import dr.app.beauti.options.BeautiOptions; +import dr.app.beauti.options.Parameter; +import dr.app.beauti.options.PartitionTreeModel; +import dr.app.beauti.options.PartitionTreePrior; import dr.app.beauti.types.StartingTreeType; import dr.app.beauti.types.TreePriorParameterizationType; import dr.app.beauti.types.TreePriorType; import dr.app.beauti.util.XMLWriter; import dr.evolution.util.Taxa; import dr.evolution.util.Units; -import dr.evomodel.coalescent.GMRFSkyrideGradient; import dr.evomodel.tree.DefaultTreeModel; -import dr.evomodel.tree.TreeModel; -import dr.evomodelxml.CSVExporterParser; -import dr.evomodelxml.coalescent.*; +import dr.evomodelxml.coalescent.CoalescentLikelihoodParser; +import dr.evomodelxml.coalescent.GMRFSkyrideGradientParser; +import dr.evomodelxml.coalescent.GMRFSkyrideLikelihoodParser; import dr.evomodelxml.coalescent.demographicmodel.ConstantPopulationModelParser; import dr.evomodelxml.coalescent.demographicmodel.ExpansionModelParser; import dr.evomodelxml.coalescent.demographicmodel.ExponentialGrowthModelParser; import dr.evomodelxml.coalescent.demographicmodel.LogisticGrowthModelParser; -import dr.evomodelxml.speciation.*; +import dr.evomodelxml.speciation.BirthDeathModelParser; +import dr.evomodelxml.speciation.BirthDeathSerialSamplingModelParser; +import dr.evomodelxml.speciation.SpeciationLikelihoodParser; +import dr.evomodelxml.speciation.YuleModelParser; import dr.evoxml.TaxaParser; -import dr.inference.distribution.ExponentialDistributionModel; -import dr.inference.distribution.ExponentialMarkovModel; -import dr.inference.distribution.GammaDistributionModel; -import dr.inference.model.CompoundParameter; import dr.inference.model.ParameterParser; -import dr.inferencexml.distribution.*; +import dr.inferencexml.distribution.GammaDistributionModelParser; +import dr.inferencexml.distribution.PriorParsers; import dr.inferencexml.hmc.CompoundGradientParser; import dr.inferencexml.hmc.GradientWrapperParser; import dr.inferencexml.hmc.JointGradientParser; import dr.inferencexml.model.CompoundParameterParser; -import dr.inferencexml.model.SumStatisticParser; -import dr.math.distributions.GammaDistribution; import dr.util.Attribute; import dr.xml.XMLParser; @@ -674,11 +673,11 @@ void writeMultiLociTreePriors(PartitionTreePrior prior, XMLWriter writer) { writer.writeOpenTag(GMRFSkyrideLikelihoodParser.POPULATION_PARAMETER); writer.writeComment("skygrid.logPopSize is in log units unlike other popSize"); - writeParameter(prior.getParameter("skygrid.logPopSize"), skyGridIntervalCount, writer); + writeParameter(prior.getParameter(GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE), skyGridIntervalCount, writer); writer.writeCloseTag(GMRFSkyrideLikelihoodParser.POPULATION_PARAMETER); writer.writeOpenTag(GMRFSkyrideLikelihoodParser.PRECISION_PARAMETER); - writeParameter(prior.getParameter("skygrid.precision"), 1, writer); + writeParameter(prior.getParameter(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION), 1, writer); writer.writeCloseTag(GMRFSkyrideLikelihoodParser.PRECISION_PARAMETER); writer.writeOpenTag(GMRFSkyrideLikelihoodParser.NUM_GRID_POINTS); @@ -709,16 +708,16 @@ void writeMultiLociTreePriors(PartitionTreePrior prior, XMLWriter writer) { //writing the gamma prior here so will need to prevent another one from being written in the priors block //key use: using HMC on the skygrid parameters - Parameter parameter = prior.getParameter("skygrid.precision"); + Parameter parameter = prior.getParameter(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION); writer.writeOpenTag(PriorParsers.GAMMA_PRIOR, new Attribute[]{ - new Attribute.Default<>(XMLParser.ID, "skygrid.precision.prior"), + new Attribute.Default<>(XMLParser.ID, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION_PRIOR), new Attribute.Default<>(GammaDistributionModelParser.SHAPE, parameter.shape), new Attribute.Default<>(GammaDistributionModelParser.SCALE, parameter.scale), new Attribute.Default<>(GammaDistributionModelParser.OFFSET, parameter.offset) } ); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.precision"); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION); writer.writeCloseTag(PriorParsers.GAMMA_PRIOR); //add gradient information to XML file in case of an HMC transition kernel mix @@ -738,8 +737,8 @@ void writeMultiLociTreePriors(PartitionTreePrior prior, XMLWriter writer) { new Attribute.Default(XMLParser.ID, "skygrid.parameters") } ); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.precision"); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.logPopSize"); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE); writer.writeCloseTag(CompoundParameterParser.COMPOUND_PARAMETER); writer.writeOpenTag(GMRFSkyrideGradientParser.NAME, @@ -758,8 +757,8 @@ void writeMultiLociTreePriors(PartitionTreePrior prior, XMLWriter writer) { ); writer.writeIDref(GMRFSkyrideGradientParser.NAME, "gmrfGradientPrec"); writer.writeOpenTag(GradientWrapperParser.NAME); - writer.writeIDref(PriorParsers.GAMMA_PRIOR, "skygrid.precision.prior"); - writer.writeIDref(ParameterParser.PARAMETER, "skygrid.precision"); + writer.writeIDref(PriorParsers.GAMMA_PRIOR, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION_PRIOR); + writer.writeIDref(ParameterParser.PARAMETER, GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION); writer.writeCloseTag(GradientWrapperParser.NAME); writer.writeCloseTag(JointGradientParser.JOINT_GRADIENT); @@ -817,8 +816,8 @@ void writeParameterLog(PartitionTreePrior prior, XMLWriter writer) { // break; case SKYGRID: case SKYGRID_HMC: - writeParameterRef(priorPrefix + "skygrid.precision", writer); - writeParameterRef(priorPrefix + "skygrid.logPopSize", writer); + writeParameterRef(priorPrefix + GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, writer); + writeParameterRef(priorPrefix + GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE, writer); writeParameterRef(priorPrefix + "skygrid.cutOff", writer); // writeParameterRef(priorPrefix + "skygrid.groupSize", writer); break; diff --git a/src/dr/app/beauti/operatorspanel/OperatorsPanel.java b/src/dr/app/beauti/operatorspanel/OperatorsPanel.java index a431069a9f..990962e34f 100644 --- a/src/dr/app/beauti/operatorspanel/OperatorsPanel.java +++ b/src/dr/app/beauti/operatorspanel/OperatorsPanel.java @@ -35,7 +35,6 @@ import dr.app.beauti.util.PanelUtils; import dr.app.gui.table.RealNumberCellEditor; import jam.framework.Exportable; -import jam.table.HeaderRenderer; import jam.table.TableRenderer; import javax.swing.*; @@ -43,7 +42,7 @@ import javax.swing.table.AbstractTableModel; import java.awt.*; import java.awt.event.ActionEvent; -import java.util.*; +import java.util.ArrayList; import java.util.List; /** @@ -152,7 +151,6 @@ public void actionPerformed(ActionEvent e) { add(toolBar1, BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); - operatorSetCombo.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent ev) { @@ -260,7 +258,7 @@ public boolean isCellEditable(int row, int col) { switch (col) { case 0:// Check box - // if the paramter is fixed then 'in use' can't be turned on + // if the parameter is fixed then 'in use' can't be turned on editable = !op.isParameterFixed(); break; case 3: diff --git a/src/dr/app/beauti/options/PartitionClockModel.java b/src/dr/app/beauti/options/PartitionClockModel.java index 8c1336874e..dd2d6452f0 100644 --- a/src/dr/app/beauti/options/PartitionClockModel.java +++ b/src/dr/app/beauti/options/PartitionClockModel.java @@ -120,27 +120,26 @@ public void initModelParametersAndOpererators() { .initial(1.0 / 3.0).mean(1.0 / 3.0).offset(0.0).partitionOptions(this) .isAdaptiveMultivariateCompatible(true).build(parameters); - new Parameter.Builder(ClockType.HMC_CLOCK_LOCATION, "HMC relaxed clock rate"). - prior(PriorType.CTMC_RATE_REFERENCE_PRIOR).initial(rate) - .isCMTCRate(true).isNonNegative(true).partitionOptions(this) + new Parameter.Builder(ClockType.HMC_CLOCK_LOCATION, "HMC relaxed clock rate") + .prior(PriorType.CTMC_RATE_REFERENCE_PRIOR).initial(rate) + .isNonNegative(true).partitionOptions(this).isPriorFixed(true) .isAdaptiveMultivariateCompatible(false).build(parameters); - new Parameter.Builder(ClockType.HMCLN_SCALE, "HMC relaxed clock scale"). - prior(PriorType.EXPONENTIAL_PRIOR).isNonNegative(true) - .initial(1.0).mean(1.0).offset(0.0).partitionOptions(this) + new Parameter.Builder(ClockType.HMCLN_SCALE, "HMC relaxed clock scale") + .prior(PriorType.EXPONENTIAL_HPM_PRIOR).isNonNegative(true) + .initial(1.0).mean(1.0).offset(0.0).partitionOptions(this).isPriorFixed(true) .isAdaptiveMultivariateCompatible(false).build(parameters); - new Parameter.Builder(ClockType.HMC_CLOCK_BRANCH_RATES, "HMC relaxed clock branch rates"). - initial(1.0).isNonNegative(true).partitionOptions(this) + new Parameter.Builder(ClockType.HMC_CLOCK_BRANCH_RATES, "HMC relaxed clock branch rates") + .prior(PriorType.LOGNORMAL_HPM_PRIOR).initial(0.001).isNonNegative(true) + .partitionOptions(this).isPriorFixed(true) .isAdaptiveMultivariateCompatible(false).build(parameters); - new Parameter.Builder(ClockType.ME_CLOCK_LOCATION, "mixed effects clock rate (fixed prior)"). prior(PriorType.LOGNORMAL_HPM_PRIOR).initial(rate) .isCMTCRate(false).isNonNegative(true).partitionOptions(this).isPriorFixed(true) .isAdaptiveMultivariateCompatible(true).build(parameters); - // Shrinkage clock new Parameter.Builder(ClockType.SHRINKAGE_CLOCK_LOCATION, "Shrinkage clock rate"). prior(PriorType.CTMC_RATE_REFERENCE_PRIOR).initial(rate) @@ -216,8 +215,13 @@ public void initModelParametersAndOpererators() { createScaleOperator(ClockType.UCGD_MEAN, demoTuning, rateWeights); createScaleOperator(ClockType.UCGD_SHAPE, demoTuning, rateWeights); - createOperator("HMCLN", "HMC relaxed clock", - "Hamiltonian Monte Carlo relaxed clock operator", null, OperatorType.RELAXED_CLOCK_HMC_OPERATOR ,-1 , 1.0); + //HMC relaxed clock + createOperator("HMCRCR", "HMC relaxed clock branch rates", + "Hamiltonian Monte Carlo relaxed clock branch rates operator", null, OperatorType.RELAXED_CLOCK_HMC_RATE_OPERATOR,-1 , 1.0); + createOperator("HMCRCS", "HMC relaxed clock location and scale", + "Hamiltonian Monte Carlo relaxed clock scale operator", null, OperatorType.RELAXED_CLOCK_HMC_SCALE_OPERATOR,-1 , 0.5); + //for the time being turn off the HMC relaxed clock scale kernel + getOperator("HMCRCS").setUsed(false); createScaleOperator(ClockType.HMC_CLOCK_LOCATION, demoTuning, rateWeights); createScaleOperator(ClockType.HMCLN_SCALE, demoTuning, rateWeights); @@ -227,7 +231,6 @@ public void initModelParametersAndOpererators() { createDiscreteStatistic("rateChanges", "number of random local clocks"); // POISSON_PRIOR // A vector of relative rates across all partitions... - createNonNegativeParameterDirichletPrior("allNus", "relative rates amongst partitions parameter", this, 0, 1.0, true, true); createOperator("deltaNus", "allNus", "Change partition rates relative to each other maintaining mean", "allNus", @@ -238,7 +241,6 @@ public void initModelParametersAndOpererators() { "Change partition rates relative to each other maintaining mean", "allMus", OperatorType.WEIGHTED_DELTA_EXCHANGE, 0.01, 3.0); - createOperator("swapBranchRateCategories", "branchRates.categories", "Performs a swap of branch rate categories", "branchRates.categories", OperatorType.SWAP, 1, branchWeights / 3); createOperator("uniformBranchRateCategories", "branchRates.categories", "Performs an integer uniform draw of branch rate categories", @@ -404,6 +406,7 @@ public List selectParameters(List params) { switch (clockDistributionType) { case LOGNORMAL: params.add(getClockRateParameter()); + params.add(getParameter(ClockType.HMC_CLOCK_BRANCH_RATES)); params.add(getParameter(ClockType.HMCLN_SCALE)); break; default: @@ -654,9 +657,10 @@ public List selectOperators(List operators) { switch (clockDistributionType) { case LOGNORMAL: ops.add(rateOperator = getOperator(ClockType.HMC_CLOCK_LOCATION)); + ops.add(getOperator("HMCRCR")); + ops.add(getOperator("HMCRCS")); ops.add(getOperator(ClockType.HMCLN_SCALE)); addUpDownOperator(ops, rateOperator); - ops.add(getOperator("HMCLN")); break; default: throw new UnsupportedOperationException("Only lognormal supported for HMC relaxed clock"); diff --git a/src/dr/app/beauti/options/PartitionTreePrior.java b/src/dr/app/beauti/options/PartitionTreePrior.java index 61f5d8e6b1..3da2ee6c1e 100644 --- a/src/dr/app/beauti/options/PartitionTreePrior.java +++ b/src/dr/app/beauti/options/PartitionTreePrior.java @@ -30,6 +30,7 @@ import dr.app.beauti.types.*; import dr.evomodel.coalescent.VariableDemographicModel; import dr.evomodel.speciation.CalibrationPoints; +import dr.evomodelxml.coalescent.GMRFSkyrideLikelihoodParser; import dr.evomodelxml.speciation.BirthDeathEpidemiologyModelParser; import dr.evomodelxml.speciation.BirthDeathModelParser; import dr.evomodelxml.speciation.BirthDeathSerialSamplingModelParser; @@ -170,9 +171,9 @@ public void initModelParametersAndOpererators() { createParameterGammaPrior("skyride.precision", "GMRF Bayesian skyride precision", PriorScaleType.NONE, 1.0, 0.001, 1000, false); - createParameterUniformPrior("skygrid.logPopSize", "GMRF Bayesian SkyGrid population sizes (log unit)", + createParameterUniformPrior(GMRFSkyrideLikelihoodParser.SKYGRID_LOGPOPSIZE, "GMRF Bayesian SkyGrid population sizes (log unit)", PriorScaleType.LOG_TIME_SCALE, 1.0, -Parameter.UNIFORM_MAX_BOUND, Parameter.UNIFORM_MAX_BOUND); - createParameterGammaPrior("skygrid.precision", "GMRF Bayesian SkyGrid precision", + createParameterGammaPrior(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, "GMRF Bayesian SkyGrid precision", PriorScaleType.NONE, 0.1, 0.001, 1000, true, false); createParameterUniformPrior("skygrid.numGridPoints", "GMRF Bayesian SkyGrid number of grid points)", PriorScaleType.NONE, 1.0, -Parameter.UNIFORM_MAX_BOUND, Parameter.UNIFORM_MAX_BOUND); @@ -272,10 +273,10 @@ public void initModelParametersAndOpererators() { createOperatorUsing2Parameters("gmrfGibbsOperator", "gmrfGibbsOperator", "Gibbs sampler for GMRF Skyride", "skyride.logPopSize", "skyride.precision", OperatorType.GMRF_GIBBS_OPERATOR, -1, 2); createOperatorUsing2Parameters("gmrfSkyGridGibbsOperator", "skygrid.logPopSize", "Gibbs sampler for Bayesian SkyGrid", "skygrid.logPopSize", - "skygrid.precision", OperatorType.SKY_GRID_GIBBS_OPERATOR, -1, 2); - createScaleOperator("skygrid.precision", "skygrid precision", 0.75, 1.0); + GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, OperatorType.SKY_GRID_GIBBS_OPERATOR, -1, 2); + createScaleOperator(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, "skygrid precision", 0.75, 1.0); createOperatorUsing2Parameters("gmrfSkyGridHMCOperator", "Multiple", "HMC transition kernel for Bayesian SkyGrid", "skygrid.logPopSize", - "skygrid.precision", OperatorType.SKY_GRID_HMC_OPERATOR, -1, 2); + GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION, OperatorType.SKY_GRID_HMC_OPERATOR, -1, 2); createScaleOperator("yule.birthRate", demoTuning, demoWeights); @@ -347,7 +348,7 @@ public List selectParameters(List params) { params.add(getParameter("skyride.precision")); } else if (nodeHeightPrior == TreePriorType.SKYGRID || nodeHeightPrior == TreePriorType.SKYGRID_HMC) { // params.add(getParameter("skygrid.logPopSize")); // force user to use GMRF prior, not allowed to change - params.add(getParameter("skygrid.precision")); + params.add(getParameter(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION)); } else if (nodeHeightPrior == TreePriorType.YULE || nodeHeightPrior == TreePriorType.YULE_CALIBRATION) { params.add(getParameter("yule.birthRate")); } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH || nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING) { @@ -419,7 +420,7 @@ public List selectOperators(List ops) { ops.add(getOperator("gmrfGibbsOperator")); } else if (nodeHeightPrior == TreePriorType.SKYGRID) { ops.add(getOperator("gmrfSkyGridGibbsOperator")); - ops.add(getOperator("skygrid.precision")); + ops.add(getOperator(GMRFSkyrideLikelihoodParser.SKYGRID_PRECISION)); } else if (nodeHeightPrior == TreePriorType.SKYGRID_HMC) { ops.add(getOperator("gmrfSkyGridHMCOperator")); } else if (nodeHeightPrior == TreePriorType.YULE || nodeHeightPrior == TreePriorType.YULE_CALIBRATION) { diff --git a/src/dr/app/beauti/types/ClockType.java b/src/dr/app/beauti/types/ClockType.java index c93683f505..09029542d9 100644 --- a/src/dr/app/beauti/types/ClockType.java +++ b/src/dr/app/beauti/types/ClockType.java @@ -52,18 +52,19 @@ public String toString() { private final String displayName; + //maintain unique parameter IDs to enable correct prior and transition kernel retrieval final public static String LOCAL_CLOCK = "localClock"; final public static String UCED_MEAN = "uced.mean"; final public static String UCLD_MEAN = "ucld.mean"; final public static String UCLD_STDEV = "ucld.stdev"; final public static String UCGD_MEAN = "ucgd.mean"; final public static String UCGD_SHAPE = "ucgd.shape"; - final public static String SHRINKAGE_CLOCK_LOCATION = "branchRates.rate"; - final public static String HMC_CLOCK_LOCATION = "branchRates.rate"; - final public static String HMC_CLOCK_BRANCH_RATES = "branchRates.rates"; - final public static String HMCLN_SCALE = "branchRates.scale"; - final public static String ME_CLOCK_LOCATION = "branchRates.rate"; - final public static String ME_CLOCK_SCALE = "branchRates.scale"; + final public static String SHRINKAGE_CLOCK_LOCATION = "branchRatesShrinkage.rate"; + final public static String HMC_CLOCK_LOCATION = "branchRatesHMC.rate"; + final public static String HMC_CLOCK_BRANCH_RATES = "branchRatesHMC.rates"; + final public static String HMCLN_SCALE = "branchRatesHMC.scale"; + final public static String ME_CLOCK_LOCATION = "branchRatesME.rate"; + final public static String ME_CLOCK_SCALE = "branchRatesME.scale"; final public static String ACLD_MEAN = "acld.mean"; final public static String ACLD_STDEV = "acld.stdev"; diff --git a/src/dr/app/beauti/types/OperatorType.java b/src/dr/app/beauti/types/OperatorType.java index c5afbe514b..6f0e47e7d2 100644 --- a/src/dr/app/beauti/types/OperatorType.java +++ b/src/dr/app/beauti/types/OperatorType.java @@ -71,7 +71,8 @@ public enum OperatorType { SKY_GRID_HMC_OPERATOR("gmrfHMCOperator"), // PRECISION_GMRF_OPERATOR("precisionGMRFOperator"), WILSON_BALDING("wilsonBalding"), - RELAXED_CLOCK_HMC_OPERATOR("relaxedClockHMCOperator"), + RELAXED_CLOCK_HMC_RATE_OPERATOR("relaxedClockHMCRateOperator"), + RELAXED_CLOCK_HMC_SCALE_OPERATOR("relaxedClockHMCScaleOperator"), SHRINKAGE_CLOCK_HMC_OPERATOR("shrinkageClockHMCOperator"), SHRINKAGE_CLOCK_GIBBS_OPERATOR("relaxedClockGibbsOperator"); diff --git a/src/dr/app/checkpoint/BeastCheckpointer.java b/src/dr/app/checkpoint/BeastCheckpointer.java index c4a87b49cc..7d1150d69e 100644 --- a/src/dr/app/checkpoint/BeastCheckpointer.java +++ b/src/dr/app/checkpoint/BeastCheckpointer.java @@ -240,7 +240,7 @@ public void checkLoadState(double savedLnL, double lnL) { //currently use the general BEAST -threshold argument //TODO Evaluate whether a checkpoint-specific threshold option is required or useful - double threshold = 0.0; + double threshold = 1E-10; if (System.getProperty("mcmc.evaluation.threshold") != null) { threshold = Double.parseDouble(System.getProperty("mcmc.evaluation.threshold")); } diff --git a/src/dr/evomodel/branchratemodel/BranchSpecificFixedEffects.java b/src/dr/evomodel/branchratemodel/BranchSpecificFixedEffects.java index 64578df6f8..c0080dbb96 100644 --- a/src/dr/evomodel/branchratemodel/BranchSpecificFixedEffects.java +++ b/src/dr/evomodel/branchratemodel/BranchSpecificFixedEffects.java @@ -48,6 +48,7 @@ public interface BranchSpecificFixedEffects { String RATES_PRIOR = "ratesPrior"; String SCALE_PRIOR = "scalePrior"; String INTERCEPT_PRIOR = "interceptPrior"; + String LOCATION_PRIOR = "locationPrior"; double getEffect(final Tree tree, final NodeRef node); diff --git a/src/dr/evomodel/treedatalikelihood/discrete/LocationGradient.java b/src/dr/evomodel/treedatalikelihood/discrete/LocationGradient.java index 930085e3ec..85d7504d19 100644 --- a/src/dr/evomodel/treedatalikelihood/discrete/LocationGradient.java +++ b/src/dr/evomodel/treedatalikelihood/discrete/LocationGradient.java @@ -39,6 +39,9 @@ */ public class LocationGradient extends HyperParameterBranchRateGradient { + //declaring String constants for use in BEAUti + public static final String LOCATION_GRADIENT = "locationGradient"; + private final BranchSpecificFixedEffects fixedEffects; public LocationGradient(String traitName, TreeDataLikelihood treeDataLikelihood, diff --git a/src/dr/evomodel/treedatalikelihood/discrete/ScaleGradient.java b/src/dr/evomodel/treedatalikelihood/discrete/ScaleGradient.java index 76286168e7..7b4cc034c5 100644 --- a/src/dr/evomodel/treedatalikelihood/discrete/ScaleGradient.java +++ b/src/dr/evomodel/treedatalikelihood/discrete/ScaleGradient.java @@ -38,6 +38,9 @@ */ public class ScaleGradient extends HyperParameterBranchRateGradient { + //declaring String constants for use in BEAUti + public static final String SCALE_GRADIENT = "scaleGradient"; + public ScaleGradient(String traitName, TreeDataLikelihood treeDataLikelihood, BeagleDataLikelihoodDelegate likelihoodDelegate, Parameter locationScaleParameter, boolean useHessian) { diff --git a/src/dr/evomodelxml/branchratemodel/ArbitraryBranchRatesParser.java b/src/dr/evomodelxml/branchratemodel/ArbitraryBranchRatesParser.java index 2300c6fd8c..7629b1453f 100644 --- a/src/dr/evomodelxml/branchratemodel/ArbitraryBranchRatesParser.java +++ b/src/dr/evomodelxml/branchratemodel/ArbitraryBranchRatesParser.java @@ -52,7 +52,7 @@ public class ArbitraryBranchRatesParser extends AbstractXMLObjectParser { public static final String MULTIPLIER = "multiplier"; public static final String CENTER_AT_ONE = "centerAtOne"; public static final String RANDOMIZE_RATES = "randomizeRates"; - public static final String RANDOM_SCALE = "randomScale"; + public static final String RANDOM_SCALE = "randomScale"; public static final String INCLUDE_ROOT = "includeRoot"; public static final String RANDOM_INDICATOR = "randomIndicator"; // keep some rates fixed but randomize others diff --git a/src/dr/evomodelxml/coalescent/GMRFSkyrideLikelihoodParser.java b/src/dr/evomodelxml/coalescent/GMRFSkyrideLikelihoodParser.java index 61097f0326..b8e9a5dc48 100644 --- a/src/dr/evomodelxml/coalescent/GMRFSkyrideLikelihoodParser.java +++ b/src/dr/evomodelxml/coalescent/GMRFSkyrideLikelihoodParser.java @@ -1,7 +1,7 @@ /* * GMRFSkyrideLikelihoodParser.java * - * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard + * Copyright (c) 2002-2014 Alexei Drummond, Andrew Rambaut and Marc Suchard * * This file is part of BEAST. * See the NOTICE file distributed with this work for additional @@ -81,6 +81,11 @@ public class GMRFSkyrideLikelihoodParser extends AbstractXMLObjectParser { public static final String GLM_MODEL = "glmModel"; public static final String USE_GLM_MODEL = "useGlmModel"; + //declaring String constants for use in BEAUti + public static final String SKYGRID_PRECISION = "skygrid.precision"; + public static final String SKYGRID_LOGPOPSIZE = "skygrid.logPopSize"; + public static final String SKYGRID_PRECISION_PRIOR = "skygrid.precision.prior"; + public String getParserName() { return SKYLINE_LIKELIHOOD; } diff --git a/src/dr/evomodelxml/continuous/hmc/LocationScaleGradientParser.java b/src/dr/evomodelxml/continuous/hmc/LocationScaleGradientParser.java index d395b4ec85..382dd638e8 100644 --- a/src/dr/evomodelxml/continuous/hmc/LocationScaleGradientParser.java +++ b/src/dr/evomodelxml/continuous/hmc/LocationScaleGradientParser.java @@ -55,12 +55,16 @@ public class LocationScaleGradientParser extends AbstractXMLObjectParser { - private static final String NAME = "locationScaleGradient"; - private static final String LOCATION = "location"; - private static final String SCALE = "scale"; + public static final String NAME = "locationScaleGradient"; + public static final String USE_HESSIAN = "useHessian"; + public static final String TRAIT_NAME = TreeTraitParserUtilities.TRAIT_NAME; + public static final String LOCATION = "location"; + public static final String SCALE = "scale"; - private static final String TRAIT_NAME = TreeTraitParserUtilities.TRAIT_NAME; - private static final String USE_HESSIAN = "useHessian"; + //declaring String constants for use in BEAUti + public static final String LOCATION_SCALE = "locationScale"; + public static final String LOCATION_SCALE_JOINT_GRADIENT = "locationScaleJointGradient"; + public static final String LOCATION_SCALE_PRIOR_GRADIENT = "locationScalePriorGradient"; public String getParserName(){ return NAME; } @@ -99,7 +103,6 @@ private GradientWrtParameterProvider parseTreeDataLikelihood(XMLObject xo, TreeD String traitName, boolean useHessian) throws XMLParseException { - BranchRateModel branchRateModel = treeDataLikelihood.getBranchRateModel(); DataLikelihoodDelegate delegate = treeDataLikelihood.getDataLikelihoodDelegate(); diff --git a/src/dr/inference/markovjumps/TwoStateSericolaSeriesMarkovReward.java b/src/dr/inference/markovjumps/TwoStateSericolaSeriesMarkovReward.java index d035ea7215..b8f8a192e9 100644 --- a/src/dr/inference/markovjumps/TwoStateSericolaSeriesMarkovReward.java +++ b/src/dr/inference/markovjumps/TwoStateSericolaSeriesMarkovReward.java @@ -44,6 +44,7 @@ public class TwoStateSericolaSeriesMarkovReward implements MarkovReward { // Following Bladt, Meini, Neuts and Sericola (2002). // Assuming each state has a distinct reward, i.e. \phi + 1 = stateCount, // and states are sorted in increasing reward order + private static final boolean DEBUG = true; private static final boolean DEBUG2 = false; diff --git a/src/dr/inference/operators/hmc/HamiltonianMonteCarloOperator.java b/src/dr/inference/operators/hmc/HamiltonianMonteCarloOperator.java index 1476736a7a..9e06924df8 100644 --- a/src/dr/inference/operators/hmc/HamiltonianMonteCarloOperator.java +++ b/src/dr/inference/operators/hmc/HamiltonianMonteCarloOperator.java @@ -336,7 +336,7 @@ private String gradientMismatchInformation(double[] analyticGradient, double[] n meanDiff /= n; StringBuilder sb = new StringBuilder(); - sb.append("\tMaximum aboslute difference: " + maxDiff + " (at index " + (maxInd) + ")\n"); + sb.append("\tMaximum absolute difference: " + maxDiff + " (at index " + (maxInd) + ")\n"); sb.append("\tAverage absolute difference: " + meanDiff + "\n"); sb.append("\tList of all values exceeding the tolerance:\n"); sb.append("\t\tindex analytic numeric absolute difference\n"); diff --git a/src/dr/inferencexml/operators/hmc/HamiltonianMonteCarloOperatorParser.java b/src/dr/inferencexml/operators/hmc/HamiltonianMonteCarloOperatorParser.java index 3feb731d17..b41aae26ac 100644 --- a/src/dr/inferencexml/operators/hmc/HamiltonianMonteCarloOperatorParser.java +++ b/src/dr/inferencexml/operators/hmc/HamiltonianMonteCarloOperatorParser.java @@ -49,19 +49,21 @@ public class HamiltonianMonteCarloOperatorParser extends AbstractXMLObjectParser public final static String HMC_OPERATOR = "hamiltonianMonteCarloOperator"; public final static String N_STEPS = "nSteps"; public final static String STEP_SIZE = "stepSize"; - private final static String RANDOM_STEP_FRACTION = "randomStepCountFraction"; public final static String PRECONDITIONING = "preconditioning"; - private final static String PRECONDITIONER = "preconditioner"; public final static String GRADIENT_CHECK_COUNT = "gradientCheckCount"; public final static String GRADIENT_CHECK_TOLERANCE = "gradientCheckTolerance"; + public final static String DRAW_VARIANCE = "drawVariance"; + public final static String MODE = "mode"; + public final static String PRECONDITIONING_UPDATE_FREQUENCY = "preconditioningUpdateFrequency"; + public final static String PRECONDITIONING_DELAY = "preconditioningDelay"; + + private final static String RANDOM_STEP_FRACTION = "randomStepCountFraction"; + private final static String PRECONDITIONER = "preconditioner"; private final static String MAX_ITERATIONS = "checkStepSizeMaxIterations"; private final static String REDUCTION_FACTOR = "checkStepSizeReductionFactor"; private final static String TARGET_ACCEPTANCE_PROBABILITY = "targetAcceptanceProbability"; private final static String INSTABILITY_HANDLER = "instabilityHandler"; private final static String MASK = "mask"; - //these are in the Skygrid+HMC XML files but were not (yet) defined here - public final static String MODE = "mode"; - public final static String PRECONDITIONING_UPDATE_FREQUENCY = "preconditioningUpdateFrequency"; @Override public String getParserName() { diff --git a/ci/TestXML/test1DIncrementTransform.xml b/tests/TestXML/test1DIncrementTransform.xml similarity index 100% rename from ci/TestXML/test1DIncrementTransform.xml rename to tests/TestXML/test1DIncrementTransform.xml diff --git a/ci/TestXML/testActualRepeatedMeasures.xml b/tests/TestXML/testActualRepeatedMeasures.xml similarity index 100% rename from ci/TestXML/testActualRepeatedMeasures.xml rename to tests/TestXML/testActualRepeatedMeasures.xml diff --git a/ci/TestXML/testAffineCorrectionGradient.xml b/tests/TestXML/testAffineCorrectionGradient.xml similarity index 100% rename from ci/TestXML/testAffineCorrectionGradient.xml rename to tests/TestXML/testAffineCorrectionGradient.xml diff --git a/ci/TestXML/testAutoRegressiveNormal.xml b/tests/TestXML/testAutoRegressiveNormal.xml similarity index 100% rename from ci/TestXML/testAutoRegressiveNormal.xml rename to tests/TestXML/testAutoRegressiveNormal.xml diff --git a/ci/TestXML/testBBMRFGradient.xml b/tests/TestXML/testBBMRFGradient.xml similarity index 100% rename from ci/TestXML/testBBMRFGradient.xml rename to tests/TestXML/testBBMRFGradient.xml diff --git a/ci/TestXML/testBayesianBridge.xml b/tests/TestXML/testBayesianBridge.xml similarity index 100% rename from ci/TestXML/testBayesianBridge.xml rename to tests/TestXML/testBayesianBridge.xml diff --git a/ci/TestXML/testBayesianSkylineGradient.xml b/tests/TestXML/testBayesianSkylineGradient.xml similarity index 100% rename from ci/TestXML/testBayesianSkylineGradient.xml rename to tests/TestXML/testBayesianSkylineGradient.xml diff --git a/ci/TestXML/testBeastUnitTest.xml b/tests/TestXML/testBeastUnitTest.xml similarity index 100% rename from ci/TestXML/testBeastUnitTest.xml rename to tests/TestXML/testBeastUnitTest.xml diff --git a/ci/TestXML/testBivariateBranchGradientMissingData.xml b/tests/TestXML/testBivariateBranchGradientMissingData.xml similarity index 100% rename from ci/TestXML/testBivariateBranchGradientMissingData.xml rename to tests/TestXML/testBivariateBranchGradientMissingData.xml diff --git a/ci/TestXML/testBlombergKStatistic.xml b/tests/TestXML/testBlombergKStatistic.xml similarity index 100% rename from ci/TestXML/testBlombergKStatistic.xml rename to tests/TestXML/testBlombergKStatistic.xml diff --git a/ci/TestXML/testBranchSpecificRateMatrixMixture.xml b/tests/TestXML/testBranchSpecificRateMatrixMixture.xml similarity index 100% rename from ci/TestXML/testBranchSpecificRateMatrixMixture.xml rename to tests/TestXML/testBranchSpecificRateMatrixMixture.xml diff --git a/ci/TestXML/testBranchSpecificSubstitutionModel.xml b/tests/TestXML/testBranchSpecificSubstitutionModel.xml similarity index 100% rename from ci/TestXML/testBranchSpecificSubstitutionModel.xml rename to tests/TestXML/testBranchSpecificSubstitutionModel.xml diff --git a/ci/TestXML/testBranchSubstitutionGradientAlphaMG94.xml b/tests/TestXML/testBranchSubstitutionGradientAlphaMG94.xml similarity index 100% rename from ci/TestXML/testBranchSubstitutionGradientAlphaMG94.xml rename to tests/TestXML/testBranchSubstitutionGradientAlphaMG94.xml diff --git a/ci/TestXML/testCladeRelationshipStatistic.xml b/tests/TestXML/testCladeRelationshipStatistic.xml similarity index 100% rename from ci/TestXML/testCladeRelationshipStatistic.xml rename to tests/TestXML/testCladeRelationshipStatistic.xml diff --git a/ci/TestXML/testCladeSpecificSubstitutionModelGradient.xml b/tests/TestXML/testCladeSpecificSubstitutionModelGradient.xml similarity index 100% rename from ci/TestXML/testCladeSpecificSubstitutionModelGradient.xml rename to tests/TestXML/testCladeSpecificSubstitutionModelGradient.xml diff --git a/ci/TestXML/testCoalescentGradient.xml b/tests/TestXML/testCoalescentGradient.xml similarity index 100% rename from ci/TestXML/testCoalescentGradient.xml rename to tests/TestXML/testCoalescentGradient.xml diff --git a/ci/TestXML/testComposableContinuousModel.xml b/tests/TestXML/testComposableContinuousModel.xml similarity index 100% rename from ci/TestXML/testComposableContinuousModel.xml rename to tests/TestXML/testComposableContinuousModel.xml diff --git a/ci/TestXML/testCompoundGradient.xml b/tests/TestXML/testCompoundGradient.xml similarity index 100% rename from ci/TestXML/testCompoundGradient.xml rename to tests/TestXML/testCompoundGradient.xml diff --git a/ci/TestXML/testConvolutionStatistic.xml b/tests/TestXML/testConvolutionStatistic.xml similarity index 100% rename from ci/TestXML/testConvolutionStatistic.xml rename to tests/TestXML/testConvolutionStatistic.xml diff --git a/ci/TestXML/testCrssbdpGradient.xml b/tests/TestXML/testCrssbdpGradient.xml similarity index 100% rename from ci/TestXML/testCrssbdpGradient.xml rename to tests/TestXML/testCrssbdpGradient.xml diff --git a/ci/TestXML/testCyclicalEpochGradient.xml b/tests/TestXML/testCyclicalEpochGradient.xml similarity index 100% rename from ci/TestXML/testCyclicalEpochGradient.xml rename to tests/TestXML/testCyclicalEpochGradient.xml diff --git a/ci/TestXML/testDecomposedPrecisionGradient.xml b/tests/TestXML/testDecomposedPrecisionGradient.xml similarity index 100% rename from ci/TestXML/testDecomposedPrecisionGradient.xml rename to tests/TestXML/testDecomposedPrecisionGradient.xml diff --git a/ci/TestXML/testDifferentiableBranchRateModels.xml b/tests/TestXML/testDifferentiableBranchRateModels.xml similarity index 100% rename from ci/TestXML/testDifferentiableBranchRateModels.xml rename to tests/TestXML/testDifferentiableBranchRateModels.xml diff --git a/ci/TestXML/testDriftMultivariateTraitLikelihoodVsTraitDataLikelihood.xml b/tests/TestXML/testDriftMultivariateTraitLikelihoodVsTraitDataLikelihood.xml similarity index 100% rename from ci/TestXML/testDriftMultivariateTraitLikelihoodVsTraitDataLikelihood.xml rename to tests/TestXML/testDriftMultivariateTraitLikelihoodVsTraitDataLikelihood.xml diff --git a/ci/TestXML/testEpochConvolutionOrder.xml b/tests/TestXML/testEpochConvolutionOrder.xml similarity index 100% rename from ci/TestXML/testEpochConvolutionOrder.xml rename to tests/TestXML/testEpochConvolutionOrder.xml diff --git a/ci/TestXML/testEpochSubstitutionModelGradient.xml b/tests/TestXML/testEpochSubstitutionModelGradient.xml similarity index 100% rename from ci/TestXML/testEpochSubstitutionModelGradient.xml rename to tests/TestXML/testEpochSubstitutionModelGradient.xml diff --git a/ci/TestXML/testEssbdpGradient.xml b/tests/TestXML/testEssbdpGradient.xml similarity index 100% rename from ci/TestXML/testEssbdpGradient.xml rename to tests/TestXML/testEssbdpGradient.xml diff --git a/ci/TestXML/testEstimableStemWeightBranchSpecificSubstitutionModel.xml b/tests/TestXML/testEstimableStemWeightBranchSpecificSubstitutionModel.xml similarity index 100% rename from ci/TestXML/testEstimableStemWeightBranchSpecificSubstitutionModel.xml rename to tests/TestXML/testEstimableStemWeightBranchSpecificSubstitutionModel.xml diff --git a/ci/TestXML/testExtendedLatentLiabilityGibbsOperator.xml b/tests/TestXML/testExtendedLatentLiabilityGibbsOperator.xml similarity index 100% rename from ci/TestXML/testExtendedLatentLiabilityGibbsOperator.xml rename to tests/TestXML/testExtendedLatentLiabilityGibbsOperator.xml diff --git a/ci/TestXML/testFactorLikelihood.xml b/tests/TestXML/testFactorLikelihood.xml similarity index 100% rename from ci/TestXML/testFactorLikelihood.xml rename to tests/TestXML/testFactorLikelihood.xml diff --git a/ci/TestXML/testFactorNumericStability.xml b/tests/TestXML/testFactorNumericStability.xml similarity index 100% rename from ci/TestXML/testFactorNumericStability.xml rename to tests/TestXML/testFactorNumericStability.xml diff --git a/ci/TestXML/testFactorProportionStatistic.xml b/tests/TestXML/testFactorProportionStatistic.xml similarity index 100% rename from ci/TestXML/testFactorProportionStatistic.xml rename to tests/TestXML/testFactorProportionStatistic.xml diff --git a/ci/TestXML/testFactorValidation.xml b/tests/TestXML/testFactorValidation.xml similarity index 100% rename from ci/TestXML/testFactorValidation.xml rename to tests/TestXML/testFactorValidation.xml diff --git a/ci/TestXML/testGMRFBayesianSkygrid+HMC+strict.xml b/tests/TestXML/testGMRFBayesianSkygrid+HMC+strict.xml similarity index 100% rename from ci/TestXML/testGMRFBayesianSkygrid+HMC+strict.xml rename to tests/TestXML/testGMRFBayesianSkygrid+HMC+strict.xml diff --git a/ci/TestXML/testGMRFBayesianSkygrid+strict.xml b/tests/TestXML/testGMRFBayesianSkygrid+strict.xml similarity index 100% rename from ci/TestXML/testGMRFBayesianSkygrid+strict.xml rename to tests/TestXML/testGMRFBayesianSkygrid+strict.xml diff --git a/ci/TestXML/testGMRFBayesianSkyride+strict.xml b/tests/TestXML/testGMRFBayesianSkyride+strict.xml similarity index 100% rename from ci/TestXML/testGMRFBayesianSkyride+strict.xml rename to tests/TestXML/testGMRFBayesianSkyride+strict.xml diff --git a/ci/TestXML/testGammaGibbsProvider.xml b/tests/TestXML/testGammaGibbsProvider.xml similarity index 100% rename from ci/TestXML/testGammaGibbsProvider.xml rename to tests/TestXML/testGammaGibbsProvider.xml diff --git a/ci/TestXML/testGaussianMarkovRandomField.xml b/tests/TestXML/testGaussianMarkovRandomField.xml similarity index 100% rename from ci/TestXML/testGaussianMarkovRandomField.xml rename to tests/TestXML/testGaussianMarkovRandomField.xml diff --git a/ci/TestXML/testGeneralizedSamplingStoneHmcMultivariateDiffusion.xml b/tests/TestXML/testGeneralizedSamplingStoneHmcMultivariateDiffusion.xml similarity index 100% rename from ci/TestXML/testGeneralizedSamplingStoneHmcMultivariateDiffusion.xml rename to tests/TestXML/testGeneralizedSamplingStoneHmcMultivariateDiffusion.xml diff --git a/ci/TestXML/testGeodesicHMC.xml b/tests/TestXML/testGeodesicHMC.xml similarity index 100% rename from ci/TestXML/testGeodesicHMC.xml rename to tests/TestXML/testGeodesicHMC.xml diff --git a/ci/TestXML/testGlmCrossProducts.xml b/tests/TestXML/testGlmCrossProducts.xml similarity index 100% rename from ci/TestXML/testGlmCrossProducts.xml rename to tests/TestXML/testGlmCrossProducts.xml diff --git a/ci/TestXML/testGlmEmpiricalAaGradient.xml b/tests/TestXML/testGlmEmpiricalAaGradient.xml similarity index 100% rename from ci/TestXML/testGlmEmpiricalAaGradient.xml rename to tests/TestXML/testGlmEmpiricalAaGradient.xml diff --git a/ci/TestXML/testGlmEmpiricalAaModel.xml b/tests/TestXML/testGlmEmpiricalAaModel.xml similarity index 100% rename from ci/TestXML/testGlmEmpiricalAaModel.xml rename to tests/TestXML/testGlmEmpiricalAaModel.xml diff --git a/ci/TestXML/testGlmGradient.xml b/tests/TestXML/testGlmGradient.xml similarity index 100% rename from ci/TestXML/testGlmGradient.xml rename to tests/TestXML/testGlmGradient.xml diff --git a/ci/TestXML/testGlmRateMatrixMixtureModel.xml b/tests/TestXML/testGlmRateMatrixMixtureModel.xml similarity index 100% rename from ci/TestXML/testGlmRateMatrixMixtureModel.xml rename to tests/TestXML/testGlmRateMatrixMixtureModel.xml diff --git a/ci/TestXML/testGradientWorkingPriors.xml b/tests/TestXML/testGradientWorkingPriors.xml similarity index 100% rename from ci/TestXML/testGradientWorkingPriors.xml rename to tests/TestXML/testGradientWorkingPriors.xml diff --git a/ci/TestXML/testHkyGradient.xml b/tests/TestXML/testHkyGradient.xml similarity index 100% rename from ci/TestXML/testHkyGradient.xml rename to tests/TestXML/testHkyGradient.xml diff --git a/ci/TestXML/testHzzNuts.xml b/tests/TestXML/testHzzNuts.xml similarity index 100% rename from ci/TestXML/testHzzNuts.xml rename to tests/TestXML/testHzzNuts.xml diff --git a/ci/TestXML/testIndependentNormalDistributionModel.xml b/tests/TestXML/testIndependentNormalDistributionModel.xml similarity index 100% rename from ci/TestXML/testIndependentNormalDistributionModel.xml rename to tests/TestXML/testIndependentNormalDistributionModel.xml diff --git a/ci/TestXML/testIntegratedFactors.xml b/tests/TestXML/testIntegratedFactors.xml similarity index 100% rename from ci/TestXML/testIntegratedFactors.xml rename to tests/TestXML/testIntegratedFactors.xml diff --git a/ci/TestXML/testJointNormalExtensionProvider.xml b/tests/TestXML/testJointNormalExtensionProvider.xml similarity index 100% rename from ci/TestXML/testJointNormalExtensionProvider.xml rename to tests/TestXML/testJointNormalExtensionProvider.xml diff --git a/ci/TestXML/testJointPartialsProvider.xml b/tests/TestXML/testJointPartialsProvider.xml similarity index 99% rename from ci/TestXML/testJointPartialsProvider.xml rename to tests/TestXML/testJointPartialsProvider.xml index c145a58ce1..7327f58fa8 100644 --- a/ci/TestXML/testJointPartialsProvider.xml +++ b/tests/TestXML/testJointPartialsProvider.xml @@ -399,7 +399,7 @@ + gradientCheckCount="100" gradientCheckTolerance="1e-2"> diff --git a/ci/TestXML/testLoadingsAndPrecisionGradient.xml b/tests/TestXML/testLoadingsAndPrecisionGradient.xml similarity index 99% rename from ci/TestXML/testLoadingsAndPrecisionGradient.xml rename to tests/TestXML/testLoadingsAndPrecisionGradient.xml index 4426fdd006..efaed4dc47 100644 --- a/ci/TestXML/testLoadingsAndPrecisionGradient.xml +++ b/tests/TestXML/testLoadingsAndPrecisionGradient.xml @@ -137,7 +137,7 @@ + gradientCheckCount="100" gradientCheckTolerance="1e-1"> diff --git a/ci/TestXML/testLoadingsGradient.xml b/tests/TestXML/testLoadingsGradient.xml similarity index 100% rename from ci/TestXML/testLoadingsGradient.xml rename to tests/TestXML/testLoadingsGradient.xml diff --git a/ci/TestXML/testLoadingsScaleGibbsOperator.xml b/tests/TestXML/testLoadingsScaleGibbsOperator.xml similarity index 100% rename from ci/TestXML/testLoadingsScaleGibbsOperator.xml rename to tests/TestXML/testLoadingsScaleGibbsOperator.xml diff --git a/ci/TestXML/testLogRateSubstitutionModel.xml b/tests/TestXML/testLogRateSubstitutionModel.xml similarity index 100% rename from ci/TestXML/testLogRateSubstitutionModel.xml rename to tests/TestXML/testLogRateSubstitutionModel.xml diff --git a/ci/TestXML/testLostTimeModel.xml b/tests/TestXML/testLostTimeModel.xml similarity index 100% rename from ci/TestXML/testLostTimeModel.xml rename to tests/TestXML/testLostTimeModel.xml diff --git a/ci/TestXML/testMatrixShrinkageLikelihood.xml b/tests/TestXML/testMatrixShrinkageLikelihood.xml similarity index 100% rename from ci/TestXML/testMatrixShrinkageLikelihood.xml rename to tests/TestXML/testMatrixShrinkageLikelihood.xml diff --git a/ci/TestXML/testMatrixVonMisesFisherGibbsOperator.xml b/tests/TestXML/testMatrixVonMisesFisherGibbsOperator.xml similarity index 100% rename from ci/TestXML/testMatrixVonMisesFisherGibbsOperator.xml rename to tests/TestXML/testMatrixVonMisesFisherGibbsOperator.xml diff --git a/ci/TestXML/testMultiplicativeParameter.xml b/tests/TestXML/testMultiplicativeParameter.xml similarity index 100% rename from ci/TestXML/testMultiplicativeParameter.xml rename to tests/TestXML/testMultiplicativeParameter.xml diff --git a/ci/TestXML/testMultivariateGammaLikelihood.xml b/tests/TestXML/testMultivariateGammaLikelihood.xml similarity index 100% rename from ci/TestXML/testMultivariateGammaLikelihood.xml rename to tests/TestXML/testMultivariateGammaLikelihood.xml diff --git a/ci/TestXML/testNewEssbdp.xml b/tests/TestXML/testNewEssbdp.xml similarity index 100% rename from ci/TestXML/testNewEssbdp.xml rename to tests/TestXML/testNewEssbdp.xml diff --git a/ci/TestXML/testNewLoadingsGibbsOperator.xml b/tests/TestXML/testNewLoadingsGibbsOperator.xml similarity index 100% rename from ci/TestXML/testNewLoadingsGibbsOperator.xml rename to tests/TestXML/testNewLoadingsGibbsOperator.xml diff --git a/ci/TestXML/testNewSsbdp.xml b/tests/TestXML/testNewSsbdp.xml similarity index 100% rename from ci/TestXML/testNewSsbdp.xml rename to tests/TestXML/testNewSsbdp.xml diff --git a/ci/TestXML/testNodeHeightGradient.xml b/tests/TestXML/testNodeHeightGradient.xml similarity index 100% rename from ci/TestXML/testNodeHeightGradient.xml rename to tests/TestXML/testNodeHeightGradient.xml diff --git a/ci/TestXML/testNormalMatrixNormLikelihood.xml b/tests/TestXML/testNormalMatrixNormLikelihood.xml similarity index 100% rename from ci/TestXML/testNormalMatrixNormLikelihood.xml rename to tests/TestXML/testNormalMatrixNormLikelihood.xml diff --git a/ci/TestXML/testPriorPreconditioner.xml b/tests/TestXML/testPriorPreconditioner.xml similarity index 100% rename from ci/TestXML/testPriorPreconditioner.xml rename to tests/TestXML/testPriorPreconditioner.xml diff --git a/ci/TestXML/testPriorPreconditionerVariableDimension.xml b/tests/TestXML/testPriorPreconditionerVariableDimension.xml similarity index 100% rename from ci/TestXML/testPriorPreconditionerVariableDimension.xml rename to tests/TestXML/testPriorPreconditionerVariableDimension.xml diff --git a/ci/TestXML/testRateMatrixMixtureModel.xml b/tests/TestXML/testRateMatrixMixtureModel.xml similarity index 100% rename from ci/TestXML/testRateMatrixMixtureModel.xml rename to tests/TestXML/testRateMatrixMixtureModel.xml diff --git a/ci/TestXML/testReflectiveHMC.xml b/tests/TestXML/testReflectiveHMC.xml similarity index 100% rename from ci/TestXML/testReflectiveHMC.xml rename to tests/TestXML/testReflectiveHMC.xml diff --git a/ci/TestXML/testRepeatedMeasures.xml b/tests/TestXML/testRepeatedMeasures.xml similarity index 100% rename from ci/TestXML/testRepeatedMeasures.xml rename to tests/TestXML/testRepeatedMeasures.xml diff --git a/ci/TestXML/testRepeatedMeasuresExtension.xml b/tests/TestXML/testRepeatedMeasuresExtension.xml similarity index 100% rename from ci/TestXML/testRepeatedMeasuresExtension.xml rename to tests/TestXML/testRepeatedMeasuresExtension.xml diff --git a/ci/TestXML/testRepeatedMeasuresOUHmc.xml b/tests/TestXML/testRepeatedMeasuresOUHmc.xml similarity index 99% rename from ci/TestXML/testRepeatedMeasuresOUHmc.xml rename to tests/TestXML/testRepeatedMeasuresOUHmc.xml index 3c9bce63a2..5aafa14894 100644 --- a/ci/TestXML/testRepeatedMeasuresOUHmc.xml +++ b/tests/TestXML/testRepeatedMeasuresOUHmc.xml @@ -253,7 +253,7 @@ - + @@ -345,8 +345,12 @@ + 0.9997531382609257 0.19550438061492784 + 0.19550438061492784 0.9258670139080631 + diff --git a/ci/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml b/tests/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml similarity index 99% rename from ci/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml rename to tests/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml index 7faf6f7eba..37800065ee 100644 --- a/ci/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml +++ b/tests/TestXML/testRepeatedMeasuresOUHmcTreeScaled.xml @@ -253,7 +253,7 @@ - + @@ -345,8 +345,12 @@ + 0.9881278234958323 0.027051233440815354} + 0.027051233440815354 0.011934240128512253 + diff --git a/ci/TestXML/testRepeatedMeasuresTreeScaled.xml b/tests/TestXML/testRepeatedMeasuresTreeScaled.xml similarity index 100% rename from ci/TestXML/testRepeatedMeasuresTreeScaled.xml rename to tests/TestXML/testRepeatedMeasuresTreeScaled.xml diff --git a/ci/TestXML/testSVDStatistic.xml b/tests/TestXML/testSVDStatistic.xml similarity index 100% rename from ci/TestXML/testSVDStatistic.xml rename to tests/TestXML/testSVDStatistic.xml diff --git a/ci/TestXML/testSampledLoadingsGradient.xml b/tests/TestXML/testSampledLoadingsGradient.xml similarity index 100% rename from ci/TestXML/testSampledLoadingsGradient.xml rename to tests/TestXML/testSampledLoadingsGradient.xml diff --git a/ci/TestXML/testSampledScaledLoadingsGradient.xml b/tests/TestXML/testSampledScaledLoadingsGradient.xml similarity index 100% rename from ci/TestXML/testSampledScaledLoadingsGradient.xml rename to tests/TestXML/testSampledScaledLoadingsGradient.xml diff --git a/ci/TestXML/testScaledLoadingsGradient.xml b/tests/TestXML/testScaledLoadingsGradient.xml similarity index 100% rename from ci/TestXML/testScaledLoadingsGradient.xml rename to tests/TestXML/testScaledLoadingsGradient.xml diff --git a/ci/TestXML/testSequenceDistanceStatistic.xml b/tests/TestXML/testSequenceDistanceStatistic.xml similarity index 100% rename from ci/TestXML/testSequenceDistanceStatistic.xml rename to tests/TestXML/testSequenceDistanceStatistic.xml diff --git a/ci/TestXML/testSequenceDistanceStatisticMCMC.xml b/tests/TestXML/testSequenceDistanceStatisticMCMC.xml similarity index 100% rename from ci/TestXML/testSequenceDistanceStatisticMCMC.xml rename to tests/TestXML/testSequenceDistanceStatisticMCMC.xml diff --git a/ci/TestXML/testSkyGrid.xml b/tests/TestXML/testSkyGrid.xml similarity index 100% rename from ci/TestXML/testSkyGrid.xml rename to tests/TestXML/testSkyGrid.xml diff --git a/ci/TestXML/testSkyglide.xml b/tests/TestXML/testSkyglide.xml similarity index 100% rename from ci/TestXML/testSkyglide.xml rename to tests/TestXML/testSkyglide.xml diff --git a/ci/TestXML/testSmoothSkygridGradient.xml b/tests/TestXML/testSmoothSkygridGradient.xml similarity index 100% rename from ci/TestXML/testSmoothSkygridGradient.xml rename to tests/TestXML/testSmoothSkygridGradient.xml diff --git a/ci/TestXML/testSpeciationLikelihoodGradient.xml b/tests/TestXML/testSpeciationLikelihoodGradient.xml similarity index 100% rename from ci/TestXML/testSpeciationLikelihoodGradient.xml rename to tests/TestXML/testSpeciationLikelihoodGradient.xml diff --git a/ci/TestXML/testSsbdpHmc.xml b/tests/TestXML/testSsbdpHmc.xml similarity index 100% rename from ci/TestXML/testSsbdpHmc.xml rename to tests/TestXML/testSsbdpHmc.xml diff --git a/ci/TestXML/testStrictClockGradient.xml b/tests/TestXML/testStrictClockGradient.xml similarity index 100% rename from ci/TestXML/testStrictClockGradient.xml rename to tests/TestXML/testStrictClockGradient.xml diff --git a/ci/TestXML/testTimeVaryingRates.xml b/tests/TestXML/testTimeVaryingRates.xml similarity index 100% rename from ci/TestXML/testTimeVaryingRates.xml rename to tests/TestXML/testTimeVaryingRates.xml diff --git a/ci/TestXML/testTraitGradientOnTree.xml b/tests/TestXML/testTraitGradientOnTree.xml similarity index 100% rename from ci/TestXML/testTraitGradientOnTree.xml rename to tests/TestXML/testTraitGradientOnTree.xml diff --git a/ci/TestXML/testWishartStatisticsWrapper.xml b/tests/TestXML/testWishartStatisticsWrapper.xml similarity index 100% rename from ci/TestXML/testWishartStatisticsWrapper.xml rename to tests/TestXML/testWishartStatisticsWrapper.xml diff --git a/ci/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.chkpt b/tests/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.chkpt similarity index 100% rename from ci/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.chkpt rename to tests/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.chkpt diff --git a/ci/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.xml b/tests/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.xml similarity index 100% rename from ci/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.xml rename to tests/TestXMLwithLoadState/testCheckpointedRunAdaptiveMCMC.xml diff --git a/ci/TestXMLwithLoadState/testCheckpointedRunHMC.chkpt b/tests/TestXMLwithLoadState/testCheckpointedRunHMC.chkpt similarity index 100% rename from ci/TestXMLwithLoadState/testCheckpointedRunHMC.chkpt rename to tests/TestXMLwithLoadState/testCheckpointedRunHMC.chkpt diff --git a/ci/TestXMLwithLoadState/testCheckpointedRunHMC.xml b/tests/TestXMLwithLoadState/testCheckpointedRunHMC.xml similarity index 99% rename from ci/TestXMLwithLoadState/testCheckpointedRunHMC.xml rename to tests/TestXMLwithLoadState/testCheckpointedRunHMC.xml index d5f4866570..c60cbd5d03 100644 --- a/ci/TestXMLwithLoadState/testCheckpointedRunHMC.xml +++ b/tests/TestXMLwithLoadState/testCheckpointedRunHMC.xml @@ -833,7 +833,7 @@ - + - + Check log joint density after 1000 iterations, having resumed from testCheckpointHMC.chkpt @@ -979,7 +979,11 @@ - -12951.78928007183 + -13218.081104785917 + + + + diff --git a/ci/broken/testGamGpLikelihoodAndGradient.xml b/tests/broken/testGamGpLikelihoodAndGradient.xml similarity index 100% rename from ci/broken/testGamGpLikelihoodAndGradient.xml rename to tests/broken/testGamGpLikelihoodAndGradient.xml diff --git a/ci/TestXML/testSkygridNodeHeightGradient.xml b/tests/broken/testSkygridNodeHeightGradient.xml similarity index 100% rename from ci/TestXML/testSkygridNodeHeightGradient.xml rename to tests/broken/testSkygridNodeHeightGradient.xml diff --git a/ci/broken/testToyLogisticHmcPrec.xml b/tests/broken/testToyLogisticHmcPrec.xml similarity index 100% rename from ci/broken/testToyLogisticHmcPrec.xml rename to tests/broken/testToyLogisticHmcPrec.xml diff --git a/ci/test.sh b/tests/test.sh similarity index 94% rename from ci/test.sh rename to tests/test.sh index da25d9d37c..521cae3400 100755 --- a/ci/test.sh +++ b/tests/test.sh @@ -5,7 +5,7 @@ trap 'echo "Ctr + C!"; exit 2' SIGINT passed=true failedFiles=() -for file in ci/TestXML/*\.xml +for file in ./TestXML/*\.xml do if java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -overwrite $file; then echo $file passed diff --git a/ci/test_with_load_state.sh b/tests/test_with_load_state.sh similarity index 67% rename from ci/test_with_load_state.sh rename to tests/test_with_load_state.sh index 0c01178917..b1e56a6755 100755 --- a/ci/test_with_load_state.sh +++ b/tests/test_with_load_state.sh @@ -1,9 +1,9 @@ #!/bin/bash -for file in ci/TestXMLwithLoadState/*\.xml +for file in ./TestXMLwithLoadState/*\.xml do - checkpoint=ci/TestXMLwithLoadState/$(basename $file .xml).chkpt + checkpoint=./TestXMLwithLoadState/$(basename $file .xml).chkpt if java -Djava.library.path=${BEAGLE_LIB} -jar build/dist/beast.jar -fail_threads -seed 666 -load_state $checkpoint -overwrite $file; then echo $file passed else