-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq51.py
More file actions
33 lines (26 loc) · 857 Bytes
/
q51.py
File metadata and controls
33 lines (26 loc) · 857 Bytes
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
from Bio.Seq import Seq #Using Biopython to find the reverse complement.
f = open("rosalind_dbru.txt","r") #extracting the input from a file.
inputv = f.readlines()
s = []
for i in inputv:
s.append(i.strip())
srv = []
for i in s: #determining the revese complement.
a = Seq(i)
srv.append("%s" %a.reverse_complement())
a = []
b = []
for i in range(len(s)):
p = s[i][:-1]
q = s[i][1:]
pq = (p,q)
a.append(pq)
for i in range(len(s)): #Using set to determine adjcency list and to idenotify unique sets.
r = srv[i][:-1]
s = srv[i][1:]
rs = (r, s)
b.append(rs)
result = set(a) #Using set to identify unique sets.
result.update(b)
for (a,b) in sorted(result): #displaying the result.
print '(%s, %s)' %(a,b)