Skip to main content
Dinucleotide Composition

This constraint is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.


Source
evo-design/proto-language/proto_language/constraint/sequence_composition/dinucleotide_composition_constraint.py
View source
Constraint contributors
Score the distance between observed and reference dinucleotide composition.
The observed overlapping-dinucleotide frequency distribution of each sequence is compared to config.reference_frequencies using the configured distance metric. Lower scores mean the sequence’s nucleotide-pair usage is closer to the reference (natural) composition.

API Reference

ConfigDinucleotideCompositionConfig Source
Configuration for the dinucleotide-composition match constraint.Scores the distance between a sequence’s observed dinucleotide-frequency distribution and a reference distribution. The reference is supplied as a mapping of dinucleotide -> frequency (e.g. derived from natural sequences); RNA (U) keys are folded onto the DNA alphabet (T) and the reference is renormalized to sum to 1.
object
required
Target dinucleotide -> frequency mapping (natural composition profile).
enum
default:"total_variation"
Distribution distance: ‘total_variation’ (0.5*sum|p-q|) or normalized ‘l2’.Options: total_variation, l2
number
default:"1.0"
Multiplier applied to the raw distance before clamping to [0, 1].
ReturnsConstraintOutput
One result per sequence. score is in [0, 1] (0.0 = observed composition matches the reference). metadata carries dinucleotide_distance (the raw, pre-scale distance) and dinucleotide_frequencies (the observed distribution, or None when the sequence is too short).

Usage

python

Metadata