Skip to content

Reject GRO stacks with unequal model lengths - #1038

Open
rpinho wants to merge 2 commits into
biotite-dev:mainfrom
rpinho:fix-gro-model-lengths
Open

rpinho wants to merge 2 commits into
biotite-dev:mainfrom
rpinho:fix-gro-model-lengths

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026

Copy link
Copy Markdown

GROFile.get_structure() can copy one atom's coordinates into every atom of a frame when models have different atom counts.
A file with two atoms in its first model and one in its second reproduces the coordinate duplication when read as a stack.
The patch rejects a stack whenever any model's atom count differs from the first, while allowing each model to be read explicitly.
Regression tests cover five atom-count combinations and compare each explicitly selected model with the coordinates stored in the file.

🤖 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 8 benchmarks

2 warnings

⚠️ 22 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

⚠️ 22 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
❌ 8 regressed benchmarks
✅ 89 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-11*11*1*1***111] 522.7 µs 637.4 µs -17.99%
❌ benchmark_match_kmer_selection[KmerTable-None] 526.4 µs 640.3 µs -17.79%
❌ benchmark_match_kmer_selection[BucketKmerTable(10000)-None] 653.5 µs 765.7 µs -14.65%
❌ benchmark_match_kmer_selection[BucketKmerTable(10000)-11*11*1*1***111] 652.7 µs 762.5 µs -14.41%
❌ benchmark_match[KmerTable-None] 623.9 µs 727.6 µs -14.26%
❌ benchmark_match[KmerTable-11*11*1*1***111] 706.2 µs 816.8 µs -13.53%
❌ benchmark_match[BucketKmerTable(10000)-None] 760.6 µs 871.2 µs -12.69%
❌ benchmark_match[BucketKmerTable(10000)-11*11*1*1***111] 838.9 µs 946.8 µs -11.4%
⚡ 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.97%
⚡ benchmark_align_pairwise[align_optimal-score_only] 148.8 ms 107.3 ms +38.7%
⚡ benchmark_indexing_from_kmer_selection[11*11*1*1***111-KmerTable] 15.2 ms 11.4 ms +34.2%
⚡ benchmark_indexing_from_kmer_selection[None-KmerTable] 15.2 ms 11.4 ms +34.19%
⚡ benchmark_indexing_from_kmers[None-KmerTable] 15 ms 11.2 ms +34%
⚡ benchmark_indexing_from_kmers[11*11*1*1***111-KmerTable] 15 ms 11.2 ms +33.84%
⚡ benchmark_get_assembly 835.9 ms 637.4 ms +31.14%
⚡ benchmark_indexing_from_sequences[None-KmerTable] 21.8 ms 17.5 ms +24.53%
⚡ benchmark_cell_list_compute_contacts[MASK] 34.7 ms 28.8 ms +20.35%
⚡ benchmark_indexing_from_sequences[11*11*1*1***111-KmerTable] 36.6 ms 32.2 ms +13.7%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

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-gro-model-lengths (bab5593) 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, the fix looks good, I'd only remove the test.

Comment thread tests/structure/io/test_gro.py Outdated
from tests.util import data_dir


@pytest.mark.parametrize("counts", [(2, 1), (1, 2), (2, 3), (3, 2), (2, 2, 1)])

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.

As the fix is a simple one-liner I, do not think enforcing this behavior warrants a new test.

@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