-
Notifications
You must be signed in to change notification settings - Fork 3
/
show_kmad_alignment.py
39 lines (28 loc) · 1.03 KB
/
show_kmad_alignment.py
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
from hommod.default_settings import KMAD_EXE, CLUSTALW_EXE
from hommod.controllers.kmad import kmad_aligner
from hommod.controllers.clustal import clustal_aligner
kmad_aligner.kmad_exe = KMAD_EXE
clustal_aligner.clustalw_exe = CLUSTALW_EXE
def gap_equally(ref, ins):
s = ""
j = 0
for i in range(len(ref)):
if ref[i].isalpha():
s += ins[j]
j += 1
else:
s += ref[i]
return s
sequence = "CWAVAVAVGNDGAVAVAVWC"
secstr = "EEEEEEEE EEEEEEEE"
target = "CWAVAVAVAVAVGGGGGGVAVAVAVAVWC"
kmad_alignment = kmad_aligner.align(sequence, secstr, target)
clustal_alignment = clustal_aligner.align({'template': sequence, 'target': target})
print 'kmad'
print kmad_alignment.target_alignment
print gap_equally(kmad_alignment.template_alignment, secstr)
print kmad_alignment.template_alignment
print 'clustal'
print clustal_alignment.aligned_sequences['target']
print gap_equally(clustal_alignment.aligned_sequences['template'], secstr)
print clustal_alignment.aligned_sequences['template']