Beispiel #1
0
def test_insertion_mutation():
    seq = Seq("AACT")
    mutated = mutate.mutate(seq, 1, 'A', 'AG')
    assert(len(mutated) == len(seq) + 1)
    assert(mutated[0] == seq[0])
    assert(mutated[1] == 'A')
    assert(mutated[2] == 'G')
    assert(mutated[3] == 'C')
Beispiel #2
0
def peptide_from_protein_transcript_variant(transcript_id, pos, ref, alt):
    """
    Given an ensembl transcript ID, mutate amino acid `ref` to `alt` at
    position `pos`.
    """
    transcript = _ensembl.get_protein(transcript_id)
    if transcript:
        try:
            return str(mutate(transcript, pos, ref, alt))
        except:
            logging.warning("Failed to mutate transcript %s (%s)",
                            transcript_id,
                            gene_mutation_description(pos, ref, alt))
            return None
    return None
Beispiel #3
0
def peptide_from_protein_transcript_variant(transcript_id, pos, ref, alt):
    """
    Given an ensembl transcript ID, mutate amino acid `ref` to `alt` at
    position `pos`.
    """
    transcript = _ensembl.get_protein(transcript_id)
    if transcript:
        try:
            return str(mutate(transcript, pos, ref, alt))
        except:
            logging.warning(
                "Failed to mutate transcript %s (%s)",
                transcript_id,
                gene_mutation_description(pos, ref, alt)
            )
            return None
    return None
Beispiel #4
0
def test_deletion_mutation():
    seq = Seq("AACT")
    mutated = mutate.mutate(seq, 1, 'ACT', 'T')
    assert(len(mutated) == 2)
    assert(mutated[0] == 'A')
    assert(mutated[1] == 'T')
Beispiel #5
0
def test_snp_mutation():
    seq = Seq("AACCTT")
    mutated = mutate.mutate(seq, 1, 'A', 'G')
    assert(mutated[0] == seq[0])
    assert(mutated[1] == 'G')
    assert(mutated[2] == seq[2])