Hi!
I want to reverse translate a short protein sequence (around 50 aa) to DNA sequence using all possible codons for all the positions. If Glu is GAA and GAG, I want to have a sequence variants with both. So as a result I want to have a collection of all possible DNA sequences that could have made this protein (regardless the codon usage).
Is there any tool like this available? If not what's the fastest way to obtain such file?
Thank you!
3 answers
Interesting question - I never thought of it that way. I ended up with something like this:
import itertools
d = {
'A': ['GCA', 'GCC', 'GCG', 'GCT'],
'C': ['TGC', 'TGT'],
'D': ['GAC', 'GAT'],
'E': ['GAA', 'GAG'],
'F': ['TTC', 'TTT'],
'G': ['GGA', 'GGC', 'GGG', 'GGT'],
'H': ['CAC', 'CAT'],
'I': ['ATA', 'ATC', 'ATT'],
'K': ['AAA', 'AAG'],
'L': ['CTA', 'CTC', 'CTG', 'CTT', 'TTA', 'TTG'],
'M': ['ATG'],
'N': ['AAC', 'AAT'],
'P': ['CCA', 'CCC', 'CCG', 'CCT'],
'Q': ['CAA', 'CAG'],
'R': ['AGA', 'AGG', 'CGA', 'CGC', 'CGG', 'CGT'],
'S': ['AGC', 'AGT', 'TCA', 'TCC', 'TCG', 'TCT'],
'T': ['ACA', 'ACC', 'ACG', 'ACT'],
'V': ['GTA', 'GTC', 'GTG', 'GTT'],
'W': ['TGG'],
'Y': ['TAC', 'TAT'],
'_': ['TAA', 'TAG', 'TGA'],
}
def generator(protein):
l = [d[aa] for aa in protein]
for comb in itertools.product(*l):
yield "".join(comb)
if __name__ == '__main__':
import sys
protein_seq = sys.argv[1]
g = generator(protein_seq)
for dna_seq in g:
print(dna_seq)
Run:
python script.py MKS
Output:
ATGAAAAGC
ATGAAAAGT
ATGAAATCA
ATGAAATCC
ATGAAATCG
ATGAAATCT
ATGAAGAGC
ATGAAGAGT
ATGAAGTCA
ATGAAGTCC
ATGAAGTCG
ATGAAGTCT
Well, it is possible, you can use a simple BioPerl/BioPython script to get all codons for an amino acid, but the main question, do you really want that?
If you want to use that to search across a DNA dataset, it is better to encode all DNA into proteins and search in protein levels.
Besides, some amino acids will generate a large combination set, like a run of leucines, it can be encoded by 6 codons, so if you have 50 aa, ti will generate 6**50 combinations.
Log in to answer this question.