Skip to content

Fix to_sequence() chain selection for atom array stacks - #1040

Open
rpinho wants to merge 2 commits into
biotite-dev:mainfrom
rpinho:fix-sequence-stacks
Open

rpinho wants to merge 2 commits into
biotite-dev:mainfrom
rpinho:fix-sequence-stacks

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026

Copy link
Copy Markdown

to_sequence() slices models instead of atoms when extracting chains from an AtomArrayStack.
A stack with peptide chain A and nucleotide chain B raises BadStructureError, while the corresponding AtomArray returns both sequences.
The patch selects chains along the atom axis so that sequence extraction uses each chain's annotations.
Regression tests cover peptide and nucleotide chains, both hetero-residue settings, and stacks with zero, one and two models.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@codspeed

codspeed Bot commented Nov 26, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

2 warnings

⚠️ 15 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚠️ 15 benchmarks with a significant change ran in a different software environment

Their base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the changes might come from this difference rather than from the code. Open an affected benchmark to see what changed.

See affected benchmarks

⚡ 14 improved benchmarks
❌ 1 regressed benchmark
✅ 96 untouched benchmarks
⏩ 14 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ benchmark_match_kmer_selection[KmerTable-None] 526.4 µs 637.7 µs -17.46%
⚡ benchmark_conversion[bond_type_matrix] 3 ms 1.4 ms ×2.2
⚡ benchmark_conversion[adjacency_matrix] 3 ms 1.4 ms ×2.2
⚡ benchmark_align_pairwise[align_local_gapped-score_only] 120.1 ms 81.2 ms +47.98%
⚡ benchmark_align_pairwise[align_optimal-score_only] 148.8 ms 107.4 ms +38.61%
⚡ benchmark_indexing_from_kmer_selection[11*11*1*1***111-KmerTable] 15.2 ms 11.3 ms +34.3%
⚡ benchmark_indexing_from_kmer_selection[None-KmerTable] 15.2 ms 11.4 ms +34.15%
⚡ benchmark_indexing_from_kmers[None-KmerTable] 15 ms 11.2 ms +34.02%
⚡ benchmark_indexing_from_kmers[11*11*1*1***111-KmerTable] 15 ms 11.2 ms +33.85%
⚡ benchmark_get_assembly 835.9 ms 638.1 ms +31.01%
⚡ benchmark_indexing_from_sequences[None-KmerTable] 21.8 ms 17.6 ms +24.16%
⚡ benchmark_cell_list_compute_contacts[MASK] 34.7 ms 28.8 ms +20.34%
⚡ benchmark_indexing_from_sequences[11*11*1*1***111-KmerTable] 36.6 ms 32.2 ms +13.66%
⚡ benchmark_find_connected 975.5 µs 862.9 µs +13.05%
⚡ benchmark_decode 6.4 ms 5.7 ms +11.39%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rpinho:fix-sequence-stacks (337bc99) with main (2effe8f)

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. ↩

@padix-key padix-key left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! But given how simple it is I think we do not need to add an extra test for it.

@rpinho

rpinho commented Nov 27, 2026

Copy link
Copy Markdown
Author

Thanks! I've done this.

This branch has not been deployed

No deployments
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.

2 participants