Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions actions/pyrosettacluster/assert_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def assert_total_score(self, pose1, pose2):
self.assertEqual(scorefxn(pose1), scorefxn(pose2))

def test_coordinates(self):
if not pyrosetta.rosetta.basic.was_init_called():
pyrosetta.init(options="", extra_options=self.pyrosetta_init_flags, silent=True)
original_pose = io.pose_from_file(self.original_output_file).pose
reproduce_pose = io.pose_from_file(self.reproduce_output_file).pose
self.assert_atom_coordinates(original_pose, reproduce_pose)
Expand All @@ -88,9 +90,16 @@ def test_coordinates(self):
parser = argparse.ArgumentParser()
parser.add_argument('--original_output_file', type=str, required=True)
parser.add_argument('--reproduce_output_file', type=str, required=True)
parser.add_argument(
"--pyrosetta_init_flags",
type=str,
required=False,
default="-run:constant_seed 1 -out:level 200",
)
args, remaining_argv = parser.parse_known_args()
# Inject args into the class before running test
TestAtomCoordinates.original_output_file = args.original_output_file
TestAtomCoordinates.reproduce_output_file = args.reproduce_output_file
TestAtomCoordinates.pyrosetta_init_flags = args.pyrosetta_init_flags
# Run test
unittest.main(argv=[__file__] + remaining_argv)
4 changes: 4 additions & 0 deletions actions/pyrosettacluster/test_env_reproducibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,23 +300,27 @@ def recreate_environment_test(
reproduce_output_file = reproduce_record["metadata"]["output_file"]
assert_coordinates_script = os.path.join(os.path.dirname(__file__), "assert_coordinates.py")
module = os.path.splitext(os.path.basename(assert_coordinates_script))[0]
pyrosetta_init_flags = "-run:constant_seed 1 -out:level 300"
if environment_manager == "pixi":
cmd = (
f"pixi run python -u -m {module} "
f"--original_output_file '{original_output_file}' "
f"--reproduce_output_file '{reproduce_output_file}' "
f"--pyrosetta_init_flags '{pyrosetta_init_flags}'"
)
elif environment_manager == "uv":
cmd = (
f"uv run --project {reproduce_env_dir} python -u -m {module} "
f"--original_output_file '{original_output_file}' "
f"--reproduce_output_file '{reproduce_output_file}' "
f"--pyrosetta_init_flags '{pyrosetta_init_flags}'"
)
elif environment_manager in ("conda", "mamba"):
cmd = (
f"conda run -p {reproduce_env_dir} python -u -m {module} "
f"--original_output_file '{original_output_file}' "
f"--reproduce_output_file '{reproduce_output_file}' "
f"--pyrosetta_init_flags '{pyrosetta_init_flags}'"
)
returncode = TestEnvironmentReproducibility.run_subprocess(
cmd,
Expand Down
Loading