Repository navigation
Fix SequenceProfile.to_consensus() for RNA alphabet - #991
Conversation
Merging this PR will regress 5 benchmarks1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
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.
d885987 to
cd2106b
Compare
For a profile with an RNA alphabet (
A,C,G,U),SequenceProfile.to_consensus()always raised anAlphabetError: The consensus string was built withU, but the returnedNucleotideSequencecannot encodeU.As
NucleotideSequencerepresents both DNA and RNA and usesTfor uracil, RNA profiles now use the same code path as DNA profiles, and the then unused_rna_to_consensus()is removed. The docstring mentions theTrepresentation.The existing nucleotide consensus tests are parametrized over the DNA and RNA alphabet. The new RNA cases fail without this fix.
Authored by Claude