Skip to content

Commit

Permalink
Merge pull request #1035 from haddocking/lessio-to-dubug
Browse files Browse the repository at this point in the history
less_io to debug
  • Loading branch information
VGPReys authored Sep 20, 2024
2 parents bcd7454 + a3d6278 commit 9d294f4
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/peptide-cyclisation/cyclise-peptide-full.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run_dir = "run1-cyclise-full"
# and comment the lines under the HPC execution
mode = "local"
ncores = 10
less_io = true
debug = false
concat = 1

# molecules to be docked
Expand Down
2 changes: 1 addition & 1 deletion examples/peptide-cyclisation/cyclise-peptide-test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run_dir = "run1-cyclise-test"
# and comment the lines under the HPC execution
mode = "local"
ncores = 10
less_io = true
debug = false
concat = 1

# molecules to be docked
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_caprieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ def test_caprieval_default(
)


def test_caprieval_less_io(
def test_caprieval_nodebug(
caprieval_module, model_list, expected_ss_data, expected_clt_data
):
caprieval_module.previous_io = MockPreviousIO(path=caprieval_module.path)
caprieval_module.params["less_io"] = True
caprieval_module.params["debug"] = False

caprieval_module.run()

Expand Down
5 changes: 5 additions & 0 deletions integration_tests/test_emref.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def output(self):
def test_emref_defaults(emref_module, calc_fnat):

emref_module.previous_io = MockPreviousIO(path=emref_module.path)
emref_module.params["debug"] = True

emref_module.run()

Expand All @@ -91,6 +92,8 @@ def test_emref_fle(emref_module, calc_fnat):
emref_module.params["fle_end_1 "] = 77
emref_module.params["fle_seg_1 "] = "B"

emref_module.params["debug"] = True

emref_module.run()

assert Path(emref_module.path, "emref_1.pdb").exists()
Expand Down Expand Up @@ -118,6 +121,8 @@ def test_emref_mutliple_fle(emref_module, calc_fnat):
emref_module.params["fle_end_2 "] = 47
emref_module.params["fle_seg_2 "] = "B"

emref_module.params["debug"] = True

emref_module.run()

assert Path(emref_module.path, "emref_1.pdb").exists()
Expand Down
4 changes: 3 additions & 1 deletion integration_tests/test_flexref.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_flexref_defaults(flexref_module, calc_fnat):
flexref_module.run()

assert Path(flexref_module.path, "flexref_1.pdb").exists()
assert Path(flexref_module.path, "flexref_1.out.gz").exists()

fnat = calc_fnat(
model=Path(flexref_module.path, "flexref_1.pdb"),
Expand All @@ -94,6 +93,7 @@ def test_flexref_fle(flexref_module, calc_fnat):
flexref_module.params["fle_end_1 "] = 77
flexref_module.params["fle_seg_1 "] = "B"
flexref_module.params["log_level"] = "verbose"
flexref_module.params["debug"] = True

flexref_module.run()

Expand Down Expand Up @@ -124,6 +124,8 @@ def test_flexref_mutliple_fle(flexref_module, calc_fnat):
flexref_module.params["fle_end_2 "] = 47
flexref_module.params["fle_seg_2 "] = "B"

flexref_module.params["debug"] = True

flexref_module.run()

assert Path(flexref_module.path, "flexref_1.pdb").exists()
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/test_mdref.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def output(self):
def test_mdref_defaults(mdref_module, calc_fnat):

mdref_module.previous_io = MockPreviousIO(path=mdref_module.path)

mdref_module.params["debug"] = True
mdref_module.run()

assert Path(mdref_module.path, "mdref_1.pdb").exists()
Expand All @@ -91,6 +91,8 @@ def test_mdref_fle(mdref_module, calc_fnat):
mdref_module.params["fle_end_1 "] = 77
mdref_module.params["fle_seg_1 "] = "B"

mdref_module.params["debug"] = True

mdref_module.run()

assert Path(mdref_module.path, "mdref_1.pdb").exists()
Expand Down Expand Up @@ -118,6 +120,8 @@ def test_mdref_mutliple_fle(mdref_module, calc_fnat):
mdref_module.params["fle_end_2 "] = 47
mdref_module.params["fle_seg_2 "] = "B"

mdref_module.params["debug"] = True

mdref_module.run()

assert Path(mdref_module.path, "mdref_1.pdb").exists()
Expand Down
1 change: 1 addition & 0 deletions integration_tests/test_restraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_restraints_rigidbody(rigidbody_module):
rigidbody_module.params["unambig_fname"] = Path(GOLDEN_DATA, "unambig.tbl")
rigidbody_module.params["hbond_fname"] = Path(GOLDEN_DATA, "hbond.tbl")
rigidbody_module.params["mode"] = "local"
rigidbody_module.params["debug"] = True

rigidbody_module.run()

Expand Down
5 changes: 3 additions & 2 deletions integration_tests/test_rigidbody.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_rigidbody_local(rigidbody_module):
rigidbody_module.params["mol_fix_origin_1"] = True
rigidbody_module.params["mol_fix_origin_2"] = False
rigidbody_module.params["mode"] = "local"
rigidbody_module.params["debug"] = True

rigidbody_module.run()

Expand All @@ -108,6 +109,7 @@ def test_rigidbody_mpi(rigidbody_module):
rigidbody_module.params["mol_fix_origin_2"] = False
rigidbody_module.params["mode"] = "mpi"
rigidbody_module.params["ncores"] = 1
rigidbody_module.params["debug"] = True

rigidbody_module.run()

Expand All @@ -122,15 +124,14 @@ def test_rigidbody_mpi(rigidbody_module):
assert Path(rigidbody_module.path, f"rigidbody_{i}.inp").stat().st_size > 0


def test_rigidbody_less_io(rigidbody_module):
def test_rigidbody_debug(rigidbody_module):

sampling = 2
rigidbody_module.previous_io = MockPreviousIO(path=rigidbody_module.path)
rigidbody_module.params["sampling"] = sampling
rigidbody_module.params["cmrest"] = True
rigidbody_module.params["mol_fix_origin_1"] = True
rigidbody_module.params["mol_fix_origin_2"] = False
rigidbody_module.params["less_io"] = True

rigidbody_module.run()

Expand Down
3 changes: 3 additions & 0 deletions integration_tests/test_topoaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_topoaa_module_protein(topoaa_module):
topoaa_module.params["mol1"] = {"prot_segid": "A"}
topoaa_module.params["mol2"] = {"prot_segid": "B"}
topoaa_module.params["cns_exec"] = CNS_EXEC
topoaa_module.params["debug"] = True

topoaa_module.run()

Expand Down Expand Up @@ -71,6 +72,7 @@ def test_topoaa_module_ligand(topoaa_module):
topoaa_module.params["delenph"] = False
topoaa_module.params["preprocess"] = False
topoaa_module.params["cns_exec"] = CNS_EXEC
topoaa_module.params["debug"] = True

topoaa_module.run()

Expand All @@ -94,6 +96,7 @@ def test_topoaa_cyclic(topoaa_module):
topoaa_module.params["disulphide_dist"] = 4.0
topoaa_module.params["mol1"] = {"cyclicpept": True}
topoaa_module.params["cns_exec"] = CNS_EXEC
topoaa_module.params["debug"] = True

topoaa_module.run()

Expand Down
4 changes: 2 additions & 2 deletions src/haddock/libs/libcns.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def prepare_cns_input(
ambig_fname: FilePath = "",
native_segid: bool = False,
default_params_path: Optional[Path] = None,
less_io: Optional[bool] = True,
debug: Optional[bool] = False,
seed: Optional[int] = None,
) -> Union[Path, str]:
"""
Expand Down Expand Up @@ -372,7 +372,7 @@ def prepare_cns_input(

inp = default_params + input_str + seed_str + output + segid_str + recipe_str

if less_io:
if not debug:
return inp
else:
inp_file = Path(f"{identifier}_{model_number}.inp")
Expand Down
11 changes: 7 additions & 4 deletions src/haddock/modules/analysis/caprieval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _run(self) -> None:
exec_mode = get_analysis_exec_mode(self.params["mode"])
Engine = get_engine(exec_mode, self.params)

less_io = self.params["less_io"] and self.params["mode"] == "local"
_less_io = self.params["mode"] == "local" and not self.params["debug"]

# Each model is a job; this is not the most efficient way
# but by assigning each model to an individual job
Expand All @@ -133,14 +133,14 @@ def _run(self) -> None:
path=Path("."),
reference=reference,
params=self.params,
less_io=less_io,
debug=not _less_io,
)
)

engine = Engine(jobs)
engine.run()

if less_io and isinstance(engine, Scheduler):
if _less_io and isinstance(engine, Scheduler):
jobs = engine.results
extract_data_from_capri_class(
capri_objects=jobs,
Expand All @@ -151,7 +151,10 @@ def _run(self) -> None:

else:
self.log(
msg="DEPRECATION NOTICE: This execution mode (less_io=False) will no longer be supported in the next version.",
msg=(
"DEPRECATION NOTICE: This execution mode (debug=True) "
"will no longer be supported in the next version."
),
level="warning",
)
jobs = merge_data(jobs)
Expand Down
6 changes: 3 additions & 3 deletions src/haddock/modules/analysis/caprieval/capri.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(
path: Path,
reference: PDBPath,
params: ParamMap,
less_io: Optional[bool] = False,
debug: Optional[bool] = False,
) -> None:
"""
Initialize the class.
Expand Down Expand Up @@ -225,7 +225,7 @@ def __init__(
self.output = self.output_ss_fname
self.identificator = identificator
self.core_model_idx = identificator
self.less_io = less_io
self.debug = debug

def calc_irmsd(self, cutoff: float = 5.0) -> None:
"""Calculate the I-RMSD.
Expand Down Expand Up @@ -654,7 +654,7 @@ def run(self) -> Union[None, "CAPRI"]:
log.debug(f"id {self.identificator}, calculating global RMSD")
self.calc_global_rmsd()

if not self.less_io:
if self.debug:
self.make_output()
else:
# The scheduler will use the return of the `run` method as the output of the tasks
Expand Down
13 changes: 7 additions & 6 deletions src/haddock/modules/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ offline:
generated files, therefore completely isolating haddock3 from any web call.
group: "execution"
explevel: easy
less_io:
debug:
default: false
type: boolean
title: Reduce the amount of I/O operations.
short: Reduce the amount of I/O operations.
long: This option will reduce the amount of I/O operations by writing
less files to disk. This can be useful for example when running on
a network file system where I/O operations are slow.
title: Write intermediate and stdout files.
short: Write intermediate and stdout files.
long: When set to true, this option will increase the amount of I/O
operations by writing intermediate input, output and error files on disk.
Turning it to false can be useful for example when running on a network
file system where I/O operations are slow.
group: "execution"
explevel: easy
incompatible:
Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/refinement/emref/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _run(self) -> None:
"emref",
ambig_fname=ambig_fname,
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=model.seed if isinstance(model, PDBFile) else None,
)
out_file = f"emref_{idx}.out"
Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/refinement/flexref/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _run(self) -> None:
"flexref",
ambig_fname=ambig_fname,
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=model.seed if isinstance(model, PDBFile) else None,
)

Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/refinement/mdref/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _run(self) -> None:
"mdref",
ambig_fname=ambig_fname,
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=model.seed if isinstance(model, PDBFile) else None,
)
out_file = f"mdref_{idx}.out"
Expand Down
4 changes: 2 additions & 2 deletions src/haddock/modules/sampling/rigidbody/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def prepare_cns_input_sequential(
ambig_fname=ambig_fname,
default_params_path=self.toppar_path,
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=seed,
)
_l.append((combination, rigidbody_input, ambig_fname, seed))
Expand Down Expand Up @@ -150,7 +150,7 @@ def prepare_cns_input_parallel(
ambig_fname=ambig_fname,
native_segid=True,
default_params_path=self.toppar_path,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=seed,
)

Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/scoring/emscoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _run(self) -> None:
self.params,
"emscoring",
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=model.seed if isinstance(model, PDBFile) else None,
)

Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/scoring/mdscoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _run(self) -> None:
self.params,
"mdscoring",
native_segid=True,
less_io=self.params["less_io"],
debug=self.params["debug"],
seed=model.seed if isinstance(model, PDBFile) else None,
)

Expand Down
2 changes: 1 addition & 1 deletion src/haddock/modules/topology/topoaa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _run(self) -> None:
self.params,
parameters_for_this_molecule,
default_params_path=self.toppar_path,
write_to_disk=not self.params["less_io"],
write_to_disk=self.params["debug"],
)

self.log("Topology CNS input created")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_libcns.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_prepare_cns_input(pdbfile):
ambig_fname="",
native_segid=False,
default_params_path=None,
less_io=True,
debug=False,
seed=pdbfile.seed,
)

Expand Down

0 comments on commit 9d294f4

Please sign in to comment.