ensembl.vep.sources.file package#
Feature sources — file-backed and database-backed providers of domain Feature objects.
Subpackages#
- ensembl.vep.sources.file.fasta package
- ensembl.vep.sources.file.gff3 package
- ensembl.vep.sources.file.gtf package
- ensembl.vep.sources.file.gxf package
- Submodules
- ensembl.vep.sources.file.gxf.transcript module
GXFRecordGXFTranscriptSourceGXFTranscriptSource.adaptorGXFTranscriptSource.close()GXFTranscriptSource.coding_feature_typesGXFTranscriptSource.exon_feature_typesGXFTranscriptSource.gene_feature_typesGXFTranscriptSource.get_features_by_region()GXFTranscriptSource.get_parent_ids()GXFTranscriptSource.get_record_id()GXFTranscriptSource.get_records_by_region()GXFTranscriptSource.iter_all_features()GXFTranscriptSource.iter_features_by_region()GXFTranscriptSource.iter_features_by_regions()GXFTranscriptSource.records_to_features()GXFTranscriptSource.reference_region_resolverGXFTranscriptSource.sequence_region_namesGXFTranscriptSource.source_region_resolverGXFTranscriptSource.transcript_feature_typesGXFTranscriptSource.transcript_poolGXFTranscriptSource.transcript_pool_poisoned
- ensembl.vep.sources.file.vcf namespace
- Submodules
- ensembl.vep.sources.file.vcf.variation module
PicklableVCFVariationSourcePicklableVCFVariationSource.get_all_records()PicklableVCFVariationSource.get_records_by_region()PicklableVCFVariationSource.header_lines()PicklableVCFVariationSource.iter_all_records()PicklableVCFVariationSource.iter_records_by_region()PicklableVCFVariationSource.record_columns()PicklableVCFVariationSource.records_to_features()PicklableVCFVariationSource.region_of()
VCFVariationSource
Submodules#
ensembl.vep.sources.file.file_feature_source module#
The file-backed feature source contract.
- class ensembl.vep.sources.file.file_feature_source.FileFeatureSource[P: Parser, R, F: Feature](*, sequence_source=None, slice_cache=WeakSliceCache(), file_path, adaptor)[source]#
Bases:
FeatureSource[R,F],Generic[P,R,F]Feature source backed by a parser-readable file.
- Variables:
file_path (str) – Path to the feature file.
adaptor (P) – Parser for the file’s record type.
source_type (SourceType) – File source marker.
- adaptor: P#
- close()[source]#
Release the attached sequence source, if any.
FeatureSourceowns thesequence_sourcefield and__exit__callsclose(), but nothing in the chain ever released it – so a source opened as a context manager leaked its sequence handle. Closing it here is what the field’s ownership already implied.
- file_path: str#
- get_all_records()[source]#
Return every unconverted record in the source file.
- Returns:
Every record in the file.
- Return type:
list[R]- Raises:
NotImplementedError – If the adaptor cannot parse a whole file at once. Re-raised with the adaptor named, which the bare error from the parser does not say.
FileNotFoundError – If the file does not exist. Allowed to propagate: its message already names the path.
A library reports what went wrong and lets its caller decide what to do about it. These both used to call
sys.exit(1), which ended the process from underneath any caller – including a test, and including a runner that had a better answer than dying.
- get_records_by_region(region=None, *, seq_region_name=None, start=None, end=None, **kwargs)[source]#
Return unconverted records from an indexed region query.
- Parameters:
region (
str|None, default:None) – The region (e.g., “chr1:1000-2000”) to read.seq_region_name (
str|None, default:None) – The name of the sequence region (e.g., “chr1”).start (
int|None, default:None) – The start position of the region.end (
int|None, default:None) – The end position of the region.**kwargs (
object) – Unused here; a format whose query takes more accepts it.
- Returns:
The records the query reads, empty when the region is unreadable.
- Return type:
list[R]
- iter_all_records()[source]#
Yield every unconverted record in the source file.
- Return type:
Iterator[R]
- iter_records_by_region(region=None, *, seq_region_name=None, start=None, end=None, **kwargs)[source]#
Yield unconverted records from an indexed region query.
- Parameters:
region (
str|None, default:None) – The region (e.g., “chr1:1000-2000”) to read.seq_region_name (
str|None, default:None) – The name of the sequence region (e.g., “chr1”).start (
int|None, default:None) – The start position of the region.end (
int|None, default:None) – The end position of the region.**kwargs (
object) – Unused here; a format whose query takes more accepts it.
- Returns:
The records the query reads, in file order.
- Return type:
Iterator[R]
- source_type: SourceType#