baltic v1.0.0 (Cedar) released#
Published
baltic 1.0.0 is a major, intentionally backwards-incompatible release. Compared with the previous PyPI release, 0.3.0, it reorganizes the package into focused modules, modernizes the public API, and adds a broad set of tree-manipulation, analysis, and visualization tools.
Highlights#
Reorganized the former monolithic implementation into dedicated modules for trees, branch types, I/O, utilities, advanced visualizations, and posterior-tree processing.
Added an explicit tree model:
Treeand parsing functions now requiretreeType="divergence"ortreeType="time".Standardized most public classes and methods on
PascalCaseandsnake_casenames.Added rerooting, midpoint rooting, continuous root-to-tip regression rooting, tree rescaling, tree reduction, tree condensation, and trait-based tree explosion.
Unified rectangular, circular, and unrooted rendering behind
plot_tree(),plot_points(), andplot_text().Added advanced visualisation support for tanglegrams, tangled tree chains, Muller plots, skygrids, root-to-tip regressions, maps, SNP alignments, reticulations, uncertainty intervals, gradient clades, and tree-plus-matrix plots.
Added import and export support for Auspice v2 JSON, including Nextstrain-hosted datasets.
Rebuilt and substantially expanded the documentation, API reference, examples, and plotting tutorials.
Breaking changes and migration#
The 0.3.0 API is not backwards-compatible with 1.0.0. Common migrations include:
0.3.0 |
1.0.0 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`tree.plot_tree(…, treeType=”rectangular” |
|
|
|
|
Loader functions remain re-exported at package level, but new code should use the explicit bt.io namespace shown above.
Minimal 1.0.0 usage:
import baltic as bt
tree = bt.make_tree(
"((A:1.0,B:2.0):1.0,C:3.0);",
treeType="divergence",
)
nexus_tree = bt.io.load_nexus(
"example.tree",
treeType="time",
)
Added#
Tree model and manipulation#
Introduced
BranchLikeas the shared base class forNode,Leaf,Clade, andReticulation.Added branch path and sibling helpers with
get_path_to_root()andget_siblings().Added
get_leaf()for exact single-tip lookup and expandedfind_MRCA()to accept tip names or branch objects as separate arguments.Added
reroot(),midpoint_root(), androot_by_regression(). The new regression implementation uses a continuous closed-form edge search, supports uncertain tip dates, and retains the earlier search asroot_by_regression_legacy().Added
rescale(),reduce_tree(),condense_tree(),explode_tree(), andstate_collapse_tree().Added dictionary-based tree statistics through
treeStatsDict().Added export to Auspice v2 JSON with
to_auspice_json().
Plotting and analysis#
Added unified rectangular, circular, and unrooted layouts for trees, points, and labels.
Added aligned tip labels, exploded-tree plotting, collapsed-clade rendering, scale bars, and calendar or numeric deep-time grids.
Added node probability bars, treemaps, pie charts, TMRCA posterior plots, and highest-posterior-density utilities.
Added tanglegrams and tangled chains for comparing tree topologies.
Added root-to-tip, skygrid, Muller, map-connection, reassortment/reticulation, SNP-alignment, gradient-clade, and tree-matrix visualizations.
Added colour-map construction and desaturation helpers, Bezier helpers, path effects, and scientific-notation formatting.
Input, output, and posterior processing#
Added a dedicated
baltic.iomodule with Newick, Nexus, and Auspice JSON loaders plus explicit tip-date processing.Added support for partially specified sampling dates, BEAST 2 Boolean annotations, and travel-aware phylogeographic trees.
Added posterior-tree iteration and multiprocessing helpers in
baltic.samogitiafor lineage-state tracing, TMRCA extraction, and tree-length processing.Added logging throughout the package in place of most ad hoc diagnostic output.
Changed#
Tree branch-length semantics are now explicit through
treeType; only"divergence"and"time"are accepted.Public loaders and most tree operations now use PEP 8-style names and more consistent callback arguments.
Topology-only trees without branch lengths are handled by assigning ultrametric branch lengths with a total height of 1.0.
Tree parsing and annotation handling were made more robust for Newick, Nexus, BEAST, and Auspice inputs.
Circular, unrooted, and rectangular plotting now share a common API and styling model based on fixed values or callback functions.
Runtime dependencies now include
scipyandrequests, in addition tonumpyandmatplotlib.
Fixed#
Corrected circular and unrooted coordinate generation and plotting behavior.
Fixed subtree extraction when
stem=Falseand strengthenedreduce_tree()validation.Fixed Auspice JSON import behavior and added reliable round-trip export support.
Fixed tree-to-map connections, branch sorting and auto-sorting interactions, TMRCA and SNP-alignment plotting, uncertain-date assignment, and several
samogitiaworkflows.Improved handling of trees with missing branch lengths, Nexus tip names, rerooting edge cases, and root-to-tip regression.