ensembl.vep package#
Ensembl Python project template library
Subpackages#
- ensembl.vep.annotators package
- ensembl.vep.bench package
- Submodules
- ensembl.vep.bench.baseline module
- ensembl.vep.bench.endtoend module
- ensembl.vep.bench.harness module
- ensembl.vep.bench.oracle module
- ensembl.vep.bench.suites module
- ensembl.vep.bench.sweep module
- ensembl.vep.bench.workspace module
- ensembl.vep.buffer package
- ensembl.vep.caches package
- Submodules
- ensembl.vep.caches.binned_cache module
- ensembl.vep.caches.codon_cache module
- ensembl.vep.caches.feature_pool module
- ensembl.vep.caches.interval_tree module
- ensembl.vep.caches.mapper_cache module
- ensembl.vep.caches.sequence_cache module
- ensembl.vep.caches.slice_cache module
- ensembl.vep.caches.zone_map module
DEFAULT_ZONE_MAP_BYTESMEMO_FACT_NAMESZoneMapZoneMapCacheZoneMapCache.build_secondsZoneMapCache.clear()ZoneMapCache.columns()ZoneMapCache.downstream_distanceZoneMapCache.eviction_countZoneMapCache.facts_servedZoneMapCache.hit_countZoneMapCache.maps_builtZoneMapCache.max_bytesZoneMapCache.miss_countZoneMapCache.prefill()ZoneMapCache.upstream_distanceZoneMapCache.zone_map()
- ensembl.vep.common package
- Submodules
- ensembl.vep.common.codons module
- ensembl.vep.common.constants module
- ensembl.vep.common.containers module
- ensembl.vep.common.enums module
ClassSOTermClassSOTerm.ALU_DELETIONClassSOTerm.ALU_INSERTIONClassSOTerm.CHROMOSOME_BREAKPOINTClassSOTerm.COPY_NUMBER_GAINClassSOTerm.COPY_NUMBER_LOSSClassSOTerm.COPY_NUMBER_VARIATIONClassSOTerm.DELETIONClassSOTerm.DUPLICATIONClassSOTerm.HERV_DELETIONClassSOTerm.HERV_INSERTIONClassSOTerm.INDELClassSOTerm.INSERTIONClassSOTerm.INTERCHROMOSOMAL_BREAKPOINTClassSOTerm.INTRACHROMOSOMAL_BREAKPOINTClassSOTerm.INVERSIONClassSOTerm.LINE1_DELETIONClassSOTerm.LINE1_INSERTIONClassSOTerm.LOSS_OF_HETEROZYGOSITYClassSOTerm.MOBILE_ELEMENT_DELETIONClassSOTerm.MOBILE_ELEMENT_INSERTIONClassSOTerm.NOVEL_SEQUENCE_INSERTIONClassSOTerm.PROBEClassSOTerm.SEQUENCE_ALTERATIONClassSOTerm.SNVClassSOTerm.SUBSTITUTIONClassSOTerm.SVA_DELETIONClassSOTerm.SVA_INSERTIONClassSOTerm.TANDEM_DUPLICATIONClassSOTerm.TANDEM_REPEATClassSOTerm.TRANSLOCATION
ConsequenceImpactCoordSystemLevelCostTierExonPhaseReadthroughSourceTypeStartMethodStrand
- ensembl.vep.common.methods module
- ensembl.vep.common.mixins module
- ensembl.vep.common.vcf module
- ensembl.vep.config package
- Subpackages
- Submodules
- ensembl.vep.config.base module
ConfigConfig.annotationConfig.as_mapping()Config.benchConfig.bench_endtoendConfig.bench_matrixConfig.bench_oracleConfig.bench_sweepConfig.build_section()Config.catalogueConfig.catalogue_addConfig.catalogue_costsConfig.catalogue_removeConfig.catalogue_showConfig.catalogue_validateConfig.catalogue_writeConfig.commandConfig.corpusConfig.corpus_describeConfig.corpus_goldenConfig.corpus_saveConfig.executionConfig.explainConfig.for_command()Config.loggingConfig.runConfig.section()Config.section_typesConfig.section_types_for()Config.sections()Config.sourceConfig.source_of()Config.sourcesConfig.sources_for()Config.stats
load()
- ensembl.vep.config.option_spec module
- ensembl.vep.config.report module
- ensembl.vep.config.sources module
- ensembl.vep.corpus package
- Subpackages
- Submodules
- ensembl.vep.corpus.annotate module
- ensembl.vep.corpus.base module
- ensembl.vep.corpus.combine module
- ensembl.vep.corpus.describe module
ChromosomeShapeCorpusDescriptionCorpusDescription.batch_sizeCorpusDescription.build()CorpusDescription.chromosome_rows()CorpusDescription.chromosomesCorpusDescription.class_rows()CorpusDescription.kindCorpusDescription.overlap_rows()CorpusDescription.overlapsCorpusDescription.transcript_rows()CorpusDescription.transcriptsCorpusDescription.transcripts_per_chunkCorpusDescription.variant_classes
OverlapEntryTranscriptShapedescribe_variant()variant_class()
- ensembl.vep.corpus.overlap module
- ensembl.vep.corpus.registry module
- ensembl.vep.corpus.spec module
CorpusParameterCorpusSpecCorpusSpec.as_dict()CorpusSpec.boundary_seedCorpusSpec.from_dict()CorpusSpec.from_options()CorpusSpec.fuzzCorpusSpec.fuzz_seedCorpusSpec.genome_seedCorpusSpec.heavy_genome_seedCorpusSpec.kindCorpusSpec.kindsCorpusSpec.parameter()CorpusSpec.parameter_hash()CorpusSpec.parametersCorpusSpec.seeds_by_kind()CorpusSpec.stepCorpusSpec.sweep_seedCorpusSpec.with_parameters()
- ensembl.vep.corpus.validation module
- ensembl.vep.explain package
- ensembl.vep.matcher package
- ensembl.vep.models package
- Subpackages
- ensembl.vep.models.genic package
- Submodules
- ensembl.vep.models.genic.cdna module
- ensembl.vep.models.genic.cds module
- ensembl.vep.models.genic.exon module
- ensembl.vep.models.genic.gene module
- ensembl.vep.models.genic.intron module
- ensembl.vep.models.genic.transcript module
- ensembl.vep.models.genic.translation module
- ensembl.vep.models.genic.utr module
- ensembl.vep.models.haplotype package
- ensembl.vep.models.overlap package
- Submodules
- ensembl.vep.models.overlap.custom_variation_allele module
- ensembl.vep.models.overlap.feature_overlap module
- ensembl.vep.models.overlap.multiple_feature_overlap module
- ensembl.vep.models.overlap.overlap_consequence module
- ensembl.vep.models.overlap.transcript_structural_variation_allele module
- ensembl.vep.models.overlap.transcript_variation_allele module
- ensembl.vep.models.regulatory package
- ensembl.vep.models.sequence package
- ensembl.vep.models.variation package
- ensembl.vep.models.genic package
- Submodules
- ensembl.vep.models.custom_feature module
- ensembl.vep.models.feature module
- Subpackages
- ensembl.vep.output package
- ensembl.vep.overlaps package
- ensembl.vep.parsers package
- Submodules
- ensembl.vep.parsers.fasta module
- ensembl.vep.parsers.gff3 module
GFF3ParserGFF3Parser.close()GFF3Parser.file_pathGFF3Parser.formatGFF3Parser.index_sequence_namesGFF3Parser.metadataGFF3Parser.modeGFF3Parser.next()GFF3Parser.open()GFF3Parser.parse_file()GFF3Parser.parse_text()GFF3Parser.raw_lines()GFF3Parser.reader_modeGFF3Parser.records()GFF3Parser.seek()GFF3Parser.tabix_path
GFF3Record
- ensembl.vep.parsers.gtf module
GTFParserGTFParser.close()GTFParser.file_pathGTFParser.formatGTFParser.index_sequence_namesGTFParser.metadataGTFParser.modeGTFParser.next()GTFParser.open()GTFParser.parse_file()GTFParser.parse_text()GTFParser.raw_lines()GTFParser.reader_modeGTFParser.records()GTFParser.seek()GTFParser.tabix_path
GTFRecord
- ensembl.vep.parsers.parser module
- ensembl.vep.parsers.tabix module
- ensembl.vep.parsers.vcf module
- ensembl.vep.render package
- Subpackages
- Submodules
- ensembl.vep.render.chart module
- ensembl.vep.render.page module
- ensembl.vep.render.report module
- ensembl.vep.render.table module
- ensembl.vep.render.theme module
ColourColour.BLACKColour.BLUEColour.DARK_GREYColour.DARK_PINKColour.DARK_YELLOWColour.DUCKEGG_BLUEColour.GREENColour.GREYColour.ICE_BLUEColour.LIGHT_BLUEColour.LIGHT_GREYColour.LIMEColour.MEDIUM_DARK_GREYColour.MEDIUM_LIGHT_GREYColour.MUSTARDColour.NEON_BLUEColour.OFF_WHITEColour.ORANGEColour.PURPLEColour.REDColour.SOFT_BLACKColour.TEALColour.WHITEColour.tokenColour.var
FontMetricstylesheet()
- ensembl.vep.runner package
- ensembl.vep.sources package
- Subpackages
- Submodules
- ensembl.vep.sources.build module
- ensembl.vep.sources.feature_source module
FeatureSourceFeatureSource.close()FeatureSource.get_all_features()FeatureSource.get_all_records()FeatureSource.get_features_by_region()FeatureSource.get_records_by_region()FeatureSource.iter_all_features()FeatureSource.iter_all_records()FeatureSource.iter_features_by_region()FeatureSource.iter_records_by_region()FeatureSource.record_count()FeatureSource.records_to_features()FeatureSource.sequence_sourceFeatureSource.slice_cacheFeatureSource.source_type
R
- ensembl.vep.sources.sequence_source module
- ensembl.vep.sources.synonym module
- ensembl.vep.stats package
- ensembl.vep.trace package
- Submodules
- ensembl.vep.trace.annotation module
AnnotationTraceAnnotationTrace.annotator_nameAnnotationTrace.avoided_costAnnotationTrace.computed_costAnnotationTrace.emitted_termsAnnotationTrace.events_by_origin()AnnotationTrace.fact_eventsAnnotationTrace.format_explanation()AnnotationTrace.overlap_labelAnnotationTrace.prune_eventsAnnotationTrace.rule_events
annotation_tracing()describe_overlap()
- ensembl.vep.trace.events module
- ensembl.vep.trace.reconstruct module
- ensembl.vep.trace.run module
- ensembl.vep.workflow package
Submodules#
ensembl.vep.cli module#
The vep command line.
The first argument selects the command; when it is not a registered one the default is used, so
vep --input_file x.vcf still parses. --config FILE may stand anywhere and is taken off
first, so vep --config f.toml corpus describe reaches corpus describe. vep -h lists
every command and vep <group> -h the verbs of one group, laid out the way git -h lays out
its commands.
- ensembl.vep.cli.main(argv=None)[source]#
Run a command and return its exit code.
- Parameters:
argv (
list[str] |None, default:None) – Arguments without the program name, or None forsys.argv[1:].- Returns:
- The runner’s exit code,
OKafter printing a help page, orUSAGEif no command could be resolved,
--configis malformed, or the configuration is invalid or unreadable.
- The runner’s exit code,
- Return type:
- ensembl.vep.cli.resolve_command(argv)[source]#
Split arguments into a command name and the arguments that belong to it.
A bare group name resolves to that group’s single runner if it has one, otherwise stays unresolved so the caller can list its verbs.
Only a leading flag, or no arguments at all, means the default command.
veptakes no positional arguments, so a leading bare word can only be a command, and one that is not registered is an error rather than something to pass to the default.- Parameters:
argv (
list[str]) – Arguments without the program name.- Returns:
- The command name and the remaining arguments. The name is empty when
the leading word is not a command, or names a group without one of its verbs.
- Return type:
tuple[str,list[str]]
ensembl.vep.ensembl_vep_core module#
- class ensembl.vep.ensembl_vep_core.FastaParser(file_path=None, mode=None)#
Bases:
object- close()#
- format#
- metadata#
- next()#
- open(file_path, mode)#
- static parse_file(file_path, limit=None)#
- static parse_text(data, limit=None)#
- reader_mode#
- records(limit=10000)#
- seek(region)#
- class ensembl.vep.ensembl_vep_core.FastaRecord#
Bases:
objectRepresents a sequence record in a FASTA file.
- end#
End coordinate of the sequence
- Type:
int
- seqid#
Name of the seq region
- Type:
str
- sequence#
Sequence of the seq region
- Type:
str
- start#
Start coordinate of the sequence
- Type:
int
- class ensembl.vep.ensembl_vep_core.GFF3Parser(file_path=None, tabix_path=None, mode=None)#
Bases:
object- close()#
- format#
- index_sequence_names#
Reference sequence names declared by the tabix index, in index order.
Empty when the file is unopened or read sequentially. Callers can use these names to resolve a query contig to the exact spelling the index declares before seeking, instead of retrying alternate spellings on a miss.
- metadata#
- next()#
- open(file_path, mode)#
- static parse_file(file_path, limit=None)#
- static parse_text(data, limit=None)#
- raw_lines(limit=10000)#
Return up to limit record lines, each without its line ending and otherwise verbatim.
The same stream as records, read one step earlier: a line is returned before anything parses it, for a caller that wants the input’s own text rather than a record. Comment, directive and blank lines are skipped, as they are when reading records.
- reader_mode#
- records(limit=10000, feature_types=None)#
Return up to limit records, optionally keeping only rows whose column 3 (feature type) is in feature_types (compared case-insensitively).
The filter is applied on the Rust side before a matching line is parsed into a record or converted into a Python object: a non-matching line costs one tab-split byte scan, not a full record build.
- seek(region)#
- class ensembl.vep.ensembl_vep_core.GFF3Record#
Bases:
objectRepresents a record from one line of a GFF3 file.
- attribute_values(key)#
Return every value for an attribute key, or an empty vector when the key is absent.
Equivalent to attributes.get(key, ()), but a linear scan of the stored pairs instead of building a whole dict per call. A repeated key resolves to its last occurrence, as attributes and first_attribute do.
- attributes#
The information from the attributes column
- Type:
dict[list]
- end#
End coordinate of the feature
- Type:
int
- feature_type#
Class/type of feature (e.g. gene, transcript, exon)
- Type:
str
- first_attribute(key)#
Return the first value for an attribute key, or None when the key is absent.
Equivalent to attributes[key][0], but a linear scan of the stored pairs instead of building a whole dict per call.
GFF3 allows for one key with a comma-separated array for multiple values.
For repeated keys, noodles-gff keeps each occurrence as its own pair in self.attributes. The attributes getter above builds a dict via set_item, so a repeated key resolves there to its last occurrence – scanning in reverse here matches that, instead of silently returning a different value for the same key.
- phase_value#
Value for the phase of the feature (0, 1 or 2)
- Type:
int | None
- raw_attributes#
- score#
Score given to the feature
- Type:
float | None
- seqid#
Name of the seq region
- Type:
str
- source#
Source of the annotation
- Type:
str
- start#
Start coordinate of the feature
- Type:
int
- strand_symbol#
Symbol representing the strand the feature is on (+, -, . or ?)
- Type:
str
- class ensembl.vep.ensembl_vep_core.GTFParser(file_path=None, tabix_path=None, mode=None)#
Bases:
object- close()#
- format#
- index_sequence_names#
Reference sequence names declared by the tabix index, in index order.
Empty when the file is unopened or read sequentially. Callers can use these names to resolve a query contig to the exact spelling the index declares before seeking, instead of retrying alternate spellings on a miss.
- metadata#
- next()#
- open(file_path, mode)#
- static parse_file(file_path, limit=None)#
- static parse_text(data, limit=None)#
- raw_lines(limit=10000)#
Return up to limit record lines, each without its line ending and otherwise verbatim.
The same stream as records, read one step earlier: a line is returned before anything parses it, for a caller that wants the input’s own text rather than a record. Comment, directive and blank lines are skipped, as they are when reading records.
- reader_mode#
- records(limit=10000, feature_types=None)#
Return up to limit records, optionally keeping only rows whose column 3 (feature type) is in feature_types (compared case-insensitively).
The filter is applied on the Rust side before a matching line is parsed into a record or converted into a Python object: a non-matching line costs one tab-split byte scan, not a full record build.
- seek(region)#
- class ensembl.vep.ensembl_vep_core.GTFRecord#
Bases:
objectRepresents a record from one line of a GTF file.
- attribute_values(key)#
Return every value for an attribute key, or an empty vector when the key is absent.
Equivalent to attributes.get(key, ()), but a linear scan of the stored pairs instead of building a whole dict per call.
- attributes#
The information from the attributes column
- Type:
dict[list]
- end#
End coordinate of the feature
- Type:
int
- feature_type#
Class/type of feature (e.g. gene, transcript, exon)
- Type:
str
- first_attribute(key)#
Return the first value for an attribute key, or None when the key is absent.
Equivalent to attributes[key][0], but a linear scan of the stored pairs instead of building a whole dict per call.
- phase_value#
Value for the phase of the feature (0, 1 or 2)
- Type:
int | None
- raw_attributes#
- score#
Score given to the feature
- Type:
float | None
- seqid#
Name of the seq region
- Type:
str
- source#
Source of the annotation
- Type:
str
- start#
Start coordinate of the feature
- Type:
int
- strand_symbol#
Symbol representing the strand the feature is on (+, -, . or ?)
- Type:
str
- class ensembl.vep.ensembl_vep_core.TabixParser(file_path=None, tabix_path=None)#
Bases:
object- close()#
- format#
- metadata#
Return a metadata dict. The “header” key is lazily populated with header lines from the file on first access.
- next()#
- open(file_path)#
- records(limit=None)#
- seek(region)#
- class ensembl.vep.ensembl_vep_core.VCFMetadata#
Bases:
objectRepresents the metadata from a VCF file
- alt#
- contig#
- file_format#
- filter#
- format#
- header#
The file’s header lines verbatim, kept because a parsed header cannot be written back out as the input spelled it and VCF output re-emits the input’s own header.
- info#
- is_empty()#
- keys()#
- other#
- samples#
- class ensembl.vep.ensembl_vep_core.VCFParser(file_path=None, tabix_path=None, mode=None)#
Bases:
object- close()#
- format#
- metadata#
- next()#
- open(file_path, mode)#
- static parse_file(file_path, limit=None)#
- static parse_text(data, limit=None)#
- raw_lines(limit=10000)#
Return up to limit record lines, each without its line ending and otherwise verbatim.
The same stream as records, read one step earlier: a line is returned before anything parses it, for a caller that wants the input’s own text rather than a record.
- reader_mode#
- static record_count(file_path, scan=False)#
Return how many records a VCF file holds, or None when nothing declares it.
The count comes from the file’s index, which answers in one small read. Without an index there is no count unless scan is set, which reads the whole file: an input of a billion lines makes that pass the slowest part of a run, so a caller that only wants it for progress reporting leaves it off and does without the count.
A static method, like parse_file: the count neither depends on the mode a reader was opened in nor disturbs a stream being read.
- Parameters:
file_path – The VCF file to count.
scan (default:
False) – Whether to count by reading the file when no index declares it.
- records(limit=10000)#
- seek(region)#
- class ensembl.vep.ensembl_vep_core.VCFRecord#
Bases:
objectRepresents a record in a VCF file
- alt#
Representation of each alternate allele
- Type:
list[str]
- chrom#
Name of the seq region
- Type:
str
- filter#
Value of the FILTER field
- Type:
str | None
- id#
Variant id e.g. from dbSNP
- Type:
str | None
- info#
Information from the INFO field
- Type:
dict
- pos#
Position of the variant
- Type:
int
- qual#
Quality score for the variant
- Type:
float | None
- reference#
Sequence of the reference allele
- Type:
str
- samples#
Genotype information for each sample
- Type:
list[dict]
- ensembl.vep.ensembl_vep_core.batch_contain_span(variant_mins, variant_maxs, feature_starts, feature_ends)#
contain_feature for a whole batch: does each variant span swallow its feature whole?
- ensembl.vep.ensembl_vep_core.batch_overlap_any_interval(variant_mins, variant_maxs, interval_starts, interval_ends, offsets)#
Does each variant span overlap any interval in its own context’s interval list?
The kernel behind overlap_exon/overlap_intron. Interval lists are passed CSR-style – one flat (starts, ends) pair plus an offsets array of length count + 1, where context i owns intervals offsets[i]..offsets[i + 1], so a batch spanning many transcripts is still exactly three arrays and no nesting. Contexts sharing a transcript can point at the same slice, which is the common case for the heavy-locus corpus.
- ensembl.vep.ensembl_vep_core.batch_overlap_span(variant_mins, variant_maxs, feature_starts, feature_ends)#
overlap_feature for a whole batch: does each variant span touch its own feature’s span?
- ensembl.vep.ensembl_vep_core.batch_variant_shapes(reference_lengths, alternate_lengths)#
Return four variant shape facts from two length arrays, in one crossing.
- Parameters:
list[int (alternate_lengths)
...] (Lengths of alternate alleles.)
list[int
...]
- Returns:
bitmaps representing the facts
(is_snv, is_short_insertion, is_short_deletion, length_change_inframe).- Return type:
tuple(bytes, bytes, bytes, bytes)
- Raises:
ValueError – If the lengths of the two allele list are not the same length.
Example
from ensembl.vep.ensembl_vep_core import batch_variant_shapes reference_lengths = [1, 0, 3, 2, 2] alternate_lengths = [1, 4, 0, 0, 2] shape_masks = batch_variant_shapes(reference_lengths, alternate_lengths)
- ensembl.vep.ensembl_vep_core.sum_as_string(a, b)#
- ensembl.vep.ensembl_vep_core.translate_dna(coding_sequence, table_id=1)#
Expose DNA translation to Python with table 1 as the default.