Skip to content

Fix SequenceProfile.to_consensus() for RNA alphabet - #991

Merged
padix-key merged 1 commit into
biotite-dev:mainfrom
padix-key:fix/profile-rna-consensus
Nov 11, 2026
Merged

padix-key merged 1 commit into
biotite-dev:mainfrom
padix-key:fix/profile-rna-consensus

Conversation

@padix-key

@padix-key padix-key commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

For a profile with an RNA alphabet (A, C, G, U), SequenceProfile.to_consensus() always raised an AlphabetError: The consensus string was built with U, but the returned NucleotideSequence cannot encode U.

As NucleotideSequence represents both DNA and RNA and uses T for uracil, RNA profiles now use the same code path as DNA profiles, and the then unused _rna_to_consensus() is removed. The docstring mentions the T representation.

The existing nucleotide consensus tests are parametrized over the DNA and RNA alphabet. The new RNA cases fail without this fix.

Authored by Claude

@codspeed

codspeed Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 5 benchmarks

1 warning

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

⚡ 4 improved benchmarks
❌ 5 regressed benchmarks
✅ 102 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[BucketKmerTable(10000)-None] 655.1 µs 770.7 µs -15%
❌ benchmark_match[BucketKmerTable(10000)-None] 763.6 µs 880.4 µs -13.26%
❌ benchmark_match[BucketKmerTable(10000)-11*11*1*1***111] 839.8 µs 959.4 µs -12.47%
❌ benchmark_cell_list_compute_contacts[PAIRS] 22.6 ms 25.8 ms -12.43%
❌ benchmark_cell_list_compute_contacts[MAPPING] 23.5 ms 26.7 ms -12.01%
⚡ benchmark_structural_alphabet_methods[to_3di] 21.2 ms 14.1 ms +50.24%
⚡ benchmark_superimpose[superimpose_structural_homologs] 45 ms 35.8 ms +25.82%
⚡ benchmark_match_kmer_selection[KmerTable-11*11*1*1***111] 640.8 µs 521.9 µs +22.79%
⚡ benchmark_match[KmerTable-11*11*1*1***111] 825.8 µs 709.1 µs +16.45%

Tip

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


Comparing padix-key:fix/profile-rna-consensus (cd2106b) with main (d46cc4e)2

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

  2. No successful run was found on main (5eaa9e3) during the generation of this report, so d46cc4e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

The consensus was built from a string containing 'U', which
`NucleotideSequence` cannot encode, so an AlphabetError was always raised.
As `NucleotideSequence` represents uracil as 'T', the DNA consensus code
path is used for RNA profiles as well.
@padix-key
padix-key force-pushed the fix/profile-rna-consensus branch from d885987 to cd2106b Compare November 10, 2026 18:36
@padix-key
padix-key merged commit 2effe8f into biotite-dev:main Nov 11, 2026
32 of 33 checks passed

This branch was previously deployed

1 inactive deployment
publish — cd2106b5 Deployed Nov 10, 2026 by padix-key via Upload package to GitHub Releases & PyPI #1564
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