From 93bb5f59c4015d516fa3e6d9e0e92e999a683f14 Mon Sep 17 00:00:00 2001 From: dennisbrookner Date: Fri, 13 Oct 2023 17:21:15 -0400 Subject: [PATCH] starting to include typing --- src/matchmaps/_compute_realspace_diff.py | 32 ++++++++++++------------ src/matchmaps/_utils.py | 5 ++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/matchmaps/_compute_realspace_diff.py b/src/matchmaps/_compute_realspace_diff.py index 8fd4e89..cf9d3e3 100755 --- a/src/matchmaps/_compute_realspace_diff.py +++ b/src/matchmaps/_compute_realspace_diff.py @@ -28,24 +28,24 @@ def compute_realspace_difference_map( - pdboff, - mtzoff, - mtzon, - Foff, - SigFoff, - Fon, - SigFon, - ligands=None, - dmin=None, - spacing=0.5, - on_as_stationary=False, + pdboff : Path, + mtzoff : Path, + mtzon : Path, + Foff : str, + SigFoff : str, + Fon : str, + SigFon : str, + ligands : list = None, + dmin : int = None, + spacing = 0.5, + on_as_stationary : bool = False, input_dir=Path("."), output_dir=Path("."), verbose=False, - rbr_selections=None, - eff=None, - keep_temp_files=None, - radius=5, + rbr_selections : list[str] = None, + eff : str = None, + keep_temp_files : str = None, + radius : int = 5, ): """ Compute a real-space difference map from mtzs. @@ -89,7 +89,7 @@ def compute_realspace_difference_map( Name of a file containing a template .eff parameter file for phenix.refine. If omitted, the sensible built-in .eff template is used. If you need to change something, I recommend copying the template from the source code and editing that. - keep_temp_files : bool, optional + keep_temp_files : str, optional If not None, the name of a subdirectory of the output_dir into which intermediate matchmaps files are moved upon program completion. radius : float, optional Maximum distance away from protein model to include voxels. Only applies to the "unmasked" difference map output. diff --git a/src/matchmaps/_utils.py b/src/matchmaps/_utils.py index 4e63f00..36fccf3 100644 --- a/src/matchmaps/_utils.py +++ b/src/matchmaps/_utils.py @@ -854,11 +854,12 @@ def _quicknorm(array): return (array - array.mean()) / array.std() def _validate_inputs( - input_dir, - output_dir, + input_dir : Path, + output_dir : Path, ligands, *files, ): + # use pathlib to validate input files and directories output_dir = Path(output_dir) output_dir.mkdir(parents=True, exist_ok=True)