score_snp
Computes the log probability change from a single nucleotide variant at the center of a DNA sequence to predict mutation effect.
Instructions
Score the effect of a SNP mutation at the center position of a DNA sequence.
Computes log probabilities for both the original sequence and the sequence with the center nucleotide replaced by the alternative allele, then returns the delta. Recommended sequence length: max_context - 1 for best performance.
This tool is useful for variant effect prediction, where the score delta indicates how much the mutation changes the model's likelihood of the sequence. Negative deltas indicate the mutation decreases likelihood; positive deltas increase it.
Args:
sequence: Reference DNA sequence. Must be at least 3 nucleotides long to have a
well-defined center position. Should contain standard IUPAC nucleotides (A, C, G, T, N).
alternative_allele: Alternative nucleotide at the center position. Must be a single
nucleotide (one of A, C, G, T, N) that differs from the reference nucleotide at the center.
checkpoint: Model checkpoint identifier. If None, uses the default checkpoint.
See list_available_checkpoints() for available options.
reduce_method: Method for aggregating per-token scores. Must be either "mean"
(average log probability across all tokens) or "sum" (sum of all log probabilities).
Returns: Dictionary containing: - checkpoint: The checkpoint identifier used - original_sequence: The input reference sequence (uppercase) - mutated_sequence: The sequence with the mutation applied at center position - center_position: Index of the mutated position (0-indexed) - reference_allele: The original nucleotide at the center position - alternative_allele: The alternative nucleotide used - reduce_method: The reduction method applied - original_score: Log probability score of the reference sequence - mutated_score: Log probability score of the mutated sequence - score_delta: Difference (mutated_score - original_score). Indicates mutation effect.
Raises: AssertionError: If sequence length < 3, alternative_allele is not a single valid nucleotide, sequence contains invalid nucleotides, or alternative_allele matches the reference nucleotide.
Example: >>> result = score_snp("ATCGATCG", "A") # Center is T, mutate to A >>> print(f"Score delta: {result['score_delta']}") >>> print(f"Original: {result['original_sequence']}") >>> print(f"Mutated: {result['mutated_sequence']}")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sequence | Yes | ||
| checkpoint | No | ||
| reduce_method | No | mean | |
| alternative_allele | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||