Skip to content

Commit 7d1b5b2

Browse files
Move tomography processing into Relion 5 format (#331)
1 parent 557c1ea commit 7d1b5b2

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

src/murfey/cli/inject_spa_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def run():
189189
"autoproc_program_id": detached_ids[3],
190190
"movie": m.path,
191191
"mrc_out": str(mrc_out),
192-
"pix_size": proc_params["angpix"],
192+
"pixel_size": proc_params["angpix"],
193193
"image_number": m.image_number,
194194
"microscope": get_microscope(),
195195
"mc_uuid": m.murfey_id,

src/murfey/cli/spa_ispyb_messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def run():
413413
"autoproc_program_id": collected_ids[3].id,
414414
"movie": f.file_path,
415415
"mrc_out": f.mrc_out,
416-
"pix_size": float(metadata["pixel_size_on_image"]) * 1e10,
416+
"pixel_size": float(metadata["pixel_size_on_image"]) * 1e10,
417417
"image_number": f.image_number,
418418
"microscope": get_microscope(),
419419
"mc_uuid": murfey_ids[2 * i],

src/murfey/server/__init__.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,15 @@ def _mc_path(mov_path: Path) -> str:
159159
core = Path(*Path(mov_path).parts[: visit_idx + 1])
160160
ppath = Path(mov_path)
161161
sub_dataset = "/".join(ppath.relative_to(core).parts[:-1])
162+
extra_path = machine_config.processed_extra_directory
162163
mrc_out = (
163164
core
164165
/ machine_config.processed_directory_name
165166
/ sub_dataset
167+
/ extra_path
166168
/ "MotionCorr"
169+
/ "job002"
170+
/ "Movies"
167171
/ str(ppath.stem + "_motion_corrected.mrc")
168172
)
169173
return str(mrc_out)
@@ -691,7 +695,7 @@ def _register_picked_particles_use_diameter(
691695
"micrographs_file": saved_message.micrographs_file,
692696
"coord_list_file": saved_message.coord_list_file,
693697
"output_file": saved_message.extract_file,
694-
"pix_size": (
698+
"pixel_size": (
695699
relion_options["angpix"]
696700
* relion_options["motion_corr_binning"]
697701
),
@@ -727,7 +731,7 @@ def _register_picked_particles_use_diameter(
727731
"micrographs_file": params_to_forward["micrographs_file"],
728732
"coord_list_file": params_to_forward["coord_list_file"],
729733
"output_file": params_to_forward["extract_file"],
730-
"pix_size": (
734+
"pixel_size": (
731735
relion_options["angpix"] * relion_options["motion_corr_binning"]
732736
),
733737
"ctf_image": params_to_forward["ctf_values"]["CtfImage"],
@@ -843,7 +847,7 @@ def _register_picked_particles_use_boxsize(message: dict, _db=murfey_db):
843847
"micrographs_file": params_to_forward["micrographs_file"],
844848
"coord_list_file": params_to_forward["coord_list_file"],
845849
"output_file": params_to_forward["extract_file"],
846-
"pix_size": relion_params.angpix * relion_params.motion_corr_binning,
850+
"pixel_size": relion_params.angpix * relion_params.motion_corr_binning,
847851
"ctf_image": params_to_forward["ctf_values"]["CtfImage"],
848852
"ctf_max_resolution": params_to_forward["ctf_values"]["CtfMaxResolution"],
849853
"ctf_figure_of_merit": params_to_forward["ctf_values"]["CtfFigureOfMerit"],
@@ -1934,7 +1938,7 @@ def _flush_spa_preprocessing(message: dict):
19341938
"autoproc_program_id": collected_ids[3].id,
19351939
"movie": f.file_path,
19361940
"mrc_out": f.mrc_out,
1937-
"pix_size": proc_params.angpix,
1941+
"pixel_size": proc_params.angpix,
19381942
"image_number": f.image_number,
19391943
"microscope": get_microscope(),
19401944
"mc_uuid": murfey_ids[2 * i],
@@ -2038,7 +2042,7 @@ def _flush_tomography_preprocessing(message: dict):
20382042
"autoproc_program_id": detached_ids[3],
20392043
"movie": f.file_path,
20402044
"mrc_out": f.mrc_out,
2041-
"pix_size": proc_params.pixel_size,
2045+
"pixel_size": proc_params.pixel_size,
20422046
"kv": proc_params.voltage,
20432047
"image_number": f.image_number,
20442048
"microscope": get_microscope(),
@@ -2407,7 +2411,9 @@ def feedback_callback(header: dict, message: dict) -> None:
24072411
preproc_params = get_tomo_preproc_params(ids.dcgid)
24082412
stack_file = (
24092413
Path(message["mrc_out"]).parents[1]
2410-
/ "align_output"
2414+
/ "Tomograms"
2415+
/ "job006"
2416+
/ "tomograms"
24112417
/ f"{relevant_tilt_series.tag}_stack.mrc"
24122418
)
24132419
if not stack_file.parent.exists():
@@ -2421,7 +2427,7 @@ def feedback_callback(header: dict, message: dict) -> None:
24212427
"dcid": ids.dcid,
24222428
"appid": ids.appid,
24232429
"stack_file": str(stack_file),
2424-
"pix_size": preproc_params.pixel_size,
2430+
"pixel_size": preproc_params.pixel_size,
24252431
"manual_tilt_offset": -tilt_offset,
24262432
"node_creator_queue": machine_config.node_creator_queue,
24272433
},

src/murfey/server/api/__init__.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,15 @@ def register_completed_tilt_series(
651651
"/".join(secure_filename(p) for p in Path(first_tilt.movie_path).parts)
652652
)
653653
sub_dataset = "/".join(ppath.relative_to(core).parts[:-1])
654+
extra_path = machine_config.processed_extra_directory
654655
stack_file = (
655656
core
656657
/ machine_config.processed_directory_name
657658
/ sub_dataset
658-
/ "align_output"
659+
/ extra_path
660+
/ "Tomograms"
661+
/ "job006"
662+
/ "tomograms"
659663
/ f"{ts.tag}_stack.mrc"
660664
)
661665
if not stack_file.parent.exists():
@@ -669,7 +673,7 @@ def register_completed_tilt_series(
669673
"dcid": ids.dcid,
670674
"appid": ids.appid,
671675
"stack_file": str(stack_file),
672-
"pix_size": preproc_params.pixel_size,
676+
"pixel_size": preproc_params.pixel_size,
673677
"manual_tilt_offset": -tilt_offset,
674678
"node_creator_queue": machine_config.node_creator_queue,
675679
},
@@ -1011,7 +1015,7 @@ async def request_spa_preprocessing(
10111015
"autoproc_program_id": detached_ids[3],
10121016
"movie": proc_file.path,
10131017
"mrc_out": str(mrc_out),
1014-
"pix_size": proc_params["angpix"],
1018+
"pixel_size": proc_params["angpix"],
10151019
"image_number": proc_file.image_number,
10161020
"microscope": get_microscope(),
10171021
"mc_uuid": murfey_ids[0],
@@ -1060,22 +1064,18 @@ async def request_tomography_preprocessing(
10601064
core = Path(*Path(proc_file.path).parts[: visit_idx + 1])
10611065
ppath = Path("/".join(secure_filename(p) for p in Path(proc_file.path).parts))
10621066
sub_dataset = "/".join(ppath.relative_to(core).parts[:-1])
1067+
extra_path = machine_config.processed_extra_directory
10631068
mrc_out = (
10641069
core
10651070
/ machine_config.processed_directory_name
10661071
/ sub_dataset
1072+
/ extra_path
10671073
/ "MotionCorr"
1074+
/ "job002"
1075+
/ "Movies"
10681076
/ str(ppath.stem + "_motion_corrected.mrc")
10691077
)
10701078
mrc_out = Path("/".join(secure_filename(p) for p in mrc_out.parts))
1071-
ctf_out = (
1072-
core
1073-
/ machine_config.processed_directory_name
1074-
/ sub_dataset
1075-
/ "CTF"
1076-
/ str(ppath.stem + "_ctf.mrc")
1077-
)
1078-
ctf_out = Path("/".join(secure_filename(p) for p in ctf_out.parts))
10791079
session_id = (
10801080
db.exec(
10811081
select(ClientEnvironment).where(ClientEnvironment.client_id == client_id)
@@ -1105,8 +1105,6 @@ async def request_tomography_preprocessing(
11051105
murfey_ids = _murfey_id(appid, db, number=1, close=False)
11061106
if not mrc_out.parent.exists():
11071107
mrc_out.parent.mkdir(parents=True, exist_ok=True)
1108-
if not ctf_out.parent.exists():
1109-
ctf_out.parent.mkdir(parents=True, exist_ok=True)
11101108
zocalo_message = {
11111109
"recipes": ["em-tomo-preprocess"],
11121110
"parameters": {
@@ -1117,8 +1115,7 @@ async def request_tomography_preprocessing(
11171115
"autoproc_program_id": appid,
11181116
"movie": proc_file.path,
11191117
"mrc_out": str(mrc_out),
1120-
"pix_size": (proc_file.pixel_size) * 10**10,
1121-
"output_image": str(ctf_out),
1118+
"pixel_size": (proc_file.pixel_size) * 10**10,
11221119
"image_number": proc_file.image_number,
11231120
"kv": int(proc_file.voltage),
11241121
"microscope": get_microscope(),

src/murfey/server/demo_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ def flush_spa_processing(visit_name: str, client_id: int, tag: Tag, db=murfey_db
777777
"autoproc_program_id": detached_ids[3],
778778
"movie": f.file_path,
779779
"mrc_out": f.mrc_out,
780-
"pix_size": proc_params["angpix"],
780+
"pixel_size": proc_params["angpix"],
781781
"image_number": f.image_number,
782782
"microscope": get_microscope(),
783783
"mc_uuid": murfey_ids[2 * i],

0 commit comments

Comments
 (0)