ensembl.vep.corpus.synthetic package#

Build deterministic synthetic corpora.

Subpackages#

Submodules#

ensembl.vep.corpus.synthetic.base module#

The synthetic corpus model.

class ensembl.vep.corpus.synthetic.base.SyntheticCorpus(*, synthetic_slice, named_variants, transcripts=tuple(), named_overlaps=tuple(), spec=<factory>)[source]#

Bases: Corpus

A synthetic chromosome slice, its transcripts, variants, and named variant overlaps.

Variables:
  • spec (CorpusSpec) – Specification used to generate the corpus.

  • synthetic_slice (Slice) – The whole-chromosome slice every feature and variant is expressed against.

  • named_variants (tuple[tuple[str, VariationAllele], ...]) – Every generated variant, including variants that do not overlap any transcript.

  • transcripts (tuple[Transcript, ...]) – Every transcript in the corpus.

  • named_overlaps (tuple[tuple[str, TranscriptVariationAllele], ...]) – (name, overlap) pairs, suitable for pytest.mark.parametrize IDs.

property description: str#

Return a short synthetic-corpus description.

property named_overlaps: tuple[tuple[str, TranscriptVariationAllele], ...]#

Return every generated transcript overlap.

property named_variants: tuple[tuple[str, VariationAllele], ...]#

Return every generated variant.

property sequence_regions: tuple[Slice, ...]#

Return the synthetic sequence region as a one-item sequence.

property spec: CorpusSpec#

Return the specification that generated the corpus.

property synthetic_slice: Slice#

Return the synthetic sequence region.

property transcripts: tuple[Transcript, ...]#

Return every generated transcript.

ensembl.vep.corpus.synthetic.default module#

Build the default synthetic corpus.

ensembl.vep.corpus.synthetic.default.build_genome(seed=7)[source]#

Build the synthetic chromosome and its four transcripts.

Mirrors socore.data.build_genome: one forward-strand protein-coding transcript, one reverse-strand protein-coding transcript, one non-coding (lincRNA-like) transcript, and one nonsense_mediated_decay transcript.

The biotypes are declared on purposely different features so that both branches of FactContext.biotype (see consequence/context/fact.py) are covered: ENST0001 and ENST0003 carry their own, ENST0002 and ENST0004 leave theirs None and inherit the gene’s.

Parameters:

seed (int, default: 7) – Random seed, for reproducibility.

Returns:

The shared chromosome slice (with real, CDS-patched

sequence) and the four transcripts.

Return type:

tuple[Slice, tuple[Transcript, ...]]

ensembl.vep.corpus.synthetic.default.build_variation_alleles(synthetic_slice, transcripts, *, fuzz_count=4000, boundary_seed=11, fuzz_seed=23)[source]#

Build named boundary and random alleles for the default corpus.

Parameters:
  • synthetic_slice (Slice) – Sequence region holding the variants.

  • transcripts (Sequence[Transcript]) – Transcripts used to derive boundary variants.

  • fuzz_count (int, default: 4000) – Number of additional random variants.

  • boundary_seed (int, default: 11) – Boundary-variant random seed.

  • fuzz_seed (int, default: 23) – Random-variant seed.

Returns:

Boundary variants followed by random variants.

Return type:

tuple[tuple[str, VariationAllele], ...]

ensembl.vep.corpus.synthetic.default.default_corpus(fuzz_count=4000, seed=7, *, boundary_seed=11, fuzz_seed=23, spec=None)[source]#

Build the default synthetic corpus: four transcripts, boundary variants, and fuzz variants.

Mirrors socore.data.default_dataset.

Parameters:
  • fuzz_count (int, default: 4000) – Number of additional random (“fuzz”) variants to add.

  • seed (int, default: 7) – Random seed for the underlying chromosome, for reproducibility.

  • boundary_seed (int, default: 11) – Random seed for the boundary variants’ alternate bases.

  • fuzz_seed (int, default: 23) – Random seed for the fuzz variants.

  • spec (CorpusSpec | None, default: None) – Construction specification retained by the corpus.

Returns:

The synthetic slice, its transcripts, variants, and overlaps.

Return type:

SyntheticCorpus

ensembl.vep.corpus.synthetic.heavy module#

Build the dense heavy-locus synthetic corpus.

ensembl.vep.corpus.synthetic.heavy.build_genome(seed=31)[source]#

Build the two-locus (one per strand), 36-transcript heavy-locus synthetic chromosome.

Mirrors socore.data.build_locus_genome.

Parameters:

seed (int, default: 31) – Random seed, for reproducibility.

Returns:

The shared chromosome slice (with real, codon-patched

sequence) and all 36 transcripts (18 forward-strand, 18 reverse-strand).

Return type:

tuple[Slice, tuple[Transcript, ...]]

ensembl.vep.corpus.synthetic.heavy.build_transcripts(synthetic_slice, *, origin, strand, stable_id_tag)[source]#

Build 18 transcripts sharing constitutive exons over a single locus.

Parameters:
  • synthetic_slice (Slice) – The shared synthetic-chromosome slice.

  • origin (int) – Genomic (slice-relative) offset the locus’s exon coordinates are relative to.

  • strand (Strand) – The strand every transcript in this locus is built on.

  • stable_id_tag (str) – Prefix for each transcript’s stable_id (e.g. “FWD”, “REV”).

Returns:

The 18 transcripts, not yet carrying real start/stop codon sequence

(see build_genome, which patches that in afterwards).

Return type:

list[Transcript]

ensembl.vep.corpus.synthetic.heavy.build_variation_alleles(synthetic_slice, step=13, seed=41)[source]#

Build a dense sweep of variants across each locus, so shared exons are hit repeatedly.

Parameters:
  • synthetic_slice (Slice) – The chromosome slice built by build_genome.

  • step (int, default: 13) – Genomic spacing between consecutive sweep positions.

  • seed (int, default: 41) – Random seed, for reproducibility.

Returns:

Named heavy-locus sweep variants.

Return type:

tuple[tuple[str, VariationAllele], ...]

Raises:

ValueError – If step is not positive.

ensembl.vep.corpus.synthetic.heavy.heavy_corpus(step=13, seed=31, *, sweep_seed=41, spec=None)[source]#

Build the heavy-locus corpus: 2 strands x 18 exon-sharing transcripts, a dense variant sweep.

Mirrors socore.data.heavy_locus_dataset. Unlike default_corpus’s four disjoint transcripts, this is the only corpus that exercises multi-variant-per-transcript zone reuse (the zone map cache, caches/zone_map.py) and, in a later phase, cross-transcript codon sharing – many transcripts here share the same genomic exon footprint, so a transcript’s zone map (or codon cache entry) built for one variant is reused by every other variant that lands in the same shared exon, across every transcript sharing it.

Parameters:
  • step (int, default: 13) – Genomic spacing between consecutive sweep positions.

  • seed (int, default: 31) – Random seed for the underlying chromosome, for reproducibility.

  • sweep_seed (int, default: 41) – Random seed for the variant sweep’s alternate bases.

  • spec (CorpusSpec | None, default: None) – Construction specification retained by the corpus.

Returns:

The synthetic slice, its 36 transcripts, variants, and overlaps.

Return type:

SyntheticCorpus