Skip to content

Commit 92e84a6

Browse files
authored
Merge pull request #18 from alexeid/master
Migrate morph-models to BEAST 3
2 parents e0cbf1a + 208c583 commit 92e84a6

File tree

27 files changed

+1555
-446
lines changed

27 files changed

+1555
-446
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Unit/integration tests
2+
on: [ push, pull_request, workflow_dispatch ]
3+
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
steps:
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
/.idea
33
/morph-models.iml
44
/out
5+
6+
# Maven build output
7+
target/
8+
9+
# Package ZIPs
10+
*.v*.zip

README.md

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,102 @@
11
morph-models
22
============
33

4-
Models for dealing with standard discrete morphological data.
4+
Models for discrete morphological character data in [BEAST 3](https://github.com/CompEvol/beast3).
55

6-
Aiming at MK and MKv models from Lewis, 2001 (http://sysbio.oxfordjournals.org/content/50/6/913.short)
6+
Implements the Lewis MK and MKv substitution models (Lewis, 2001), along with ordinal and nested ordinal variants for ordered character data.
77

8-
A tutorial is available [here](http://www.beast2.org/morphological-models/)
8+
## Modules
9+
10+
- **beast-morph-models** — core substitution models and alignment classes (depends on `beast-base`)
11+
- **beast-morph-models-fx** — BEAUti integration (depends on `beast-fx`)
12+
13+
## Substitution models
14+
15+
| Class | Description |
16+
|-------|-------------|
17+
| `LewisMK` | Equal or user-specified frequency Mk model |
18+
| `Ordinal` | Tridiagonal rate matrix for ordered characters |
19+
| `NestedOrdinal` | Nested ordinal rate matrix (state 0 transitions to all others) |
20+
21+
## Building
22+
23+
BEAST 3 dependencies are resolved from [GitHub Packages](https://github.com/CompEvol/beast3/packages) (or Maven Central, if published there). For GitHub Packages, add a [personal access token](https://github.com/settings/tokens) (classic) with `read:packages` scope to `~/.m2/settings.xml`:
24+
25+
```xml
26+
<settings>
27+
<servers>
28+
<server>
29+
<id>github</id>
30+
<username>YOUR_GITHUB_USERNAME</username>
31+
<password>YOUR_GITHUB_PAT</password>
32+
</server>
33+
</servers>
34+
</settings>
35+
```
36+
37+
Then build morph-models:
38+
39+
```bash
40+
cd ~/Git/morph-models
41+
mvn compile
42+
mvn test -pl beast-morph-models
43+
```
44+
45+
Alternatively, you can install BEAST 3 from source (no GitHub auth needed):
46+
47+
```bash
48+
cd ~/Git/beast3
49+
mvn install -DskipTests
50+
```
51+
52+
## Running
53+
54+
```bash
55+
# Validate an XML
56+
mvn -pl beast-morph-models exec:exec -Dbeast.args="-validate examples/M3982.xml"
57+
58+
# Run an analysis
59+
mvn -pl beast-morph-models exec:exec -Dbeast.args="-overwrite examples/M3982.xml"
60+
```
61+
62+
## Examples
63+
64+
- `examples/M3982.xml` — Anolis lizard morphological analysis using BEAST 3 spec classes
65+
- `examples/legacy-2.7/` — original BEAST 2.7 XML files (some require external packages)
66+
67+
## Releasing
68+
69+
### ZIP / CBAN
70+
71+
The existing `release.sh` script builds a BEAST package ZIP and optionally
72+
creates a GitHub release for submission to [CBAN](https://github.com/CompEvol/CBAN):
73+
74+
```bash
75+
./release.sh # build ZIP only
76+
./release.sh --release # build ZIP + create GitHub release
77+
```
78+
79+
### Maven Central
80+
81+
```bash
82+
mvn clean deploy -Prelease
83+
```
84+
85+
This builds the JARs (with `version.xml` embedded for service discovery), generates
86+
sources and javadoc JARs, signs everything with GPG, and uploads to Maven Central.
87+
88+
BEAST 3 users can then install with:
89+
90+
```
91+
Package Manager > Install from Maven > io.github.compevol:beast-morph-models:1.3.0
92+
```
93+
94+
Or from the command line:
95+
96+
```bash
97+
packagemanager -maven io.github.compevol:beast-morph-models:1.3.0
98+
```
99+
100+
## References
101+
102+
Lewis, P. O. (2001). A likelihood approach to estimating phylogeny from discrete morphological character data. *Systematic Biology*, 50(6), 913–925.

beast-morph-models-fx/pom.xml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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>morph-models-parent</artifactId>
10+
<version>1.3.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>beast-morph-models-fx</artifactId>
14+
<name>BEAST Morph Models FX</name>
15+
16+
<dependencies>
17+
<!-- Internal -->
18+
<dependency>
19+
<groupId>io.github.compevol</groupId>
20+
<artifactId>beast-morph-models</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 morph-models on module path:
45+
mvn -pl beast-morph-models-fx exec:exec
46+
mvn -pl beast-morph-models-fx exec:exec -Dbeast.main=beast.base.minimal.BeastMain -Dbeast.args="examples/M3982.xml" -->
47+
<plugin>
48+
<groupId>org.codehaus.mojo</groupId>
49+
<artifactId>exec-maven-plugin</artifactId>
50+
<version>3.5.0</version>
51+
<configuration>
52+
<executable>java</executable>
53+
<workingDirectory>${maven.multiModuleProjectDirectory}</workingDirectory>
54+
<commandlineArgs>--module-path %classpath -m beast.fx/${beast.main} ${beast.args}</commandlineArgs>
55+
</configuration>
56+
</plugin>
57+
58+
<!-- Assemble BEAST package ZIP -->
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-assembly-plugin</artifactId>
62+
<version>3.7.1</version>
63+
<configuration>
64+
<descriptors>
65+
<descriptor>src/assembly/beast-package.xml</descriptor>
66+
</descriptors>
67+
<finalName>${beast.pkg.name}.v${beast.pkg.version}</finalName>
68+
<appendAssemblyId>false</appendAssemblyId>
69+
</configuration>
70+
<executions>
71+
<execution>
72+
<id>beast-package</id>
73+
<phase>package</phase>
74+
<goals><goal>single</goal></goals>
75+
</execution>
76+
</executions>
77+
</plugin>
78+
</plugins>
79+
</build>
80+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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-morph-models</include>
26+
<include>io.github.compevol:beast-morph-models-fx</include>
27+
</includes>
28+
</dependencySet>
29+
</dependencySets>
30+
31+
<fileSets>
32+
<!-- fxtemplates/ -->
33+
<fileSet>
34+
<directory>${project.basedir}/src/main/resources/beast.morph.models.fx/fxtemplates</directory>
35+
<outputDirectory>/fxtemplates</outputDirectory>
36+
</fileSet>
37+
<!-- examples/ from project root (excluding legacy directories) -->
38+
<fileSet>
39+
<directory>${project.parent.basedir}/examples</directory>
40+
<outputDirectory>/examples</outputDirectory>
41+
<excludes>
42+
<exclude>legacy*/**</exclude>
43+
</excludes>
44+
</fileSet>
45+
</fileSets>
46+
</assembly>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
open module beast.morph.models.fx {
2+
requires beast.morph.models;
3+
requires beast.base;
4+
requires beast.pkgmgmt;
5+
requires beast.fx;
6+
requires javafx.controls;
7+
8+
exports morphmodels.app.beauti;
9+
10+
provides beast.base.core.BEASTInterface with
11+
morphmodels.app.beauti.BeautiMorphModelAlignmentProvider;
12+
}

src/morphmodels/app/beauti/BeautiMorphModelAlignmentProvider.java renamed to beast-morph-models-fx/src/main/java/morphmodels/app/beauti/BeautiMorphModelAlignmentProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import beastfx.app.inputeditor.BeautiAlignmentProvider;
1212
import beastfx.app.inputeditor.BeautiDoc;
1313
import beastfx.app.util.Alert;
14-
import beastfx.app.util.ExtensionFileFilter;
14+
1515
import beastfx.app.util.FXUtils;
1616
import javafx.scene.control.ButtonType;
1717
import beast.base.core.BEASTInterface;

0 commit comments

Comments
 (0)