fatmacankara commited on
Commit
711987a
·
1 Parent(s): bceaa8d

Update code/add_3Dalignment.py

Browse files
Files changed (1) hide show
  1. code/add_3Dalignment.py +6 -15
code/add_3Dalignment.py CHANGED
@@ -214,14 +214,13 @@ def get_coords(annot, alignments, coords, resnums_for_sasa, mode):
214
  return np.NaN, np.NaN, np.NaN
215
 
216
 
217
- def get_alignments_3D(identifier, model_num, pdbSequence, source, chain, pdbID, mode,file_format = 'gzip'):
218
  print('In Function')
219
  pdbSequence = convert_non_standard_amino_acids(pdbSequence)
220
  print(pdbSequence)
221
  print(mode, source)
222
  if mode == 1:
223
- if source != 'MODBASE':
224
- print('I am here')
225
  # Step 1: Fetch the PDB file
226
  pdb_url = f"https://files.rcsb.org/download/{pdbID}.pdb"
227
  response = requests.get(pdb_url)
@@ -236,18 +235,10 @@ def get_alignments_3D(identifier, model_num, pdbSequence, source, chain, pdbID,
236
  resnums_for_sasa = [i[5] for i in atoms]
237
 
238
  else:
239
- pdb_url = f"https://files.rcsb.org/download/{pdbID}.pdb"
240
-
241
- response = requests.get(pdbID)
242
- response.raise_for_status() # Check for a successful response
243
-
244
- # Step 2: Parse the PDB file from memory
245
- atoms = [i for i in response.text.split('\n') if i.startswith('ATOM')]
246
- atoms = [i.split() for i in atoms]
247
- atoms = [i for i in atoms if i[2] == 'CA']
248
- atomSequence = ''.join([three_to_one(i[3]) for i in atoms])
249
- coords = [[i[6] ,i[7] ,i[8]] for i in atoms]
250
- resnums_for_sasa = [i[5] for i in atoms]
251
 
252
  """
253
  atomSequence = ''
 
214
  return np.NaN, np.NaN, np.NaN
215
 
216
 
217
+ def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chain, pdbID, mode, path_3D_alignment,file_format = 'gzip'):
218
  print('In Function')
219
  pdbSequence = convert_non_standard_amino_acids(pdbSequence)
220
  print(pdbSequence)
221
  print(mode, source)
222
  if mode == 1:
223
+ if source == 'PDB':
 
224
  # Step 1: Fetch the PDB file
225
  pdb_url = f"https://files.rcsb.org/download/{pdbID}.pdb"
226
  response = requests.get(pdb_url)
 
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 = ''