Skip to content

Remove Tree and TreeNode class - #944

Merged
padix-key merged 1 commit into
biotite-dev:v2from
padix-key:phylo-networkx
Sep 23, 2026
Merged

padix-key merged 1 commit into
biotite-dev:v2from
padix-key:phylo-networkx

Conversation

@padix-key

@padix-key padix-key commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

This PR migrates biotite.sequence.phylo.neighbor_joining, biotite.sequence.phylo.upgma and biotite.sequence.align.align_multiple to networkx.DiGraph, making Tree/TreeNode obsolete. Hence Tree/TreeNode are removed.

Furthermore the functions above are refactored from Cython modules into Python and Rust modules. As these are the only remaining Cython modules, the Cython setup is removed from Biotite.

Resolves #903.

@padix-key
padix-key force-pushed the phylo-networkx branch 4 times, most recently from bca5c1d to 9d35734 Compare September 22, 2026 20:52
@padix-key
padix-key marked this pull request as ready for review September 22, 2026 20:53
@codspeed

codspeed Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 50.54%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 8 improved benchmarks
❌ 2 (👁 2) regressed benchmarks
✅ 99 untouched benchmarks
⏩ 14 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ benchmark_set_structure[cif-False] 92.9 ms 31.6 ms ×2.9
⚡ benchmark_set_structure[cif-True] 103.5 ms 41.7 ms ×2.5
⚡ benchmark_connect[connect_via_distances] 3.2 ms 1.7 ms +86.5%
⚡ benchmark_serialize_pdbx[cif] 177.7 ms 120.4 ms +47.58%
⚡ benchmark_infer_bond_types 1,203 µs 827.2 µs +45.44%
⚡ benchmark_clustering[neighbor_joining] 557.7 µs 394 µs +41.54%
⚡ benchmark_set_structure 9.4 ms 7 ms +35.58%
⚡ benchmark_set_structure_with_bonds 9.6 ms 7.2 ms +34.53%
👁 benchmark_match_kmer_selection[KmerTable-None] 246.2 µs 278.6 µs -11.64%
👁 benchmark_match[KmerTable-None] 294 µs 327.6 µs -10.28%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing padix-key:phylo-networkx (5139a12) with main (1aaf784)

Open in CodSpeed

Footnotes

  1. 14 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Trees are now represented as rooted `networkx.DiGraph` objects with
integer leaf nodes and a `distance` edge attribute, replacing the
Cython `Tree` and `TreeNode` classes.
UPGMA and neighbor joining are implemented in Rust, with UPGMA tracking
the row minima to avoid rescanning the entire distance matrix.
The Newick parser is iterative, hence deeply nested trees no longer hit
the recursion limit.

Closes biotite-dev#903, closes biotite-dev#397
@padix-key
padix-key merged commit 876ce47 into biotite-dev:v2 Sep 23, 2026
25 checks passed

This branch was successfully deployed

1 active deployment
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.

1 participant