openvax / openvax/varcode

UCSC unplaced contigs (chrUn_gl000216) aren't mapped, and one aborts annotation of the whole VCF

Open
#435 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
87
Forks
28
Avg merge
3h 27m
Merged PRs (30d)
27

Description

Unplaced UCSC contigs (chrUn_gl000216) aren't mapped to Ensembl names, and one such record aborts annotation of the whole VCF.

tests/data/strelka-example.vcf (hg19) has 20 records, two on unplaced contigs:

chrUn_gl000216  76018  .  T             TTTGGG
chrUn_gl000226  1680   .  GACGTATGCACT  G

Both CLI commands fail on it, as does plain load_vcf(...).effects() or .to_dataframe():

$ varcode --vcf tests/data/strelka-example.vcf
...
  File ".../varcode/variant.py", line 422, in gene_ids
    self._check_that_genome_has_contig()
  File ".../varcode/variant.py", line 370, in _check_that_genome_has_contig
ValueError: Invalid contig name 'chrUn_gl000216' for reference 'GRCh37'
$ varcode-genes --vcf tests/data/strelka-example.vcf      # same error from VariantCollection.to_dataframe()

Two problems:

  1. No UCSC-to-Ensembl mapping for unplaced or random contigs. _convert_ucsc_contig_name_to_ensembl (varcode/variant.py:591) deliberately skips names containing _. Ensembl 75 does have GL000216.1 (with one gene), and Ensembl 115 has GL000216.2. hg19 chrUn_gl000216 and chr1_gl000191_random correspond to Ensembl GL000216.1 and GL000191.1, and hg38 chrUn_KI270438v1 corresponds to KI270438.1.
  2. A contig missing from the genome is fatal for the whole collection. chrUn_gl000226 has no Ensembl GRCh37 contig at all. Alt-haplotype contigs such as chr6_apd_hap1 and decoys such as chrUn_JTFH... are common in real hg38 VCFs. One such record kills VariantCollection.effects() and to_dataframe(), and with them both CLI commands.

Expected: map the UCSC unplaced and random names to their Ensembl accessions. For contigs the genome lacks, warn once (2 variants on contigs not in GRCh37: chrUn_gl000226, ...) and annotate them as Intergenic or skip them, instead of raising.

Contributor guide

Open the contributing guide

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.

Research direction

Start in varcode/variant.py at _convert_ucsc_contig_name_to_ensembl, _check_that_genome_has_contig, and the VariantCollection effects/to_dataframe paths. Reproduce the failure with tests/data/strelka-example.vcf using both CLI commands and load_vcf(...).effects(). Done means unplaced and random UCSC contigs map to Ensembl accessions, while absent contigs produce one warning and are annotated as Intergenic or skipped without aborting the collection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.