Spaces:
Sleeping
Sleeping
fatmacankara
commited on
Commit
•
d629d2c
1
Parent(s):
1c889af
Update code/add_alignment.py
Browse files- code/add_alignment.py +15 -26
code/add_alignment.py
CHANGED
@@ -28,32 +28,21 @@ def convert_non_standard_amino_acids(sequence):
|
|
28 |
return converted_sequence
|
29 |
def do_alignment(identifier, uniprotSequence, pdbSequence, alignment_path):
|
30 |
print(f'Aligning Datapoint: {identifier}')
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
print('
|
46 |
-
print(aligner.align(uniprotSequence, pdbSequence))
|
47 |
-
alignments = aligner.align(uniprotSequence, pdbSequence)
|
48 |
-
alignments = (list(alignments))
|
49 |
-
alignment_list = []
|
50 |
-
for alignment in alignments:
|
51 |
-
#f.write(str(alignment))
|
52 |
-
#f.write('\n')
|
53 |
-
#f.write('\n')
|
54 |
-
alignment = (str(alignment).strip().split('\n'))
|
55 |
-
alignment = [''.join(['.' if m == ' ' else m for m in x]) for x in alignment]
|
56 |
-
alignment_list.append(alignment)
|
57 |
print(alignment_list)
|
58 |
return alignment_list
|
59 |
|
|
|
28 |
return converted_sequence
|
29 |
def do_alignment(identifier, uniprotSequence, pdbSequence, alignment_path):
|
30 |
print(f'Aligning Datapoint: {identifier}')
|
31 |
+
if len(pdbSequence) >= 1:
|
32 |
+
uniprotSequence = convert_non_standard_amino_acids(uniprotSequence)
|
33 |
+
pdbSequence = convert_non_standard_amino_acids(pdbSequence)
|
34 |
+
aligner.mode = 'local'
|
35 |
+
aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
|
36 |
+
aligner.open_gap_score = -11
|
37 |
+
aligner.extend_gap_score = -1
|
38 |
+
alignments = aligner.align(uniprotSequence, pdbSequence)
|
39 |
+
alignments = (list(alignments))
|
40 |
+
alignment_list = []
|
41 |
+
for alignment in alignments:
|
42 |
+
alignment = (str(alignment).strip().split('\n'))
|
43 |
+
alignment = [''.join(['.' if m == ' ' else m for m in x]) for x in alignment]
|
44 |
+
alignment_list.append(alignment)
|
45 |
+
print('ALIGNMENT LIST')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
print(alignment_list)
|
47 |
return alignment_list
|
48 |
|