Add capture-interval file filtering on top of existing collection predicates

Open
#59 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by tracing the VariantCollection filtering entry point and reviewing the issue's interval_list example. Define how the list file is parsed and how variants are retained when they fall within capture targets; done means a VariantCollection can be filtered using this format and the behavior is covered by tests.

Written by the indexing model from the issue text.

Description

Current status (2026-10-26)

The generic filtering API proposed in the comments is available: VariantCollection.filter(predicate) returns a filtered collection, and gene/transcript expression filters are also implemented in VariantCollection. A local two-variant replay confirmed predicate filtering retains the selected variant and its source metadata.

The missing feature is the capture-target file adapter and its overlap semantics. No built-in Picard/GATK .interval_list reader was found in the current package.

Remaining acceptance: parse the declared interval format and reference dictionary; validate coordinate conventions and reference/contig compatibility; define overlap versus full-containment behavior for SNVs, deletions and zero-width insertions; specify how SV spans and breakend mates are evaluated; retain collection metadata. If BED is added, treat its coordinates explicitly rather than reusing .interval_list parsing implicitly. Keep this issue focused on the file-backed adapter, not reimplementation of generic filtering.

Original request

For some of our analyses it would be helpful to be able to filter a VariantCollection to only those variants that fall within the intended capture targets.

Example intervals list:

[odonnt02@minerva4 ~]$ head /sc/orga/projects/ngs/resources/captures/2.3/Human_All_Exon_V5.hg19.interval_list
@HD     VN:1.4  SO:unsorted
@SQ     SN:chrM LN:16571        UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:d2ed829b8a1628d16cbeee88e88e39eb
@SQ     SN:chr1 LN:249250621    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:1b22b98cdeb4a9304cb5d48026a85128
@SQ     SN:chr2 LN:243199373    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:a0d9851da00400dec1098a9255ac712e
@SQ     SN:chr3 LN:198022430    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:641e4338fa8d52a5b781bd2a2c08d3c3
@SQ     SN:chr4 LN:191154276    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:23dccd106897542ad87d2765d28a19a1
@SQ     SN:chr5 LN:180915260    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:0740173db9ffd264d728f32784845cd7
@SQ     SN:chr6 LN:171115067    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:1d3a93a248d92a729ee764823acbbc6b
@SQ     SN:chr7 LN:159138663    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:618366e953d6aaad97dbe4777c29375e
@SQ     SN:chr8 LN:146364022    UR:file:/gs01/projects/ngs/resources/gatk/2.3/ucsc.hg19.parmasked.fasta M5:96f514a9929e410c6651697bded59aec

GATK also supports a few other formats (probably not needed here though): https://www.broadinstitute.org/gatk/guide/article?id=1319

Dominant language
Python
Stars
88
Forks
28
Avg merge
3h 10m
Merged PRs (30d)
53

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openvax/varcode

All issues in openvax/varcode

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.