Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back-propogation of protein motif n #4

Closed
ambarishK opened this issue Jul 8, 2019 · 3 comments
Closed

back-propogation of protein motif n #4

ambarishK opened this issue Jul 8, 2019 · 3 comments
Labels

Comments

@ambarishK
Copy link

ambarishK commented Jul 8, 2019

Hi

Please send me code snippet to back-translate protein motif and print all possible nucleotide sequences to code the given motif.

@jfjlaros
Copy link
Member

jfjlaros commented Jul 8, 2019

I am afraid you are in the wrong place. This project deals with back translations of variants, not of protein sequences.

You might have more luck with Backtranseq.

@jfjlaros jfjlaros closed this as completed Jul 8, 2019
@jkvis
Copy link
Member

jkvis commented Jul 9, 2019

Maybe something like this (untested):

CODONS = {
    'A': ('GCT', 'GCC', 'GCA', 'GCG'),
    'L': ('TTA', 'TTG', 'CTT', 'CTC', 'CTA', 'CTG'),
    'R': ('CGT', 'CGC', 'CGA', 'CGG', 'AGA', 'AGG'),
    'K': ('AAA', 'AAG'),
    'N': ('AAT', 'AAC'),
    'M': ('ATG'),
    'D': ('GAT', 'GAC'),
    'F': ('TTT', 'TTC'),
    'C': ('TGT', 'TGC'),
    'P': ('CCT', 'CCC', 'CCA', 'CCG'),
    'Q': ('CAA', 'CAG'),
    'S': ('TCT', 'TCC', 'TCA', 'TCG', 'AGT', 'AGC'),
    'E': ('GAA', 'GAG'),
    'T': ('ACT', 'ACC', 'ACA', 'ACG'),
    'G': ('GGT', 'GGC', 'GGA', 'GGG'),
    'W': ('TGG'),
    'H': ('CAT', 'CAC'),
    'Y': ('TAT', 'TAC'),
    'I': ('ATT', 'ATC', 'ATA'),
    'V': ('GTT', 'GTC', 'GTA', 'GTG'),
    '*': ('TAA', 'TGA', 'TAG')
}


def back_translate(protein, dna='', pos=0):
    if pos >= len(protein):
        yield dna
    else:
        for codon in sorted(CODONS[protein[pos]]):
            yield from back_translate(protein, dna + codon, pos + 1)


if __name__ == '__main__':
    for dna in back_translate('TEST'):
        print(dna)

@ambarishK
Copy link
Author

Yes. I got it.

Many many thanks. Drop me your email-Id. It is good to share code resources for tool development.

My one is

  1. [email protected]

  2. [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants