This problem asks:

Given: A DNA string s (of length at most 1 kbp) and a collection of substrings of s acting as introns.

Return: A protein string resulting from transcribing and translating the exons of s.

Restate the problem

Introns don’t get translated into proteins. They’re going to send me a DNA string and I need to delete the introns, then translate the remaining exons into proteins.

Solution steps

First, I read the fasta file and assigned the first DNA string to the variable “sequence”.

Then, I iterated over the remaining DNA strings and removed them from sequence using:

sequence = sequence.replace(intron.seq,'')

Next, I translated sequence into proteins using Biopython.

Finally, I removed the asterisk from the end of the translated protein by printing all but the last character with:

print(sequence.translate()[:-1])

The full code is here.

Python concepts

Nothing new discovered in the process of solving this challenge. There was some string slicing, but nothing novel.

Bioinformatics concepts

Introns and exons are new. These are both complex topics, but all that was necessary to solve this challenge was to know that introns don’t get translated and exons do.