UCSC unplaced contigs (chrUn_gl000216) aren't mapped, and one aborts annotation of the whole VCF
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:
- 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 haveGL000216.1(with one gene), and Ensembl 115 hasGL000216.2. hg19chrUn_gl000216andchr1_gl000191_randomcorrespond to EnsemblGL000216.1andGL000191.1, and hg38chrUn_KI270438v1corresponds toKI270438.1. - A contig missing from the genome is fatal for the whole collection.
chrUn_gl000226has no Ensembl GRCh37 contig at all. Alt-haplotype contigs such aschr6_apd_hap1and decoys such aschrUn_JTFH...are common in real hg38 VCFs. One such record killsVariantCollection.effects()andto_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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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