or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/python-levenshtein@0.27.x
tile.json

tessl/pypi-python-levenshtein

tessl install tessl/pypi-python-levenshtein@0.27.0

Python compatibility wrapper for computing string edit distances and similarities using fast Levenshtein algorithms.

Agent Success

Agent success rate when using this tile

88%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.38x

Baseline

Agent success rate without this tile

64%

task.mdevals/scenario-6/

DNA Mutation Detector

A system that analyzes DNA sequences to detect point mutations between two genetic samples.

Overview

You need to implement a mutation detection system that compares two DNA sequences of equal length and identifies how many positions have different nucleotide bases. This is useful in genomics research for tracking genetic variations and mutations.

DNA sequences are represented as strings containing the nucleotide bases: 'A' (Adenine), 'T' (Thymine), 'G' (Guanine), and 'C' (Cytosine).

Requirements

Mutation Counting

Implement a function count_mutations(sequence1, sequence2) that:

  • Accepts two DNA sequence strings of equal length
  • Returns the number of positions where the nucleotides differ
  • Handles both uppercase sequences

Error Handling

The function must validate inputs:

  • Raise a ValueError if the sequences have different lengths
  • Raise a ValueError if either sequence is empty

Test Cases

  • Comparing "ATCG" and "ATCG" returns 0 mutations @test
  • Comparing "ATCG" and "TTCG" returns 1 mutation @test
  • Comparing "AAAA" and "TTTT" returns 4 mutations @test
  • Comparing "ATCGATCG" and "TTCGATCA" returns 3 mutations @test
  • Comparing "ATCG" and "AT" raises ValueError due to length mismatch @test
  • Comparing "" and "" raises ValueError due to empty sequences @test

Implementation

@generates

API

def count_mutations(sequence1: str, sequence2: str) -> int:
    """
    Count the number of point mutations between two DNA sequences.

    Args:
        sequence1: First DNA sequence string
        sequence2: Second DNA sequence string

    Returns:
        Integer count of positions where nucleotides differ

    Raises:
        ValueError: If sequences have different lengths or are empty
    """
    pass

Dependencies { .dependencies }

Levenshtein { .dependency }

Provides fast string comparison algorithms for computing differences between sequences.

@satisfied-by