RNA Splicing

Intermediate Bioinformatics Splicing Intron Translation
Significance:

Eukaryotic genes are interrupted by introns that the spliceosome excises before the ribosome ever
sees the transcript. Splicing is why one gene can encode several proteins, and getting it wrong is
the mechanism behind a large class of genetic disease. This problem chains all three steps of the
Central Dogma together: excise, transcribe, translate.

Statement

You are given a DNA string followed by a collection of introns.

Remove every occurrence of each intron from the DNA string, processing the introns in the
order they are given. Then transcribe the remaining sequence to RNA (T becomes U) and
translate it into a protein, stopping before the first stop codon.

The first line holds n, the number of lines that follow. Of those n lines, the first is the
DNA string
and the remaining n - 1 are the introns.

Print the resulting protein string on one line.

Input — read from standard input
Variable Type Description
n
line 1
int How many lines follow (1 DNA string + the introns)
2 <= n <= 15
sequences
line 2
list[str] First entry is the DNA string; the rest are introns to excise
DNA <= 1000 characters, uppercase A, C, G, T only

These variables are already read for you in the starter code on the right.

Output

str the translated protein string, stop codon excluded

Sample Cases
Sample 1
Input
3
ATGGTCTACATAGCTGACAAACAGCACGTAGCAATCGGTCGAATGTCTATGGGGAGCGGCTTCTTTGGGGACCCGCATTATTAAGAGGAGATTGGGCCCCAGTTAAATAGTCTCGACTAACTCTCAAGCTTACAACCTGTCGCACCGTAGCTTAAATGAATGGCTATGTTGCCGCTCATGACAATTAGGTCTCCT
ATCGGTCGAA
ATCGGTCGAGCGTGT
Expected Output
MVYIADKQHVACLWGAASLGTRIIKRRLGPS
Both introns are excised, then the remainder is transcribed and translated.
Sample 2
Input
2
ATGTAA
GGG
Expected Output
M
The intron never occurs, so ATG translates to M and TAA halts translation.

Submit also runs your code against 4 hidden test cases. Hidden inputs are never shown — if one fails you'll get its number and a description of the mismatch, not the data.

Constraints
  • 2 <= n <= 15 (so there is always at least one intron)
  • The DNA string is at most 1000 characters
  • After excision the remaining length is always a multiple of 3
  • Introns are removed in the order given, and all occurrences of each are removed
Further Reading
  • str.replace(intron, "") removes every occurrence of an intron in one call.
  • Reuse your translation table from Translating RNA into Protein.

My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Expected: n (int), sequences (list[str])
Next Problem
Overlap Graphs