From 32e4019b48f48447bf5661276adc1d7c0bae0344 Mon Sep 17 00:00:00 2001 From: rav4s Date: Wed, 11 Nov 2020 17:49:50 -0600 Subject: [PATCH] made it recognize first stop codon --- converter.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/converter.py b/converter.py index 3bb4373..165400a 100644 --- a/converter.py +++ b/converter.py @@ -33,19 +33,19 @@ def find_start(mrna): quit() def find_stop(mrna): - if "UAA" in mrna: - print("UAA STOP codon found") - stop_index = mrna.index("UAA") - elif "UAG" in mrna: - print("UAG STOP codon found") - stop_index = mrna.index("UAG") - elif "UGA" in mrna: - print("UGA STOP codon found") - stop_index = mrna.index("UGA") - else: - print("No STOP codon found. Exiting...") - quit() - return stop_index + for i in mrna: + if "UAA" in i: + print("UAA STOP codon found") + stop_index = mrna.index("UAA") + elif "UAG" in i: + print("UAG STOP codon found") + stop_index = mrna.index("UAG") + elif "UGA" in i: + print("UGA STOP codon found") + stop_index = mrna.index("UGA") + else: + continue + return stop_index def break_into_codons(mrna): n = 3