Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Unit/integration tests
on: [ push, pull_request, workflow_dispatch ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 25
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- run: mvn test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
/.idea
/morph-models.iml
/out

# Maven build output
target/

# Package ZIPs
*.v*.zip
100 changes: 97 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,102 @@
morph-models
============

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

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

A tutorial is available [here](http://www.beast2.org/morphological-models/)
## Modules

- **beast-morph-models** — core substitution models and alignment classes (depends on `beast-base`)
- **beast-morph-models-fx** — BEAUti integration (depends on `beast-fx`)

## Substitution models

| Class | Description |
|-------|-------------|
| `LewisMK` | Equal or user-specified frequency Mk model |
| `Ordinal` | Tridiagonal rate matrix for ordered characters |
| `NestedOrdinal` | Nested ordinal rate matrix (state 0 transitions to all others) |

## Building

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`:

```xml
<settings>
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_PAT</password>
</server>
</servers>
</settings>
```

Then build morph-models:

```bash
cd ~/Git/morph-models
mvn compile
mvn test -pl beast-morph-models
```

Alternatively, you can install BEAST 3 from source (no GitHub auth needed):

```bash
cd ~/Git/beast3
mvn install -DskipTests
```

## Running

```bash
# Validate an XML
mvn -pl beast-morph-models exec:exec -Dbeast.args="-validate examples/M3982.xml"

# Run an analysis
mvn -pl beast-morph-models exec:exec -Dbeast.args="-overwrite examples/M3982.xml"
```

## Examples

- `examples/M3982.xml` — Anolis lizard morphological analysis using BEAST 3 spec classes
- `examples/legacy-2.7/` — original BEAST 2.7 XML files (some require external packages)

## Releasing

### ZIP / CBAN

The existing `release.sh` script builds a BEAST package ZIP and optionally
creates a GitHub release for submission to [CBAN](https://github.com/CompEvol/CBAN):

```bash
./release.sh # build ZIP only
./release.sh --release # build ZIP + create GitHub release
```

### Maven Central

```bash
mvn clean deploy -Prelease
```

This builds the JARs (with `version.xml` embedded for service discovery), generates
sources and javadoc JARs, signs everything with GPG, and uploads to Maven Central.

BEAST 3 users can then install with:

```
Package Manager > Install from Maven > io.github.compevol:beast-morph-models:1.3.0
```

Or from the command line:

```bash
packagemanager -maven io.github.compevol:beast-morph-models:1.3.0
```

## References

Lewis, P. O. (2001). A likelihood approach to estimating phylogeny from discrete morphological character data. *Systematic Biology*, 50(6), 913–925.
80 changes: 80 additions & 0 deletions beast-morph-models-fx/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.github.compevol</groupId>
<artifactId>morph-models-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>

<artifactId>beast-morph-models-fx</artifactId>
<name>BEAST Morph Models FX</name>

<dependencies>
<!-- Internal -->
<dependency>
<groupId>io.github.compevol</groupId>
<artifactId>beast-morph-models</artifactId>
</dependency>
<dependency>
<groupId>io.github.compevol</groupId>
<artifactId>beast-base</artifactId>
</dependency>
<dependency>
<groupId>io.github.compevol</groupId>
<artifactId>beast-fx</artifactId>
</dependency>
<dependency>
<groupId>io.github.compevol</groupId>
<artifactId>beast-pkgmgmt</artifactId>
</dependency>

<!-- JavaFX -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Run BEAUti with morph-models on module path:
mvn -pl beast-morph-models-fx exec:exec
mvn -pl beast-morph-models-fx exec:exec -Dbeast.main=beast.base.minimal.BeastMain -Dbeast.args="examples/M3982.xml" -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<executable>java</executable>
<workingDirectory>${maven.multiModuleProjectDirectory}</workingDirectory>
<commandlineArgs>--module-path %classpath -m beast.fx/${beast.main} ${beast.args}</commandlineArgs>
</configuration>
</plugin>

<!-- Assemble BEAST package ZIP -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/beast-package.xml</descriptor>
</descriptors>
<finalName>${beast.pkg.name}.v${beast.pkg.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>beast-package</id>
<phase>package</phase>
<goals><goal>single</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
46 changes: 46 additions & 0 deletions beast-morph-models-fx/src/assembly/beast-package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>beast-package</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<!-- version.xml from project root -->
<files>
<file>
<source>${project.parent.basedir}/version.xml</source>
<outputDirectory>/</outputDirectory>
</file>
</files>

<!-- Module JARs only (BEAST core, JavaFX, and their transitive deps are provided by the runtime) -->
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
<includes>
<include>io.github.compevol:beast-morph-models</include>
<include>io.github.compevol:beast-morph-models-fx</include>
</includes>
</dependencySet>
</dependencySets>

<fileSets>
<!-- fxtemplates/ -->
<fileSet>
<directory>${project.basedir}/src/main/resources/beast.morph.models.fx/fxtemplates</directory>
<outputDirectory>/fxtemplates</outputDirectory>
</fileSet>
<!-- examples/ from project root (excluding legacy directories) -->
<fileSet>
<directory>${project.parent.basedir}/examples</directory>
<outputDirectory>/examples</outputDirectory>
<excludes>
<exclude>legacy*/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
12 changes: 12 additions & 0 deletions beast-morph-models-fx/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
open module beast.morph.models.fx {
requires beast.morph.models;
requires beast.base;
requires beast.pkgmgmt;
requires beast.fx;
requires javafx.controls;

exports morphmodels.app.beauti;

provides beast.base.core.BEASTInterface with
morphmodels.app.beauti.BeautiMorphModelAlignmentProvider;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import beastfx.app.inputeditor.BeautiAlignmentProvider;
import beastfx.app.inputeditor.BeautiDoc;
import beastfx.app.util.Alert;
import beastfx.app.util.ExtensionFileFilter;

import beastfx.app.util.FXUtils;
import javafx.scene.control.ButtonType;
import beast.base.core.BEASTInterface;
Expand Down
Loading