From 7b9eb166482ebb093465efdfb883b9de62f02bf7 Mon Sep 17 00:00:00 2001 From: mjoosten1 Date: Thu, 7 Mar 2024 16:40:25 +0100 Subject: [PATCH] disabled waymarking in trajectory module --- .../trajectory/conformations_sampling.py | 65 ++++++++++++------- tests/integration/trajectory_test.py | 4 +- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/roodmus/trajectory/conformations_sampling.py b/src/roodmus/trajectory/conformations_sampling.py index 350c468..f9408c8 100644 --- a/src/roodmus/trajectory/conformations_sampling.py +++ b/src/roodmus/trajectory/conformations_sampling.py @@ -74,15 +74,15 @@ def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: action="store_true", ) - parser.add_argument( - "--sampling_method", - help=( - "Choose whether to sample a trajectory uniformly in time" - " (even_sampling) or by >rmsd threshold (waymark)" - ), - type=str, - default="even_sampling", - ) + # parser.add_argument( + # "--sampling_method", + # help=( + # "Choose whether to sample a trajectory uniformly in time" + # " (even_sampling) or by >rmsd threshold (waymark)" + # ), + # type=str, + # default="even_sampling", + # ) parser.add_argument( "--n_conformations", @@ -153,13 +153,13 @@ def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: required=False, ) - parser.add_argument( - "--rmsd", - help="RMSD in nm to use for waymark sampling", - type=float, - default=0.3, - required=False, - ) + # parser.add_argument( + # "--rmsd", + # help="RMSD in nm to use for waymark sampling", + # type=float, + # default=0.3, + # required=False, + # ) parser.add_argument( "--digits", @@ -172,13 +172,13 @@ def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: required=False, ) - parser.add_argument( - "--waymarking_plots", - help=("Directory to create and put waymarking plots into"), - type=str, - default="waymarking_plots", - required=False, - ) + # parser.add_argument( + # "--waymarking_plots", + # help=("Directory to create and put waymarking plots into"), + # type=str, + # default="waymarking_plots", + # required=False, + # ) return parser @@ -244,6 +244,18 @@ def load_traj(trajfile: str, topfile: str, verbose: bool) -> mdt.Trajectory: return t +""" +Waymarking is currently disabled. The function does not work +when only a single trajectory file is used. +The waymarking is also done incorrectly, with +new conformations only being checked against the +fist conformation, instead of all conformations +in the ensemble + +We should redo waymarking entirely in the future +""" + + def waymark( trajfiles: List[str], topfile: str, @@ -748,6 +760,11 @@ def main(args): ) return + # only available sampling method at this time is even sampling. + # waymarking has been disabled for now, as it is not correctly + # implemented + args.sampling_method = "even_sampling" + if args.sampling_method == "even_sampling": # create function to get indices of N conformations to sample from # entire trajectory @@ -773,6 +790,7 @@ def main(args): args.tqdm, ) + """ elif args.sampling_method == "waymark": # we want to get: Tuple[list[int], list[np.int64], # np.ndarray[np.int64,np.int64]] @@ -831,6 +849,7 @@ def main(args): write_non_redundant_confs( non_redundant_confs, args.output_dir, args.digits ) + """ else: # method of sampling not recognised diff --git a/tests/integration/trajectory_test.py b/tests/integration/trajectory_test.py index 6682508..621a8ef 100644 --- a/tests/integration/trajectory_test.py +++ b/tests/integration/trajectory_test.py @@ -100,7 +100,7 @@ def test_conformations_sampling(self) -> None: # set up the args to pass to roodmus conformations_sampling trajfiles_dir = self.test_data topfile = os.path.join(self.test_data, "pdbfile_11021566_glyco.pdb") - sampling_method = "even_sampling" + # sampling_method = "even_sampling" n_conformations = 2 traj_extension = ".dcd" output_dir = os.path.join(self.test_dir, "conformations_sampling") @@ -111,7 +111,7 @@ def test_conformations_sampling(self) -> None: + " --trajfiles_dir {}".format(trajfiles_dir) + " --topfile {}".format(topfile) + " --verbose" - + " --sampling_method {}".format(sampling_method) + # + " --sampling_method {}".format(sampling_method) + " --n_conformations {}".format(n_conformations) + " --traj_extension {}".format(traj_extension) + " --output_dir {}".format(output_dir)