Repository navigation
Convert 12 BEAST2 examples to BEAST3 (batch 2); ship SeqGen examples in beast-fx - #204
Conversation
…in beast-fx Converts testRandomLocalClock, testRelaxedClock, testUCLNclock.json, testTipDates, testTipDates2, testSRD06, testMultipleAlignments_randomTaxaOrder, testDirectSimulator, testDirectSimulator2, testDirectSimulatorHierarchical, testSeqGen and testSimulatedAlignment from examples/legacy. Each file starts with a comment listing its differences from the original; MIGRATION-REPORT-batch2.md has the full report. - testSeqGen / testSimulatedAlignment need beast-fx classes, so they live in beast-fx/src/test/resources/beast.fx/examples and ship as examples/beastfx/ (BEAST.app package zip + Linux/Windows/Mac release scripts). - SequenceSimulator / SimulatedAlignment: branchRateModel input takes the BEAST3 branch rate model Base, so BEAST3 clock models are accepted. - legacy/testSRD06.xml: comment out two unused state nodes (removed in BEAST3).
alexeid
left a comment
There was a problem hiding this comment.
Thanks Walter, careful conversions, and good to have the seqgen examples shipping. Since you opened this we've decided the examples must not use improper priors (see #199 and CompEvol/beast2#1225 for what we did with batch 1). Requests:
- Proper priors, in both versions. testRandomLocalClock (kappa, popSize, rates), testRelaxedClock (kappa, popSize, ucld.stdev) and testTipDates (clockRate) have estimated parameters with no prior. The
LogUniform[1e-8, 1e8]stand-ins forOneOnXshould go too. Batch 1 uses LogNormal(M=0, S=8) for rates and sizes and LogNormal(1, 1.25) for kappa. The BEAST 2 originals need the same change, in a beast2 PR like CompEvol/beast2#1225. - Slide sizes. Start
BactrianSubtreeSlideat its tuned size, not 1.0. On substitution-scale trees, 1.0 never tunes down within a run (#200). - Posterior comparison against 2.7.9 (steps 2–4), after 1, since the priors change the posteriors.
- SequenceSimulator / SimulatedAlignment:
Input<BranchRateModel>instead of the specBasewould keep legacy clocks in BEAST 2 XML working, since the class only uses the interface. - Could someone run the changed release scripts end to end before the next RC?
…odel input Review requests from alexeid on #204: 1. Proper priors, in both versions (BEAST 3 examples and the BEAST 2 files in legacy/), as in #199 and BEAUti's defaults (#208): LogNormal(0, 8) for rates and sizes, LogNormal(1, 1.25) for kappa. Replaces the improper flat, OneOnX and Uniform(0, Infinity) priors, and the LogUniform stand-ins. 2. BactrianSubtreeSlide starts at its tuned size (BEAST 3 runs, acceptance about 0.3) instead of 1.0. The sizes are kept rather than BEAUti's new 0.01 (#201); each file's comment says why. 4. SequenceSimulator / SimulatedAlignment: branchRateModel takes the BranchRateModel interface, so legacy clocks are accepted too. Also: - Move the BEAST 2 seqgen files to beast.fx/examples/legacy/, next to their BEAST 3 conversions (they need beast-fx classes). - legacy/README.md: the legacy/ files are BEAST 2 XML, not converted, and must still run in BEAST 2.8.x with the old (deprecated) classes. - Test that the legacy examples still parse: a new method in beast-base's ExampleXmlParsingTest, and a beast-fx ExampleXmlParsingTest for the beast-fx examples and their legacy sources. - Update MIGRATION-REPORT-batch2.md; add TODO-migrate-legacy-xmls-batch2.md for the open requests (3: posterior comparison with 2.7.9; 5: release scripts end to end).
alexeid
left a comment
There was a problem hiding this comment.
Thanks Walter, approving. Points 1, 2 and 4 look good: no estimated parameter is left with an improper prior (ucld.mean has none, but it's fixed), the tuned slide sizes are in, and the seqgen input accepts legacy clocks.
On 1: your proper priors are in the legacy/ copies rather than the beast2 repo's originals. For the comparison (3) that's fine. I ran all six edited legacy files in BEAST 2.7.9 and they run cleanly, so they can serve as the BEAST 2 reference. The comparison write-up should just say these are the reference files, rather than the v2.7.8 originals the beast3-test README points to.
One small thing for later: the package assembly only includes examples/*.xml, so the JSON examples (testUCLNclock.json here, and the existing testHKY.json) don't ship.
The BEAST.base package assembly included only *.xml examples, so the two JSON-format examples were left out of the package zip and hence of every installer (the release scripts extract examples/ from that zip).
#204 added 8 examples that use BactrianSubtreeSlide with tuned sizes (testMultipleAlignments_randomTaxaOrder, testRandomLocalClock, testRelaxedClock, testSRD06, testTipDates, testTipDates2, testUCLNclock.json and beast-fx testSimulatedAlignment). Switch them to BactrianSubtreeScale with no size, and rewrite their conversion comments to match. Note the switch in MIGRATION-REPORT-batch2.md, keeping the tuned slide sizes as a record. CHANGELOG: list BactrianSubtreeScale as a new operator and as part of BEAUti's default tree operator set. migration-guide: the recommended new operator set uses it without a size.
Converts 12 BEAST 2 examples to BEAST 3. The full write-up is in
MIGRATION-REPORT-batch2.md.testRandomLocalClock,testRelaxedClock,testUCLNclock.jsontestTipDates,testTipDates2,testSRD06,testMultipleAlignments_randomTaxaOrdertestDirectSimulator,testDirectSimulator2,testDirectSimulatorHierarchical,testSeqGen,testSimulatedAlignmentEach file keeps the original's data, weights and loggers. A comment at the top of each file lists its proper priors and the changes made by the conversion.
Review requests
Input<BranchRateModel>inSequenceSimulator/SimulatedAlignmentProper priors (BEAST 2 and BEAST 3)
This is a change to the model, made in both the BEAST 3 files and their BEAST 2 sources in
legacy/. It follows #199 and BEAUti's defaults (#208):LogNormal(M = 0, S = 8)in log space;LogNormal(1, 1.25).Changes made by the conversion
SubtreeSlide→kernel.BactrianSubtreeSlide. Each slide starts at its tuned size, from BEAST 3 runs with acceptance about 0.3. The sizes run from 6×10⁻⁵ (testSimulatedAlignment) and 0.008–0.73 to 21000–27000 (testMultipleAlignments, whose trees are in years).offset="0.0"is dropped, since an offset of 0 is no shift. BEAST 3 applies a non-zero offset by wrapping the distribution inOffsetReal/OffsetInt.Inputeach parameter feeds, using the narrowest when it feeds several. Upper bounds are not kept.RandomLocalClockModelrates/indicatorsbecome vectors. BEAST 2 resized them per branch at start-up.legacy/.Where the files are
examples/legacy/<file>→examples/<file>.beast-fx/src/test/resources/beast.fx/examples/, with their BEAST 2 sources moved tobeast.fx/examples/legacy/. They ship asexamples/beastfx/:release/{Linux,Windows}/assemble-bundle.shandrelease/Mac/build-sign-dmg.shextract them;testHKY.jsonandtestUCLNclock.jsonnow ship in the release:beast-base/src/assembly/package.xmlincluded only*.xml, so both were missing from the BEAST.base package zip and hence from every installer. Checked: both are in the rebuilt zip'sexamples/, and both passbin/beast -validate.legacy/README.md: thelegacy/files are BEAST 2 XML, not converted, and must still run in BEAST 2.8.x with the old, deprecated, classes (until their removal in 3.0.0).Java changes
SequenceSimulatorandSimulatedAlignment:branchRateModeltakes theBranchRateModelinterface, so both BEAST 3 and legacy clocks are accepted. TheirsiteModelinput still takes only the BEAST 3SiteModel, so a plain BEAST 2 seqgen XML still does not run in BEAST 3.Tests
ExampleXmlParsingTest: new methodtest_ThatLegacyXmlExamplesParseparses every XML/JSON directly inbeast.base/examples/legacy/(41 files) in BEAST 2.8.ExampleXmlParsingTest: parses and runsbeast.fx/examples, and parsesbeast.fx/examples/legacy.Validation (after merging master)
bin/beast -validate/bin/beast-fx -validate, all 12 BEAST 3 files-validate) / BEAST 2.7.7 (-validate, beast-base ones)ExampleDeprecationTest(#199) and the new legacy testExampleXmlParsingTestNot in this PR: the posterior comparison against BEAST 2.7.9 (request 3) and the end-to-end run of the changed release scripts (request 5) will be handled in a separate GitHub issue. Open items are listed in
TODO-migrate-legacy-xmls-batch2.md.Bug found: #205 (fixed in #206)
JSONProducerwrote parameter domains in a form BEAST 3 could not read back. This was reported in #205 and fixed in #206 (merged).testUCLNclock.jsonwas written by hand before the fix.