PEATDB/DNAtool/mutation.py
def translate(DNA_sequence):
    """Translate the DNA sequence in three forward frames"""
    #
    # Check the sequence first
    #
    ok,DNA_sequence=check_DNA(DNA_sequence)
    if not ok:
        print
        print 'DNA sequence not ok'
        print DNA_sequence
        print
        return None
    #
    # Translate
    #
    import string
    translation_3=[]
    translation_1=[]
    for start in range(3):
        position=start
        thisAA=''
        thisframe3=[]
        thisframe1=''
        while position<len(DNA_sequence):
            thisAA=thisAA+DNA_sequence[position]
            position=position+1
            if len(thisAA)==3:
                thisframe1=thisframe1+three_to_one[string.upper(genetic_code[thisAA])]
                thisframe3.append(string.upper(genetic_code[thisAA]))
                thisAA=''
        translation_3.append(thisframe3)
        translation_1.append(thisframe1)
    return translation_3,translation_1
Translate the DNA sequence in three forward frames
Translate the DNA sequence in three forward frames
Translate the DNA sequence in three forward frames
def translate(DNA_sequence):
     Check the sequence first
    ok,DNA_sequence=check_DNA(DNA_sequence)
    if not ok:
        print
        print 'DNA sequence not ok'
        print DNA_sequence
        print
        return None
     Translate
    import string
    translation_3=[]
    translation_1=[]
    for start in range(3):
        position=start
        thisAA=''
        thisframe3=[]
        thisframe1=''
        while position<len(DNA_sequence):
            thisAA=thisAA+DNA_sequence[position]
            position=position+1
            if len(thisAA)==3:
                thisframe1=thisframe1+three_to_one[string.upper(genetic_code[thisAA])]
                thisframe3.append(string.upper(genetic_code[thisAA]))
                thisAA=''
        translation_3.append(thisframe3)
        translation_1.append(thisframe1)
    return translation_3,translation_1
def translate ( DNA_sequence ) : ok , DNA_sequence = check_DNA ( DNA_sequence ) if not ok : print print 'DNA sequence not ok' print DNA_sequence print return None import string translation_3 = [ ] translation_1 = [ ] for start in range ( 3 ) : position = start thisAA = '' thisframe3 = [ ] thisframe1 = '' while position < len ( DNA_sequence ) : thisAA = thisAA + DNA_sequence [ position ] position = position + 1 if len ( thisAA ) == 3 : thisframe1 = thisframe1 + three_to_one [ string . upper ( genetic_code [ thisAA ] ) ] thisframe3 . append ( string . upper ( genetic_code [ thisAA ] ) ) thisAA = '' translation_3 . append ( thisframe3 ) translation_1 . append ( thisframe1 ) return translation_3 , translation_1
Translate the DNA sequence in three forward frames
Translate the DNA sequence in three forward frames
"""Translate the DNA sequence in three forward frames""" # # Check the sequence first # # # Translate #
DNA_sequence