ORFs API¶
For installation, reference binding, genetic codes, and evidence limitations,
see ORF annotation. Ordinary transcript annotation uses
variant.effects(); add extra_orfs= to that workflow when you want an
EffectCollection containing additional ORF consequences.
Choose an entry point¶
| Task | Entry point | Result |
|---|---|---|
| Load reference records | load_orf_catalog(...) |
ORFdata catalogue |
| Annotate a validated reference ORF | annotate_orf_variants(variants, reference) |
ORFAnnotation |
| Annotate overlapping catalogue records | predict_orf_effects(variants, ...) |
Tuple of ORFAnnotation objects |
| Compare a mapped observed RNA product | annotate_orf_rna_product(reference, product) |
ORFProductAnnotation |
| Export the observed-product comparison directly | annotate_orf_product(reference, product) |
Dictionary for JSON export |
The tuple from predict_orf_effects is not an EffectCollection. Empty results
mean no catalogue model was selected; they do not establish that no ORF can be
affected. Keep each annotation's unresolved reason and alternative outcomes.
The supplied reference and observed product must retain their coordinate and
reference context; a protein string alone cannot supply that mapping.
Annotation functions¶
varcode.load_orf_catalog(*args, **kwargs)
¶
Load the shared orfdata reference; install varcode[orf] to use it.
Source code in varcode/orf.py
varcode.annotate_orf_variants(variants, reference, **kwargs)
¶
Annotate variants relative to a validated orfdata.ReferenceORF.
The reference's coding fields and reference.evidence describe the base
ORF; catalogue record/model are optional. The returned annotation retains that reference and all alternative
modified products. The parent RNA can be annotated protein-coding or
noncoding. Native peptide detection never establishes mutant translation.
Source code in varcode/orf.py
varcode.predict_orf_effects(variants, *, catalog=None, transcripts=None, **kwargs)
¶
Return additive annotations for overlapping catalogue models.
variants is one variant or an explicitly known-cis group. Transcript
lookup uses the variant's genome unless an iterable is supplied. Failed
model validation is exported as unresolved, never silently discarded.
An empty tuple means no reference model overlapped this query, not that
the variants cannot create or affect translation upstream of a CDS.
Source code in varcode/orf.py
varcode.annotate_orf_rna_product(reference, product)
¶
Annotate an observed/reconstructed RNA product with mapped base ancestry.
product is a :class:RealizedTranscriptProduct. Its evidence must carry
base_origins: one (contig, position, strand) or None per cDNA base.
These placements must come from the reconstruction, not peptide similarity.
RNA support in product.evidence remains separate from reference MS.
Only a uniquely retained complete reference start anchors translation.
Returns an :class:ORFProductAnnotation with native reference,
effect and product attributes. Unresolved results have no product
and carry a reason. Use to_dict() for JSON export.
Source code in varcode/orf.py
varcode.annotate_orf_product(reference, product)
¶
Compatibility JSON export; prefer :func:annotate_orf_rna_product.
This original entry point returns a dictionary because downstream RNA
exporters embed its result directly in JSON. New Python callers should use
annotate_orf_rna_product and access the returned object's attributes.
Source code in varcode/orf.py
Result models¶
varcode.ORFAnnotation(record: Optional[ORFRecord], effect: Optional[MutationEffect], reference: Optional[ReferenceORF] = None, variants: tuple = (), outcomes: Tuple[ORFOutcome, ...] = (), catalogue_metadata: Optional[Mapping] = None, variant_locations: tuple = (), unresolved_reason: Optional[str] = None, unavailable_operations: Mapping = dict())
dataclass
¶
Per-ORF consequences available through outcomes as Python objects.
A failed reference binding leaves reference and effect as None,
with an explicit unresolved_reason. to_dict() is for export only.
data
property
¶
Compatibility export; use attributes for in-process access.
varcode.ORFOutcome(effect: MutationEffect, baseline: ORFProduct, mutant: Optional[ORFProduct], hypothesis: Optional[EffectHypothesis] = None, probability: Optional[float] = None, phase_mass: Optional[float] = None, source: Optional[str] = None, unresolved_reason: Optional[str] = None)
dataclass
¶
One consequence and its baseline/mutant products, with uncertainty intact.
varcode.ORFProduct(cdna_sequence: Optional[str], protein_sequence: Optional[str], start_codon_present: Optional[bool], termination: str, stop_cdna_offset: Optional[int], initiation_context: InitiationContext, junction_signature: tuple = (), evidence: Mapping = dict(), reference_evidence: Mapping = dict())
dataclass
¶
A realized ORF's sequences, initiation context and reference evidence.
Unavailable sequences remain None. Reference peptide retention is not evidence that this product was translated or presented by MHC.
to_dict()
¶
Export the established product schema without changing native fields.
Source code in varcode/orf.py
varcode.ORFProductAnnotation(reference: ReferenceORF, status: str, effect: Optional[MutationEffect] = None, product: Optional[ORFProduct] = None, reason: Optional[str] = None, cdna_sequence: Optional[str] = None, evidence: Mapping = dict())
dataclass
¶
Consequence of a mapped RNA product relative to a reference ORF.
Attribute access retains native objects. Use to_dict() for JSON export.
Upstream-ORF compatibility API¶
These names preserve the earlier record-plus-transcript interface. Prefer the bound-reference functions above for new integrations. The upstream-only catalogue default is retained; the wrappers are not all interchangeable aliases for the general catalogue API.
UORFAnnotation is an alias of ORFAnnotation.
varcode.UORFAnnotation(record: Optional[ORFRecord], effect: Optional[MutationEffect], reference: Optional[ReferenceORF] = None, variants: tuple = (), outcomes: Tuple[ORFOutcome, ...] = (), catalogue_metadata: Optional[Mapping] = None, variant_locations: tuple = (), unresolved_reason: Optional[str] = None, unavailable_operations: Mapping = dict())
dataclass
¶
Per-ORF consequences available through outcomes as Python objects.
A failed reference binding leaves reference and effect as None,
with an explicit unresolved_reason. to_dict() is for export only.
varcode.ORFTranscript(record, transcript, *, genome_build, reference_context=None)
¶
Bases: _ORFTranscript
Legacy engine view; use record.bind(transcript) for the base object.
Source code in varcode/uorf.py
varcode.load_uorf_catalog(*args, **kwargs)
¶
Load the legacy upstream-ORF catalogue through ORFdata.
Arguments are forwarded to orfdata.load_uorf_catalog. Requires the
varcode[orf] extra. Use :func:varcode.load_orf_catalog for the
general ORF catalogue; this compatibility function keeps its upstream-only
selection.
Source code in varcode/uorf.py
varcode.annotate_uorf_variants(variants, record, transcript, *, genome_build, **kwargs)
¶
Annotate variants on a legacy record bound to a supplied transcript.
Returns an :class:varcode.ORFAnnotation. genome_build identifies the
record's placement; additional keywords go to the shared ORF annotation
engine. New callers can bind the reference and use
:func:varcode.annotate_orf_variants directly.
Source code in varcode/uorf.py
varcode.annotate_uorf_product(record, transcript, product, *, genome_build, reference_context=None)
¶
Compare an observed product with a legacy record/transcript placement.
Returns a JSON-compatible dictionary. The record is bound using
genome_build and optional reference_context before delegating to
:func:varcode.annotate_orf_product.
Source code in varcode/uorf.py
varcode.predict_uorf_effects(variants, *, catalog=None, **kwargs)
¶
Return a tuple of ORFAnnotation objects from the upstream-ORF catalogue.
Omitted catalog loads :func:load_uorf_catalog. Remaining arguments
are forwarded to :func:varcode.predict_orf_effects; supply a catalogue
explicitly to control its source and reference context.