Labels And Metrics
Label semantics for the DNA segmentation benchmark.
This module defines the public LabelConfig model and the annotation
mode/scope enums used by the array-based benchmark core.
Stage 1 introduces two explicit annotation modes:
EXON_INTRON— one exonic label, optional intron and splice-site labelsUTR_CDS_INTRON— distinct5' UTR,CDS, and3' UTRlabels, plus optional intron and splice-site labels
- class gene_calling_benchmark.label_definition.AnnotationMode(*values)[source]
-
Supported annotation semantics for array-based benchmarking.
- class gene_calling_benchmark.label_definition.BenchmarkScope(*values)[source]
-
Metric scopes available in Stage 1 array benchmarking.
- class gene_calling_benchmark.label_definition.LabelConfig(**data)[source]
Bases:
BaseModelComplete label definition for one benchmarking run.
Required fields
- annotation_modeAnnotationMode
Declares whether arrays represent a single exon-like class or a transcript-anatomy label set with explicit UTR/CDS semantics.
- background_labelint
Token for non-coding / intergenic / background regions.
Mode-specific required fields
- EXON_INTRON
exon_label- UTR_CDS_INTRON
cds_label,five_prime_utr_label,three_prime_utr_label
Optional semantic roles
- intron_labelint | None
Token for intronic nucleotides.
- splice_donor_labelint | None
Token for the 5’ donor splice site.
- splice_acceptor_labelint | None
Token for the 3’ acceptor splice site.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod default_exon_intron()[source]
Canonical
EXON_INTRONconfig so GFF users need not pick tokens.Tokens:
background=8,exon=0,intron=2,splice_donor=1,splice_acceptor=3(the same scheme asBEND_LABEL_CONFIG). The integers are an internal array-encoding detail; only their distinctness matters.- Return type:
- classmethod default_utr_cds_intron()[source]
Canonical
UTR_CDS_INTRONconfig with explicit UTR/CDS/intron tokens.Tokens:
background=8,cds=0,five_prime_utr=4,three_prime_utr=5,intron=2,splice_donor=1,splice_acceptor=3. Mirrors the anatomy example in the README; the integers are an internal encoding detail.- Return type:
- scope_tokens(scope)[source]
Return the positive-token set for one benchmark scope.
- Return type:
- Parameters:
scope (BenchmarkScope | str)
- available_scopes()[source]
Return the metric scopes available for this label configuration.
- Return type:
- out_of_scope_labels()[source]
Exonic-content tokens demoted to background under
evaluation_scope.These are the labels
STATE_TRANSITIONScollapses before analysis (viaeval.preprocessing.collapse_out_of_scope_content), so transition plots omit them too.5'/3' UTRundercdsscope; empty under the defaulttranscript_exonscope and inEXON_INTRONmode. INTRON and splice labels are never inscope_tokensand so are always kept.
- Parameters:
annotation_mode (AnnotationMode)
evaluation_scope (BenchmarkScope)
background_label (int)
exon_label (int | None)
cds_label (int | None)
five_prime_utr_label (int | None)
three_prime_utr_label (int | None)
intron_label (int | None)
splice_donor_label (int | None)
splice_acceptor_label (int | None)
- class gene_calling_benchmark.label_definition.EvalMetrics(*values)[source]
Bases:
EnumAvailable evaluation metric groups.
Each value answers one clear question about prediction quality:
INDEL– “What structural errors exist?” 5’/3’ extensions/deletions, whole insertions/deletions, splits/joins.REGION_DISCOVERY– “Did we find the right regions?” Four coherent detection P/R tiers nested by strictness:neighborhood_hit(any overlap) ⊇internal_hit(pred ⊆ GT) andfull_coverage_hit(pred ⊇ GT) ⊇perfect_boundary_hit(exact boundaries). Each hardens its FP so a matched-but-wrong-shape pair is booked as both FP and FN;internal_hitvsfull_coverage_hitgive the direction of the boundary error (under- vs over-extension).BOUNDARY_EXACTNESS– “How precise are the boundaries?” Scope-aware IoU stats, bias/reliability landscape, and boundary flags.NUCLEOTIDE_CLASSIFICATION– “Per-base, how accurate is it?” Binary per-scope outputs; scope depends on annotation mode.PHASE_DRIFT– “Is the CDS reading phase preserved?” CDS-only per-position reading-phase deviation. Measures relative CDS-base count drift between GT and prediction; it is a structural comparison signal, not a biological frameshift-mutation detector.STRUCTURAL_COHERENCE– “Is the segment chain correct as a whole?” Scope-aware chain comparison, transcript classification, and segment count diagnostics.DIAGNOSTIC_DEPTH– “Why is the prediction structurally wrong?” Scope-aware segment-length EMD and position-bias summaries.STATE_TRANSITIONS– “Where do label transitions go wrong?” GT transition confusion matrices plus classified false transitions (late-catchup / premature / spurious). Honoursevaluation_scope: out-of-scope exonic content is demoted to background before analysis, so undercdsscope 5’/3’ UTR read as NONCODING (a UTR-aware prediction is not penalised against a CDS-only GT). INTRON and splice labels are kept; the defaulttranscript_exonscope demotes nothing.
- gene_calling_benchmark.label_definition.SEMANTIC_BOUNDARY_ORDER: tuple[str, ...] = ('five_prime_terminal_exon', 'internal_exon', 'three_prime_terminal_exon', 'single_exon_gene')
Canonical display order for the four semantic exon-position categories.
- gene_calling_benchmark.label_definition.semantic_boundary_label(left, right)[source]
Map a GT flank pair to a biological exon-position category.
A flank is terminal when it is outside the intron chain:
"NONCODING"(intergenic),"none"(sequence edge), or a UTR label ("FIVE_PRIME_UTR"/"THREE_PRIME_UTR"— marks the CDS start/stop-codon boundary in UTR_CDS_INTRON mode)."INTRON"is the only internal flank.Returns one of the four values in
SEMANTIC_BOUNDARY_ORDER.