Skip to content

Load the whole analysis when a BEAST XML file is dropped on BEAUti (#141) - #142

Merged
walterxie merged 1 commit into
masterfrom
dragdrop-xml-141
Aug 13, 2026
Merged

Load the whole analysis when a BEAST XML file is dropped on BEAUti (#141)#142
walterxie merged 1 commit into
masterfrom
dragdrop-xml-141

Conversation

@alexeid

@alexeid alexeid commented Aug 13, 2026

Copy link
Copy Markdown
Member

Fixes #141.

Dropping an XML file on BEAUti imported its alignment only: every dropped file went
to the alignment importers, and XMLImporter pulls just the alignment out of a BEAST
XML, so the model and MCMC settings were discarded.

What changed

  • BeautiDoc.isBeautiAnalysisFile(File) sniffs a file for the beautitemplate attribute
    on its top level element -- the same marker extractSequences uses to pick a template.
    That is what tells a BEAUti generated analysis apart from an alignment file.
  • Dropped files that pass that test are loaded exactly the way File/Load loads them
    (newAnalysis + loadXML), so model and MCMC settings come back. Anything else still
    goes to the alignment importers, so dropping NEXUS/FASTA/BEAST1 files is unchanged.
  • Drops are accepted anywhere on the BEAUti window, not only on the partitions table.
    Dropping a non-analysis file outside the partitions table now says where alignments go
    instead of silently doing nothing.
  • The File/Load body moved into BeautiTabPane.loadFile(File) so the menu and drag and drop
    share one code path (save buttons enabled, window title, error dialog).
  • If several files are dropped, only the first analysis is loaded (loading one replaces
    everything else) and BEAUti says so. If an analysis is already loaded, it asks before
    replacing it -- easy to drop a file by accident, less so to pick File/Load by accident.
  • Loading is posted to the FX thread with Platform.runLater, because it rebuilds every
    panel including the one the drop came from.

Testing

  • DragAndDropXMLTest sets up an analysis (HKY, non-default chain length), saves it,
    starts a new analysis and then drops the saved file: the alignment, the site model and
    the chain length all come back.
  • BeautiAnalysisFileTest covers the file sniffing: BEAUti XML, BEAST XML without
    beautitemplate, NEXUS, missing file.
  • Full beast-fx suite passes.
  • Native drag and drop itself cannot be driven from TestFX, so the actual drag still wants
    a manual check: drop a saved analysis on various tabs, drop a NEXUS file on the partitions
    table, drop a non-BEAUti XML.

Dropping an XML file on BEAUti used to import its alignment only, because every
dropped file went to the alignment importers and XMLImporter extracts just the
alignment from a BEAST XML. Files that carry a beautitemplate attribute, i.e.
analyses generated by BEAUti, are now loaded the way File/Load loads them, so
model and MCMC settings come along.

Drops are also accepted anywhere on the BEAUti window rather than only on the
partitions table, and the File/Load handler moved into BeautiTabPane.loadFile
so both entry points share it.
@walterxie
walterxie merged commit 0480916 into master Aug 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quality of life improvment: dragging and dropping XML files onto beauti

2 participants