Skip to content

fix: locateVariants no longer silently drops intronic variants (#87)#98

Open
jmg421 wants to merge 1 commit into
Bioconductor:develfrom
jmg421:fix/87-locateVariants-intronic
Open

fix: locateVariants no longer silently drops intronic variants (#87)#98
jmg421 wants to merge 1 commit into
Bioconductor:develfrom
jmg421:fix/87-locateVariants-intronic

Conversation

@jmg421

@jmg421 jmg421 commented Jul 1, 2026

Copy link
Copy Markdown

Summary

Fixes #87 (and the earlier #76).

locateVariants() silently returned 0 hits for variants that overlap intronic regions when the TxDb contains transcripts with empty feature sets (e.g., single-exon non-coding RNAs with no intron records).

Root Cause

All six internal cache-population sites in methods-locateVariants.R stored the raw GRangesList from cdsBy(), intronsByTranscript(), etc. without filtering out empty list elements. mapToTranscripts() (via findOverlaps(type="within")) behaves unexpectedly when the subject contains empty elements — variants that should match are silently dropped.

Fix

Add z[lengths(z) > 0L] filtering at every cache-fill site:

  • cdsbytx (CodingVariants)
  • intbytx (IntronVariants, SpliceSiteVariants)
  • threeUTRbytx (ThreeUTRVariants)
  • fiveUTRbytx (FiveUTRVariants)
  • txbygene (IntergenicVariants)
  • UTR construction in the AllVariants method

Testing

  • Added unit test test_locateVariants_emptyGRangesList_issue87 that creates a synthetic GRangesList with an empty element and verifies that variants in valid introns are still found.
  • Also tests the exact reproducer from the issue (chr22 SNPs against TxDb.Hsapiens.UCSC.hg19.knownGene) when the annotation package is available.

What was verified

@vjcitn

vjcitn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for this. Have you acknowledged which agentic systems were used for this PR? We are developing guidelines for this process. I think it would be good to have this information in the text of the PR commentary.

@jmg421

jmg421 commented Jul 1, 2026

Copy link
Copy Markdown
Author

Thanks Vince. Yes — this PR was produced with the assistance of two agentic CLI tools:

  1. Kiro CLI (Amazon's AI coding agent) — used for code exploration, writing the fix, and composing the PR
  2. Jarvis CLI — a custom agentic tool I built that identifies issues, reads codebases, and drafts fixes

In both cases I review the diffs, understand the reasoning behind each change, and verify correctness before submitting. Happy to include this disclosure in future PR descriptions as standard practice — let me know if you'd like a specific format.

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.

locateVariants failing on intronic variants

2 participants