Beispiel #1
0
#!/usr/bin/env python

import sys
from Bio import SeqIO
from os.path import exists

from dark.aa import CODONS

START_CODON = 'ATG'
STOP_CODONS = {'TAA', 'TAG', 'TGA'}
CODON_TO_AA = {}

START_AA = 'M'
STOP_AA = '*'

for aa, codons in CODONS.items():
    for codon in codons:
        CODON_TO_AA[codon] = aa

for codon in STOP_CODONS:
    CODON_TO_AA[codon] = STOP_AA

_rcTable = str.maketrans('ACGT', 'TGCA')


def revcomp(s):
    """
    Reverse complement a nucleotide string.
    """
    return s.translate(_rcTable)[::-1]