1010import yaml
1111
1212from dlstbx .util .mvs .helpers import (
13- find_residue_by_name ,
1413 save_cropped_map ,
1514)
1615from dlstbx .util .mvs .viewer_pandda import gen_html_pandda
1716from dlstbx .util .pandda import (
1817 get_contact_chain ,
1918 get_pandda_settings ,
20- map_sigma ,
2119 mask_map ,
2220 merge_build ,
2321 read_pandda_map ,
@@ -199,38 +197,38 @@ def run(self):
199197 restricted_pdb_file ,
200198 )
201199
202- cifs = list (ligand_dir .glob ("*.cif" ))
203- cut = map_sigma (restricted_build_dmap )
204-
205- rhofit_log = dataset_pdir / "rhofit.log"
206- attachments .extend ([event_map , z_map , rhofit_log ])
207- rhofit_command = f"module load buster; source { PANDDA_2_DIR } /venv/bin/activate; \
208- { PANDDA_2_DIR } /scripts/pandda_rhofit.sh -pdb { restricted_pdb_file } -map { restricted_build_dmap } -mtz { mtz_file } -cif { cifs [0 ]} -out { out_dir } -cut { cut } > { rhofit_log } ;"
209-
210- self .log .info (f"Running PanDDA Rhofit command: { rhofit_command } " )
211-
212- try :
213- subprocess .run (
214- rhofit_command ,
215- shell = True ,
216- capture_output = True ,
217- text = True ,
218- cwd = panddas_dir ,
219- check = True ,
220- timeout = 60 * 60 ,
221- )
222-
223- except subprocess .CalledProcessError as e :
224- self .log .error (f"Rhofit command: '{ rhofit_command } ' failed" )
225- self .log .info (e .stdout )
226- self .log .error (e .stderr )
227- self .send_attachments_to_ispyb (attachments , batch )
200+ # cifs = list(ligand_dir.glob("*.cif"))
201+ # cut = map_sigma(restricted_build_dmap)
202+
203+ # rhofit_log = dataset_pdir / "rhofit.log"
204+ attachments .extend ([event_map , z_map ]) # rhofit_log
205+ # rhofit_command = f"module load buster; source {PANDDA_2_DIR}/venv/bin/activate; \
206+ # {PANDDA_2_DIR}/scripts/pandda_rhofit.sh -pdb {restricted_pdb_file} -map {restricted_build_dmap} -mtz {mtz_file} -cif {cifs[0]} -out {out_dir} -cut {cut} > {rhofit_log};"
207+
208+ # self.log.info(f"Running PanDDA Rhofit command: {rhofit_command}")
209+
210+ # try:
211+ # subprocess.run(
212+ # rhofit_command,
213+ # shell=True,
214+ # capture_output=True,
215+ # text=True,
216+ # cwd=panddas_dir,
217+ # check=True,
218+ # timeout=60 * 60,
219+ # )
220+
221+ # except subprocess.CalledProcessError as e:
222+ # self.log.error(f"Rhofit command: '{rhofit_command}' failed")
223+ # self.log.info(e.stdout)
224+ # self.log.error(e.stderr)
225+ # self.send_attachments_to_ispyb(attachments, batch)
228226
229227 # -------------------------------------------------------
230228 # Ligand scoring
231229 build_scores = {}
232- build_dir = out_dir / "rhofit"
233- rhofit_builds = list (build_dir .glob ("Hit*.pdb" ))
230+ # build_dir = out_dir / "rhofit"
231+ # rhofit_builds = list(build_dir.glob("Hit*.pdb"))
234232
235233 # Include any PanDDA2 internal autobuilds
236234 pandda2_build = next (
@@ -239,33 +237,33 @@ def run(self):
239237 if pandda2_build :
240238 build_scores [pandda2_build ] = event_score
241239
242- if not rhofit_builds and not pandda2_build :
240+ if not pandda2_build : # and not rhofit_builds
243241 self .log .info (f"No autobuilds for { dtag } , can't continue" )
244242 return False
245243
246- self .log .info (f"Running Ligand Score routine for { build_dir } " )
244+ # self.log.info(f"Running Ligand Score routine for {build_dir}")
247245
248246 # Iterate over rhofit builds and score each one
249- for build_path in rhofit_builds :
250- ligand_score = build_dir / f"{ build_path .stem } .txt"
247+ # for build_path in rhofit_builds:
248+ # ligand_score = build_dir / f"{build_path.stem}.txt"
251249
252- st = gemmi .read_structure (str (build_path ))
253- chain , res = find_residue_by_name (st , "LIG" )
254- ligand_id = chain .name + f"/{ res .seqid .num } "
250+ # st = gemmi.read_structure(str(build_path))
251+ # chain, res = find_residue_by_name(st, "LIG")
252+ # ligand_id = chain.name + f"/{res.seqid.num}"
255253
256- score_command = f"source { PANDDA_2_DIR } /venv/bin/activate; \
257- python { PANDDA_2_DIR } /scripts/ligand_score.py --mtz_path={ mtz_file } --zmap_path={ z_map } --ligand_id={ ligand_id } --structure_path={ build_path } --out_path={ ligand_score } "
254+ # score_command = f"source {PANDDA_2_DIR}/venv/bin/activate; \
255+ # python {PANDDA_2_DIR}/scripts/ligand_score.py --mtz_path={mtz_file} --zmap_path={z_map} --ligand_id={ligand_id} --structure_path={build_path} --out_path={ligand_score}"
258256
259- try :
260- os .system (score_command )
257+ # try:
258+ # os.system(score_command)
261259
262- except Exception as e :
263- self .log .error (f"Ligand score command: '{ score_command } ' failed" )
264- self .log .info (e .stdout )
265- self .log .error (e .stderr )
260+ # except Exception as e:
261+ # self.log.error(f"Ligand score command: '{score_command}' failed")
262+ # self.log.info(e.stdout)
263+ # self.log.error(e.stderr)
266264
267- with open (ligand_score , "r" ) as file :
268- build_scores [build_path ] = float (file .read ().strip ())
265+ # with open(ligand_score, "r") as file:
266+ # build_scores[build_path] = float(file.read().strip())
269267
270268 best_build_path = max (build_scores , key = lambda _x : build_scores [_x ])
271269 best_score = build_scores [best_build_path ]
0 commit comments