fatmacankara commited on
Commit
983e197
·
1 Parent(s): d725c32

Update code/add_3Dalignment.py

Browse files
Files changed (1) hide show
  1. code/add_3Dalignment.py +18 -3
code/add_3Dalignment.py CHANGED
@@ -233,8 +233,23 @@ def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chai
233
  atomSequence = ''.join([three_to_one(i[3]) for i in atoms])
234
  coords = [[i[6] ,i[7] ,i[8]] for i in atoms]
235
  resnums_for_sasa = [i[5] for i in atoms]
236
- """
237
- else:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  atomSequence = ''
239
  coords = []
240
  resnums_for_sasa = []
@@ -244,7 +259,7 @@ def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chai
244
  atomSequence += threeToOne(line[17:20].strip())
245
  coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
246
  resnums_for_sasa.append(line[22:26].strip())
247
- """
248
  aligner.mode = 'local'
249
  aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
250
  aligner.open_gap_score = -11
 
233
  atomSequence = ''.join([three_to_one(i[3]) for i in atoms])
234
  coords = [[i[6] ,i[7] ,i[8]] for i in atoms]
235
  resnums_for_sasa = [i[5] for i in atoms]
236
+ elif source == 'SWISSMODEL':
237
+ atomSequence = ''
238
+ coords = []
239
+ resnums_for_sasa = []
240
+ with open(pdb_path, encoding="utf8") as f:
241
+ for line in f.readlines():
242
+ if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21].upper() == chain.upper():
243
+ atomSequence += threeToOne(line[17:20].strip())
244
+ coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
245
+ resnums_for_sasa.append(line[22:26].strip())
246
+ elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
247
+ atomSequence += threeToOne(line[17:20].strip())
248
+ coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
249
+ resnums_for_sasa.append(line[22:26].strip())
250
+
251
+
252
+ elif source == 'MODBASE':
253
  atomSequence = ''
254
  coords = []
255
  resnums_for_sasa = []
 
259
  atomSequence += threeToOne(line[17:20].strip())
260
  coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
261
  resnums_for_sasa.append(line[22:26].strip())
262
+
263
  aligner.mode = 'local'
264
  aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
265
  aligner.open_gap_score = -11