ensembl.vep.corpus.synthetic.components package#
Reusable synthetic corpus components.
Submodules#
ensembl.vep.corpus.synthetic.components.sequence module#
Build synthetic sequences.
- ensembl.vep.corpus.synthetic.components.sequence.fill_locus_sequence(chromosome_chars, start, end, random_generator, *, bases='ACG')[source]#
Fill an inclusive locus with bases drawn from
bases.The default alphabet cannot produce a stop codon in either strand or reading frame. Passing
ACGTproduces an unconstrained reference sequence while retaining the same reusable coordinate handling.- Parameters:
chromosome_chars (
list[str]) – Mutable whole-chromosome sequence.start (
int) – One-based inclusive locus start.end (
int) – One-based inclusive locus end.random_generator (
Random) – Seeded random generator.bases (
str, default:'ACG') – Non-empty alphabet to draw from.
- Raises:
ValueError – If the locus is outside the chromosome or
basesis empty.
- ensembl.vep.corpus.synthetic.components.sequence.random_sequence(length, random_generator)[source]#
Return a random nucleotide sequence.
- Parameters:
length (
int) – Number of bases to generate.random_generator (
Random) – Seeded random generator, for reproducibility.
- Returns:
A random sequence of
ACGTbases.- Return type:
str
ensembl.vep.corpus.synthetic.components.transcript module#
Build synthetic transcript model objects.
- ensembl.vep.corpus.synthetic.components.transcript.build_cds_genomic_bounds(exons_genomic_ascending, *, strand, frame_index, start_offset=50, stop_offset=50)[source]#
Return CDS genomic bounds from spliced-transcript terminal offsets.
start_offsetis measured from the transcript’s 5’ end and carries into later exons when the first exon is shorter.stop_offsetis measured back from the 3’ end and is clamped towards that end when the requested position would cross the start codon. The terminal bound is then moved towards the 5’ end until the CDS length is a multiple of three.- Parameters:
exons_genomic_ascending (
Sequence[tuple[int,int]]) – Exons in ascending genomic order.strand (
Strand) – Transcript strand.frame_index (
int) – Reading-frame index used to spread alternative starts across frames.start_offset (
int, default:50) – Preferred zero-based start offset from the transcript’s 5’ end.stop_offset (
int, default:50) – Preferred zero-based terminal offset back from the transcript’s 3’ end.
- Returns:
Inclusive genomic
(low, high)CDS bounds.- Return type:
tuple[int,int]- Raises:
ValueError – If the exon layout or requested offsets cannot hold a codon.
- ensembl.vep.corpus.synthetic.components.transcript.build_transcript(*, stable_id, synthetic_slice, strand, exons_genomic_ascending, cds_genomic_bounds, gene, biotype=None)[source]#
Build one transcript with exons, introns, and an optional translation.
- Parameters:
stable_id (
str) – Transcript stable identifier.synthetic_slice (
Slice) – Sequence region shared by the transcript and its exons.strand (
Strand) – Transcript orientation.exons_genomic_ascending (
Sequence[tuple[int,int]]) – Inclusive exon bounds in genomic order.cds_genomic_bounds (
tuple[int,int] |None) – Inclusive CDS bounds, orNonefor a non-coding transcript.gene (
Gene|None) – Optional parent gene.biotype (
str|None, default:None) – Optional transcript biotype.
- Returns:
Constructed transcript with seeded introns and translation.
- Return type:
- Raises:
ValueError – If a CDS boundary does not fall inside a transcript exon.
- ensembl.vep.corpus.synthetic.components.transcript.build_translation(transcript, genomic_bounds)[source]#
Build a transcript translation from inclusive genomic CDS bounds.
- Parameters:
transcript (
Transcript) – Transcript whose spliced exons contain both CDS boundaries.genomic_bounds (
tuple[int,int]) – Inclusive(low, high)genomic CDS bounds.
- Returns:
Translation linked to
transcriptwith exon-relative coding offsets.- Return type:
- Raises:
ValueError – If either CDS boundary falls outside the transcript’s exons.
- ensembl.vep.corpus.synthetic.components.transcript.calculate_cds_length(exons_genomic_ascending, cds_genomic_low, cds_genomic_high)[source]#
Return coding bases within inclusive bounds across spliced exons.
- Parameters:
exons_genomic_ascending (
Sequence[tuple[int,int]]) – Inclusive exon bounds in genomic order.cds_genomic_low (
int) – Inclusive lower genomic CDS boundary.cds_genomic_high (
int) – Inclusive upper genomic CDS boundary.
- Returns:
Exonic bases intersecting the CDS bounds.
- Return type:
int
- ensembl.vep.corpus.synthetic.components.transcript.patch_terminal_codons(chromosome_chars, transcripts)[source]#
Write ATG start and TAA stop codons for every coding transcript.
- Parameters:
chromosome_chars (
list[str]) – Mutable forward-strand chromosome sequence.transcripts (
Sequence[Transcript]) – Transcripts whose CDS terminals are patched.
- Raises:
ValueError – If a terminal codon cannot be mapped inside its transcript CDS.
ensembl.vep.corpus.synthetic.components.variation module#
Generate synthetic variation alleles.
- ensembl.vep.corpus.synthetic.components.variation.boundary_variant_alleles(synthetic_slice, transcripts, seed=11)[source]#
Build one variant per interesting structural offset, for every transcript.
Mirrors
socore.data.boundary_variants: every splice donor/acceptor offset, the exonic side of every splice boundary, a deep-intronic control, every start/stop codon base (plus whole-codon deletions/insertions), a sweep through the CDS, UTR edges, upstream/downstream flanks (including the 4999/5000/5001 boundary), and whole-transcript ablation/elongation.- Parameters:
synthetic_slice (
Slice) – The chromosome slice built by the default corpus generator.transcripts (
Sequence[Transcript]) – The transcripts built by the default corpus generator.seed (
int, default:11) – Random seed, for reproducibility.
- Returns:
Named boundary variants.
- Return type:
list[tuple[str,VariationAllele]]
- ensembl.vep.corpus.synthetic.components.variation.fuzz_variant_alleles(synthetic_slice, variant_count=4000, seed=23)[source]#
Build random variants across the whole synthetic chromosome.
Mirrors
socore.data.fuzz_variants.- Parameters:
synthetic_slice (
Slice) – The chromosome slice built by the default corpus generator.variant_count (
int, default:4000) – Number of fuzz variants to generate.seed (
int, default:23) – Random seed, for reproducibility.
- Returns:
Named fuzz variants.
- Return type:
list[tuple[str,VariationAllele]]- Raises:
ValueError – If
variant_countis negative.