This problem asks:

Given: An RNA string s corresponding to a strand of mRNA (of length at most 10 kbp).

Return: The protein string encoded by s.

Restate the problem

They’re going to send me a file with an RNA string in it. I need to return the protein sequence that RNA string codes for.

Solution steps

First, I did some reading to learn about the RNA Codon table and how every three base-pairs in an RNA string work together to make a codon which translates to a protein.

This function in the Bio.Seq module sounds like it should do the trick.

I found the specifics of how to work with Bio.Seq.translate() here.

Bio.Seq.translate() uses an asterisk as the stop symbol by default, but there’s a parameter, stop_symbol, that I can set to ‘’ to omit the asterisk.

My full solution code is here.

Problem-solving concepts

Finding the right function in biopython was the only step in solving this problem. Reading the RNA string was done with code I had written for previous challenges, and it only took two lines to pass the RNA string to the translator and handle the results:

def prot(file_path):
    seq = Seq(read_rna_sequence(file_path))
    return str(seq.translate(stop_symbol=''))