def translate(rna): table = codon_table('rna') peptide = '' for nt in range(0, len(rna), 3): codon = rna[nt:nt + 3] aa = table.get(codon, '*') if aa != '*': peptide += aa else: break return peptide
def translate(rna): table = codon_table('rna') peptide = '' for nt in range(0, len(rna), 3): codon = rna[nt:nt+3] aa = table.get(codon, '*') if aa != '*': peptide += aa else: break return peptide
def translate(string): codons = codon_table('dna') peptide = '' # Translate the rna sequence. for nt in range(0, len(string), 3): codon = string[nt:nt+3] aa = codons.get(codon, '*') if aa != '*': peptide += aa else: break return peptide
def raw_translate(seq): ''' Translate all 6 ORFs (3 for the forward strand, 3 for the reverse). ''' table = codon_table('dna') peptides = ['' for x in range(6)] rev = reverse_complement(seq) for i in range(3): for j in range(i, len(seq), 3): codon = seq[j:j+3] peptides[i] += table.get(codon, '-') for j in range(i, len(rev), 3): codon = rev[j:j+3] peptides[i+3] += table.get(codon, '-') return peptides
def translate(string): ''' rosalind problems sometimes have 'rna' sequences with thymine in them ''' codons = codon_table() peptide = '' ''' translate the rna sequence ''' for nt in range(0, len(string), 3): codon = string[nt:nt + 3] aa = codons.get(codon, '*') if aa != '*': peptide += aa else: break if peptide != '': return (peptide) else: return ('No exon found.')
def raw_translate(seq): ''' Translate all 6 ORFs (3 for the forward strand, 3 for the reverse). ''' table = rosalind_utils.codon_table() peptides = ['' for x in range(6)] rev = rosalind_utils.rev_comp(seq) for i in range(3): for j in range(i, len(seq), 3): codon = seq[j:j + 3] aa = table.get(codon, '-') peptides[i] += aa for j in range(i, len(rev), 3): codon = rev[j:j + 3] aa = table.get(codon, '-') peptides[i + 3] += aa return (peptides)
def translate(string): ''' rosalind problems sometimes have 'rna' sequences with thymine in them ''' codons = codon_table() peptide = '' ''' translate the rna sequence ''' for nt in range(0, len(string), 3): codon = string[nt:nt+3] aa = codons.get(codon, '*') if aa != '*': peptide += aa else: break if peptide != '': return(peptide) else: return('No exon found.')
def raw_translate(seq): ''' Translate all 6 ORFs (3 for the forward strand, 3 for the reverse). ''' table = rosalind_utils.codon_table() peptides = ['' for x in range(6)] rev = rosalind_utils.rev_comp(seq) for i in range(3): for j in range(i, len(seq), 3): codon = seq[j:j+3] aa = table.get(codon,'-') peptides[i] += aa for j in range(i, len(rev), 3): codon = rev[j:j+3] aa = table.get(codon,'-') peptides[i+3] += aa return(peptides)