simonduerr commited on
Commit
16bde42
·
verified ·
1 Parent(s): ff98dc4

Update inference_app.py

Browse files
Files changed (1) hide show
  1. inference_app.py +20 -1
inference_app.py CHANGED
@@ -155,8 +155,27 @@ def predict (input_sequence, input_ligand, input_protein):
155
  [10,10,10],
156
  )
157
  os.system("pdb_rplresname -UNL:LIG /usr/src/app/docking_pose.pdb > /usr/src/app/docking_pose_renamed.pdb")
158
- os.system("cat {input_protein.name} /usr/src/app/docking_pose_renamed.pdb > /usr/src/app/output.pdb")
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  #os.system(f"pdb_merge {input_protein.name} /usr/src/app/docking_pose_renamed.pdb > /usr/src/app/output.pdb")
161
  end_time = time.time()
162
  run_time = end_time - start_time
 
155
  [10,10,10],
156
  )
157
  os.system("pdb_rplresname -UNL:LIG /usr/src/app/docking_pose.pdb > /usr/src/app/docking_pose_renamed.pdb")
158
+ parser = PDB.PDBParser(QUIET=True)
159
 
160
+ # Parse the PDB files
161
+ structure1 = parser.get_structure('Structure1', input_protein.name)
162
+ structure2 = parser.get_structure('Structure2', "/usr/src/app/docking_pose_renamed.pdb")
163
+
164
+ # Create a new structure for the combined output
165
+ combined_structure = PDB.Structure.Structure('Combined_Structure')
166
+
167
+ # Add models from the first structure
168
+ for model in structure1:
169
+ combined_structure.add(model)
170
+
171
+ # Add models from the second structure
172
+ for model in structure2:
173
+ combined_structure.add(model)
174
+
175
+ # Save the combined structure to the output file
176
+ io = PDB.PDBIO()
177
+ io.set_structure(combined_structure)
178
+ io.save("/usr/src/app/output.pdb")
179
  #os.system(f"pdb_merge {input_protein.name} /usr/src/app/docking_pose_renamed.pdb > /usr/src/app/output.pdb")
180
  end_time = time.time()
181
  run_time = end_time - start_time