Skip to content

Commit 01afa43

Browse files
authored
Merge pull request #25 from alexeid/beast3
Migrate sampled-ancestors to BEAST 3
2 parents 8190f50 + 95fcc1b commit 01afa43

File tree

78 files changed

+729
-1058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+729
-1058
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v2
9-
- run: docker build -t tests .
10-
- run: docker run tests
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-java@v4
10+
with:
11+
distribution: temurin
12+
java-version: 25
13+
server-id: github
14+
server-username: GITHUB_ACTOR
15+
server-password: GITHUB_TOKEN
16+
- run: mvn test
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,23 @@ build-beast/
88
dist/
99
build-test/
1010
test-reports/
11+
target/
12+
**/target/
1113

1214
# IntelliJ cruft
1315
/.idea
14-
/sampled-ancestors.iml
16+
*.iml
1517

1618
# Eclipse files
1719
.classpath
1820
.project
1921
/build
20-
/build-lib
22+
/build-lib
23+
24+
# BEAST run output
25+
*.log
26+
*.trees
27+
*.xml.state
28+
29+
# Package ZIPs
30+
*.v*.zip

Dockerfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,74 @@
1-
sampled-ancestors
2-
=================
1+
# Sampled Ancestors
32

43
[![Build Status](https://github.com/CompEvol/sampled-ancestors/workflows/Unit%2Fintegration%20tests/badge.svg)](https://github.com/CompEvol/sampled-ancestors/actions?query=workflow%3A%22Unit%2Fintegration+tests%22)
54

6-
This [BEAST 2](http://www.beast2.org) package provides MCMC proposals and post-processing tools for samples of trees containing sampled ancestors.
7-
It relies on the support for sampled-ancestor trees built into the `beast.evolution.tree.Tree` class (https://github.com/CompEvol/beast2/blob/master/src/beast/evolution/tree/Tree.java).
8-
9-
This archive contains the source code of the package and is therefore of
10-
primary interest to programmers.
5+
This [BEAST 3](https://github.com/CompEvol/beast3) package provides MCMC proposals and post-processing tools for samples of trees containing sampled ancestors.
6+
It relies on the support for sampled-ancestor trees built into the `beast.base.evolution.tree.Tree` class.
117

128
The paper describing this package is:
139

1410
Alexandra Gavryushkina, David Welch, Tanja Stadler, Alexei J. Drummond (2014) Bayesian Inference of Sampled Ancestor Trees for Epidemiology and Fossil Calibration. _PLoS Computational Biology_ https://doi.org/10.1371/journal.pcbi.1003919
1511

16-
Currently the sampled-ancestors package uses `beast.*` Java package namespace, which is now deprecated because the `beast.*` package namespace is reserved for the beast2 core (https://github.com/CompEvol/beast2).
12+
## Building from source
1713

18-
Building package from source
19-
----------------------------
14+
Requirements:
2015

21-
To build this package from source, ensure you have the following installed:
16+
* JDK 25 or later
17+
* Apache Maven
2218

23-
* OpenJDK version 17 or greater
24-
* A recent version of OpenJFX
25-
* The Apache Ant build system
26-
* An internet connection
27-
The internet connection is required since the build script downloads the most
28-
recent version of the BEAST 2 source to build the package against.
19+
```sh
20+
mvn compile
21+
```
2922

30-
Assuming both Java and Ant are on your execution path and your current working
31-
directory is the root of directory this archive, simply type
23+
To run an example:
3224

3325
```sh
34-
JAVA_FX_HOME=/path/to/openjfx/ ant
26+
mvn -pl beast-sampled-ancestors exec:exec -Dbeast.args="examples/bears.xml"
3527
```
3628

37-
from the command line to build the package. This may take up to a minute due
38-
to the script fetching the BEAST source, and the resulting binary will be
39-
left in the `/dist` directory.
29+
## Project structure
30+
31+
This is a multi-module Maven project with two modules:
4032

41-
To run the unit tests, use "ant test".
33+
* **beast-sampled-ancestors** — core module (no JavaFX dependency, runs headless on clusters)
34+
* **beast-sampled-ancestors-fx** — BEAUti input editors and JavaFX-dependent tools
4235

36+
### `sa.app.simulators`
4337

44-
Archive Contents
45-
----------------
38+
Simulators for the fossilized birth-death (FBD) model and FBD-skyline model.
4639

47-
* `README.md` : this file
48-
* `build.xml` : Ant build script
49-
* `/doc` : Contains additional documentation, currently a tutorial for using fossilized birth-death tree prior.
50-
* `/examples` : Example analyses in beast2 xml format. See below for details.
51-
* `/src` : source files. See below for details.
52-
* `/test` : unit tests
53-
* `/templates` : BEAUti templates. See below for details.
54-
* `version.xml` : BEAST package version file.
40+
### `sa.app.tools`
5541

56-
The main Java packages and folders in the sampled-ancestors BEAST2 package are:
42+
* Conversion tools between zero-branch-length sampled-ancestor trees and native sampled-ancestor trees
43+
* `SATreeTraceAnalysis` and various other post-processing tools (in `-fx` module)
5744

58-
### `beast.app.simulators`
45+
### `sa.evolution.operators`
5946

60-
Contains simulators for the fossilized birth-death (FBD) model and FBD-skyline model.
47+
Operators that permit MCMC on sampled-ancestor trees.
6148

62-
### `beast.app.tools`
49+
### `sa.evolution.speciation`
6350

64-
* Contains conversion tools between zero-branch-length sampled-ancestor trees and native sampled-ancestor trees
65-
* Contains `SATreeTraceAnalysis` and various other post-processing tools and support
66-
67-
### `beast.evolution.operators`
68-
69-
* Contains the operators that permit MCMC on sampled-ancestor trees
51+
`SpeciesTreeDistribution` calculations for the FBD prior:
7052

71-
### `beast.evolution.speciation`
53+
* `SABirthDeathModel` — FBD prior with multiple hard-coded parameterizations
54+
* `ParameterizedSABirthDeathModel` — FBD prior with object-oriented parameterizations
7255

73-
Contains `SpeciesTreeDistribution` calculations for the FBD prior:
56+
### `sa.beauti` (in `-fx` module)
7457

75-
* `SABirthDeathModel` - A species tree probability density of FBD prior with multiple hard-coded parameterizations possible.
76-
* `ParameterizedSABirthDeathModel` - A species tree probability density with multiple parameterizations implemented in an object-oriented way.
58+
BEAUti input editors for sampled-ancestor priors.
7759

78-
### `templates`
60+
### `fxtemplates` (in `-fx` module resources)
7961

80-
Contains a template called `FBD.xml` which provides a template for `SABirthDeathModel` and sampled-ancestor tree operators.
62+
Contains `FBD.xml`, a BEAUti template for `SABirthDeathModel` and sampled-ancestor tree operators.
63+
Located at `beast-sampled-ancestors-fx/src/main/resources/sa.fx/fxtemplates/`.
8164

82-
License
83-
-------
65+
## License
8466

85-
This software is free (as in freedom). You are welcome to use it, modify it,
86-
and distribute your modified versions provided you extend the same courtesy to
87-
users of your modified version. Specifically, it is made available under the
67+
This software is free (as in freedom). With your modified versions provided you extend the same courtesy to
68+
users of your modified version. Specifically, it is made available under the
8869
terms of the GNU General Public License version 3.
8970

90-
Acknowledgements
91-
----------------
71+
## Acknowledgements
9272

9373
Work on this project was supported by:
9474

beast-sampled-ancestors-fx/pom.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.github.compevol</groupId>
9+
<artifactId>sampled-ancestors-parent</artifactId>
10+
<version>2.2.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>beast-sampled-ancestors-fx</artifactId>
14+
<name>BEAST Sampled Ancestors FX</name>
15+
16+
<dependencies>
17+
<!-- Internal -->
18+
<dependency>
19+
<groupId>io.github.compevol</groupId>
20+
<artifactId>beast-sampled-ancestors</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>io.github.compevol</groupId>
24+
<artifactId>beast-base</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>io.github.compevol</groupId>
28+
<artifactId>beast-fx</artifactId>
29+
</dependency>
30+
<dependency>
31+
<groupId>io.github.compevol</groupId>
32+
<artifactId>beast-pkgmgmt</artifactId>
33+
</dependency>
34+
35+
<!-- JavaFX -->
36+
<dependency>
37+
<groupId>org.openjfx</groupId>
38+
<artifactId>javafx-controls</artifactId>
39+
</dependency>
40+
</dependencies>
41+
42+
<build>
43+
<plugins>
44+
<!-- Run BEAUti with SA on module path:
45+
mvn -pl beast-sampled-ancestors-fx exec:exec -->
46+
<plugin>
47+
<groupId>org.codehaus.mojo</groupId>
48+
<artifactId>exec-maven-plugin</artifactId>
49+
<version>3.5.0</version>
50+
<configuration>
51+
<executable>java</executable>
52+
<workingDirectory>${maven.multiModuleProjectDirectory}</workingDirectory>
53+
<commandlineArgs>--module-path %classpath -m beast.fx/${beast.main} ${beast.args}</commandlineArgs>
54+
</configuration>
55+
</plugin>
56+
57+
<!-- Assemble BEAST package ZIP -->
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-assembly-plugin</artifactId>
61+
<version>3.7.1</version>
62+
<configuration>
63+
<descriptors>
64+
<descriptor>src/assembly/beast-package.xml</descriptor>
65+
</descriptors>
66+
<finalName>${beast.pkg.name}.v${beast.pkg.version}</finalName>
67+
<appendAssemblyId>false</appendAssemblyId>
68+
</configuration>
69+
<executions>
70+
<execution>
71+
<id>beast-package</id>
72+
<phase>package</phase>
73+
<goals><goal>single</goal></goals>
74+
</execution>
75+
</executions>
76+
</plugin>
77+
</plugins>
78+
</build>
79+
</project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd">
4+
<id>beast-package</id>
5+
<formats>
6+
<format>zip</format>
7+
</formats>
8+
<includeBaseDirectory>false</includeBaseDirectory>
9+
10+
<!-- version.xml from project root -->
11+
<files>
12+
<file>
13+
<source>${project.parent.basedir}/version.xml</source>
14+
<outputDirectory>/</outputDirectory>
15+
</file>
16+
</files>
17+
18+
<!-- Module JARs only (BEAST core, JavaFX, and their transitive deps are provided by the runtime) -->
19+
<dependencySets>
20+
<dependencySet>
21+
<outputDirectory>/lib</outputDirectory>
22+
<useProjectArtifact>true</useProjectArtifact>
23+
<scope>runtime</scope>
24+
<includes>
25+
<include>io.github.compevol:beast-sampled-ancestors</include>
26+
<include>io.github.compevol:beast-sampled-ancestors-fx</include>
27+
</includes>
28+
</dependencySet>
29+
</dependencySets>
30+
31+
<fileSets>
32+
<!-- fxtemplates/ (JPMS-safe module-namespaced resource path) -->
33+
<fileSet>
34+
<directory>${project.basedir}/src/main/resources/sa.fx/fxtemplates</directory>
35+
<outputDirectory>/fxtemplates</outputDirectory>
36+
</fileSet>
37+
<!-- examples/ from project root -->
38+
<fileSet>
39+
<directory>${project.parent.basedir}/examples</directory>
40+
<outputDirectory>/examples</outputDirectory>
41+
</fileSet>
42+
</fileSets>
43+
</assembly>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
open module sa.fx {
2+
requires sa;
3+
requires beast.base;
4+
requires beast.pkgmgmt;
5+
requires beast.fx;
6+
requires javafx.controls;
7+
8+
exports sa.beauti;
9+
exports sa.app.tools.fx;
10+
11+
provides beast.base.core.BEASTInterface with
12+
sa.app.tools.fx.FullToExtantTreeConverter,
13+
sa.app.tools.fx.SampledAncestorTreeAnalyser;
14+
15+
provides beastfx.app.inputeditor.InputEditor with
16+
sa.beauti.SAMRCAPriorInputEditor;
17+
18+
provides beastfx.app.beauti.PriorProvider with
19+
sa.beauti.SAMRCAPriorProvider;
20+
}

src/sa/app/tools/FullToExtantTreeConverter.java renamed to beast-sampled-ancestors-fx/src/main/java/sa/app/tools/fx/FullToExtantTreeConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sa.app.tools;
1+
package sa.app.tools.fx;
22

33

44
import beastfx.app.tools.Application;

src/sa/app/tools/SATreeTraceAnalysis.java renamed to beast-sampled-ancestors-fx/src/main/java/sa/app/tools/fx/SATreeTraceAnalysis.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
package sa.app.tools;
1+
package sa.app.tools.fx;
22

33
import beast.base.evolution.tree.Node;
44
import beast.base.evolution.tree.Tree;
55
import beastfx.app.tools.TreeTraceAnalysis;
66
import beast.base.util.FrequencySet;
7+
import sa.app.tools.NodeComparator;
8+
import sa.app.tools.ResultsOutput;
79

810
import java.io.ByteArrayOutputStream;
911
import java.io.PrintStream;

src/sa/app/tools/SampledAncestorTreeAnalyser.java renamed to beast-sampled-ancestors-fx/src/main/java/sa/app/tools/fx/SampledAncestorTreeAnalyser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sa.app.tools;
1+
package sa.app.tools.fx;
22

33
import beast.base.core.BEASTVersion2;
44
import beastfx.app.tools.Application;

0 commit comments

Comments
 (0)