fatmacankara commited on
Commit
d9d6eff
·
1 Parent(s): 31914fa

Update code/add_3Dalignment.py

Browse files
Files changed (1) hide show
  1. code/add_3Dalignment.py +7 -28
code/add_3Dalignment.py CHANGED
@@ -235,44 +235,23 @@ def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chai
235
  resnums_for_sasa = [i[5] for i in atoms]
236
 
237
  else:
238
- if line[0:7].strip() == 'ATOM' and line[13:15].strip() == 'CA':
239
- atomSequence += threeToOne(line[17:20].strip())
240
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
241
- resnums_for_sasa.append(line[22:26].strip())
242
-
243
- """
244
- atomSequence = ''
245
- coords = []
246
- resnums_for_sasa = []
247
- with open(pdb_path, encoding="utf8") as f:
248
- for line in f.readlines():
249
- if source != 'MODBASE':
250
- if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21].upper() == chain.upper():
251
- atomSequence += threeToOne(line[17:20].strip())
252
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
253
- resnums_for_sasa.append(line[22:26].strip())
254
- elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
255
- atomSequence += threeToOne(line[17:20].strip())
256
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
257
- resnums_for_sasa.append(line[22:26].strip())
258
- else:
259
  if line[0:7].strip() == 'ATOM' and line[13:15].strip() == 'CA':
260
  atomSequence += threeToOne(line[17:20].strip())
261
  coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
262
  resnums_for_sasa.append(line[22:26].strip())
263
- """
264
- #f = open(Path(path_3D_alignment / f'{identifier}_{pdbID}_{str(chain)}_alignment.txt'),"w")
265
-
266
  aligner.mode = 'local'
267
  aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
268
  aligner.open_gap_score = -11
269
  aligner.extend_gap_score = -1
270
  alignments = aligner.align(pdbSequence, atomSequence)
271
  alignments = (list(alignments))
272
- #for alignment in alignments:
273
- # f.write(str(alignment))
274
- # f.write('\n')
275
- # f.write('\n')
276
  return alignments, coords, resnums_for_sasa
277
  elif mode==2:
278
  atomSequence = ''
 
235
  resnums_for_sasa = [i[5] for i in atoms]
236
 
237
  else:
238
+ atomSequence = ''
239
+ coords = []
240
+ resnums_for_sasa = []
241
+ with open(pdb_path, encoding="utf8") as f:
242
+ for line in f.readlines():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  if line[0:7].strip() == 'ATOM' and line[13:15].strip() == 'CA':
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
251
  aligner.extend_gap_score = -1
252
  alignments = aligner.align(pdbSequence, atomSequence)
253
  alignments = (list(alignments))
254
+
 
 
 
255
  return alignments, coords, resnums_for_sasa
256
  elif mode==2:
257
  atomSequence = ''