在线序列转换的工具:
Nucleotide Sequence Translation
Protein Sequence Back-translation
http://bio.lundberg.gu.se/edu/translat.html
http://www.ebi.ac.uk/Tools/st/
http://www.hiv.lanl.gov/content/sequence/TRANSLATE/translate.html
Python 序列转换
beans = "TGACTGTGTTTCTGAACAATAAATGACTTAAACCAGGTATGGCTGCCGATGGTTATCTT"
gencode = {
'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M',
'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT':'T',
'AAC':'N', 'AAT':'N', 'AAA':'K', 'AAG':'K',
'AGC':'S', 'AGT':'S', 'AGA':'R', 'AGG':'R',
'CTA':'L', 'CTC':'L', 'CTG':'L', 'CTT':'L',
'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCT':'P',
'CAC':'H', 'CAT':'H', 'CAA':'Q', 'CAG':'Q',
'CGA':'R', 'CGC':'R', 'CGG':'R', 'CGT':'R',
'GTA':'V', 'GTC':'V', 'GTG':'V', 'GTT':'V',
'GCA':'A', 'GCC':'A', 'GCG':'A', 'GCT':'A',
'GAC':'D', 'GAT':'D', 'GAA':'E', 'GAG':'E',
'GGA':'G', 'GGC':'G', 'GGG':'G', 'GGT':'G',
'TCA':'S', 'TCC':'S', 'TCG':'S', 'TCT':'S',
'TTC':'F', 'TTT':'F', 'TTA':'L', 'TTG':'L',
'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_',
'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'}
basepairs = {'A':'T', 'C':'G', 'G':'C', 'T':'A'}
def translate_frameshifted( sequence ):
translate = ''.join([gencode.get(sequence[3*i:3*i+3],'X') for i in range(len(sequence)//3)])
return translate
def reverse_complement( sequence ):
reversed_sequence = (sequence[::-1])
rc = ''.join([basepairs.get(reversed_sequence[i], 'X') for i in range(len(sequence))])
return rc
print(translate_frameshifted(beans[0:])) # first frame
print(translate_frameshifted(beans[1:])) # second frame
print(translate_frameshifted(beans[2:])) # third frame
print(translate_frameshifted(reverse_complement(beans))) # negative first frame
print(translate_frameshifted(reverse_complement(beans[:len(beans)-1]))) # negative second frame
print(translate_frameshifted(reverse_complement(beans[:len(beans)-2]))) # negative third frame
# This ::-1 syntax in python means reverse the string.
REF
https://www.biostars.org/p/55851/
http://www.soc-bdr.org/rds/authors/unit_tables_conversions_and_genetic_dictionaries/e5202/index_en.html
http://www.hiv.lanl.gov/content/sequence/TRANSLATE/translate.html