ensembl.vep.output.parser package#
Readers of already-annotated output.
Submodules#
ensembl.vep.output.parser.base module#
The reader contract.
- class ensembl.vep.output.parser.base.OutputParser[source]#
Bases:
ABCParser for annotated files containing variation consequences.
A reader needs no transcript or sequence source: the consequences are seeded straight onto each allele, leaving the feature overlaps empty, and everything a summary reads still answers.
ensembl.vep.output.parser.json module#
JSON output. A declared seam; the writer it mirrors does not exist yet.
ensembl.vep.output.parser.tab module#
Tab-delimited output. A declared seam; the writer it mirrors does not exist yet.
ensembl.vep.output.parser.vcf module#
Annotated VCF consequence parsing.
VEP writes them as CSQ and SnpEff as ANN: one INFO field whose layout the header’s
Description declares, one entry per (allele, feature) separated by commas, fields by pipes,
several terms by &. Both are read the same way; only the field names differ.
Two mechanics that must stay right, both confirmed on this codebase:
seed_attrstakes the public name and prepends the underscore itself:seed_attrs(overlap_consequences=...), never_overlap_consequences.transcript_variation_allelescarrieson_setattr=invalidates("_overlap_consequences"), so assigning it after seeding silently wipes the seed. This reader never assigns it, which is also why it needs no--gff/--fasta: the terms live on the allele, andVariation.most_severe_consequenceand.class_so_termanswer with zero transcripts.
- ensembl.vep.output.parser.vcf.ANNOTATION_FIELDS = {'ANN': ('Allele', 'Annotation'), 'CSQ': ('Allele', 'Consequence')}#
INFO key -> the names of its allele and consequence fields, as each tool spells them.
- ensembl.vep.output.parser.vcf.UNKNOWN_RANK = 999#
Rank given to a term the catalogue does not model. Rank 1 is the most severe and the model’s default is 0, so an unranked term must sit below every real one rather than above.
- class ensembl.vep.output.parser.vcf.VCFOutputParser(*, ruleset=build_fact_ruleset())[source]#
Bases:
OutputParserParser for annotated VCF files.
- Variables:
ruleset (FactRuleSet) – Where a known term’s rank, accession and impact come from. A term the catalogue does not model is kept, with
UNKNOWN_RANK.
- parse(path)[source]#
Yield one variation per record.
- Parameters:
path (
str|Path) – The annotated VCF.- Yields:
Variation – Each record, its alleles seeded with the terms the file assigned them.
- ruleset: FactRuleSet#
- ensembl.vep.output.parser.vcf.csq_alleles(reference, alternates)[source]#
Return how VEP spells each alternate allele in the CSQ
Allelefield.An SNV is its base. When every allele shares the reference’s first base – an indel with its VCF padding – that base is dropped and an allele left empty becomes
-.- Return type:
list[str]