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
11 changes: 10 additions & 1 deletion src/cryoemservices/services/cryolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def cryolo(self, rw, header: dict, message: dict):
rw.send_to("images", images_parameters)

# Gather results needed for particle extraction
extraction_params = {
extraction_params: dict[str, Any] = {
"ctf_values": cryolo_params.ctf_values,
"micrographs_file": cryolo_params.input_path,
"coord_list_file": cryolo_params.output_path,
Expand All @@ -464,6 +464,15 @@ def cryolo(self, rw, header: dict, message: dict):
"motion_correction_id": cryolo_params.mc_uuid,
"micrograph": cryolo_params.input_path,
"particle_diameters": list(cryolo_particle_sizes),
"particle_count": len(cryolo_particle_sizes),
"resolution": cryolo_params.ctf_values["CtfMaxResolution"],
"astigmatism": cryolo_params.ctf_values["DefocusV"]
- cryolo_params.ctf_values["DefocusU"],
"defocus": (
cryolo_params.ctf_values["DefocusU"]
+ cryolo_params.ctf_values["DefocusV"]
)
/ 2,
"extraction_parameters": extraction_params,
},
)
Expand Down
11 changes: 10 additions & 1 deletion tests/services/test_cryolo_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def test_cryolo_service_spa(mock_subprocess, offline_transport, tmp_path):

output_path = tmp_path / "AutoPick/job007/STAR/sample.star"
cbox_path = tmp_path / "AutoPick/job007/CBOX/sample.cbox"
ctf_test_values = {
"CtfMaxResolution": 0.00001,
"DefocusU": 0.05,
"DefocusV": 0.08,
}
cryolo_test_message = {
"pixel_size": 0.1,
"input_path": "MotionCorr/job002/sample.mrc",
Expand All @@ -52,7 +57,7 @@ def test_cryolo_service_spa(mock_subprocess, offline_transport, tmp_path):
"mc_uuid": 0,
"picker_uuid": 0,
"particle_diameter": 1.1,
"ctf_values": {"dummy": "dummy"},
"ctf_values": ctf_test_values,
"cryolo_command": "cryolo_predict.py",
"relion_options": {"batch_size": 20000, "downscale": True},
}
Expand Down Expand Up @@ -161,6 +166,10 @@ def test_cryolo_service_spa(mock_subprocess, offline_transport, tmp_path):
"motion_correction_id": cryolo_test_message["mc_uuid"],
"micrograph": cryolo_test_message["input_path"],
"particle_diameters": [10.0, 20.0],
"particle_count": 2,
"resolution": ctf_test_values["CtfMaxResolution"],
"astigmatism": ctf_test_values["DefocusV"] - ctf_test_values["DefocusU"],
"defocus": (ctf_test_values["DefocusU"] + ctf_test_values["DefocusV"]) / 2,
"extraction_parameters": extraction_params,
},
)
Expand Down