feat(count): add --reverse-complement to also match RC of guides#30
Open
werner291 wants to merge 1 commit into
Open
feat(count): add --reverse-complement to also match RC of guides#30werner291 wants to merge 1 commit into
werner291 wants to merge 1 commit into
Conversation
Stores guides under canonical form (lex-min of fwd, RC) and probes both orientations on lookup; reads resolving to different guides across orientations count as ambiguous. Palindromes collapse to one entry; canonical collisions across guides evict both. Off by default; output schema unchanged.
54fee3c to
b6df941
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19.
Adds
--reverse-complement/-rtoguide-counter countfor assays whose sequencing primer reads the antisense strand. Off by default; output schema unchanged.Each guide is stored under its canonical form (lex-min of fwd and RC), keeping the lookup the same size as forward-only. Each read window is then looked up under both its forward and reverse-complement forms; if the two probes return different guides, the read counts as ambiguous (
None), otherwise the matching guide wins. (One probe isn't enough because a 1-mismatch hit can live in the 1-mm neighbourhood of either orientation, not just canonical.) Palindromes collapse to one entry; canonical collisions across guides (fwd_A == rc(fwd_B)) evict both. Windows with non-ACGT bytes skip the RC probe.One asymmetry: in forward-only mode, an exact match beats a 1-mismatch via insertion order. In RC mode, an exact fwd-orientation hit on guide A and a 1-mismatch rc-orientation hit on guide B resolve as ambiguous (
None) rather than letting the exact win. Internally consistent, slight sensitivity loss vs. forward-only; happy to add an exact-beats-mismatch tiebreak across orientations if you'd prefer.The matching logic has a few subtle cases (palindromic guides; reads that could plausibly belong to two different guides once you allow a one-base mismatch). I worked through each and added regression tests, but maintainer eyes on the algorithm would be welcome.
Open question
Whether to add a strand-aware count column. The issue does not ask for it and it would break consumers of
*.counts.txt, so v1 keeps the schema; happy to follow up.