-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPLC
47 lines (42 loc) · 1.13 KB
/
SPLC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from Transcribing_DNA_into_RNA import transcription
from Translating_RNA_into_Protein import translation
def splicing_rna(s,lst):
start = -1
indexes = []
for intron in lst:
for i in range(len(s)):
start = s.find(intron, start + 1)
if start != -1:
indexes.append([start, len(intron)])
else:
break
indexes.sort()
indexes.reverse()
monomers = list(s)
for ind in indexes:
counter = 0
while counter != ind[1]:
monomers.pop(ind[0])
counter += 1
exons = ''.join(monomers)
RNA = transcription(exons)
protein = translation(RNA)
return protein
with open('rosalind_splc6.txt', 'r') as file:
content = file.read()
lst, List= [], []
splited = content.splitlines()
for i in range(len(splited)):
if splited[i][0] == '>':
lst.append(i)
for j in range(len(lst)-1):
i, l = lst[j], ''
i += 1
if len(lst) > j:
while i != lst[j+1]:
l += splited[i]
i += 1
List.append(l)
List.append(splited[-1])
s = List.pop(0)
print(splicing_rna(s, List))