Skip to content

Fix reverse complement calculation in CDSSequence.getCodingSequence (#1016) - #1160

Merged
josemduarte merged 1 commit into
biojava:masterfrom
nayanhasnolyf:fix/cds-sequence-reverse-complement-1016
Nov 24, 2026
Merged

josemduarte merged 1 commit into
biojava:masterfrom
nayanhasnolyf:fix/cds-sequence-reverse-complement-1016

Conversation

@nayanhasnolyf

@nayanhasnolyf nayanhasnolyf commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1016

CDSSequence.getCodingSequence() was calling getSequenceAsString(getBioBegin(), getBioEnd(), getStrand()), which already returns the reverse complement for Strand.NEGATIVE via AbstractLocation.reverseSequence(). After that, getCodingSequence() had a second if (getStrand() == Strand.NEGATIVE) block that complemented the sequence again, cancelling out the complement and leaving the sequence only reversed.

Removed the redundant second complement block in CDSSequence.java and enabled the existing @Disabled test TranscriptSequenceTest.getCDNASeqNegativeStrand().

…iojava#1016)

Signed-off-by: Nayan Pokhriyal <nayanpokhriyal25@gmail.com>

@josemduarte josemduarte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks!

@josemduarte
josemduarte merged commit eb1882d into biojava:master Nov 24, 2026
5 checks passed
josemduarte added a commit that referenced this pull request Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

o.b.n.core.sequence.CDSSequence doesn't reverse-complement correctly

2 participants