Skip to content

Commit

Permalink
Merge branch 'mjoosten/issue_1' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
MJoosten committed Mar 8, 2024
2 parents 1d9134b + 7b9eb16 commit 6249496
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
65 changes: 42 additions & 23 deletions src/roodmus/trajectory/conformations_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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]]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/trajectory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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")
Expand All @@ -73,7 +73,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)
Expand Down

0 comments on commit 6249496

Please sign in to comment.