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
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ torch = [
[project.entry-points."ccpem_pipeliner.jobs"]
"combine_star_files_job" = "cryoemservices.pipeliner_plugins.combine_star_job:ProcessStarFiles"
[project.entry-points."cryoemservices.services"]
AreTomoAlign = "cryoemservices.services.tomo_align_aretomo:AreTomoAlign"
AreTomoAlignSlurm = "cryoemservices.services.tomo_align_aretomo_slurm:AreTomoAlignSlurm"
BFactor = "cryoemservices.services.bfactor_setup:BFactor"
CLEMAlignAndMerge = "cryoemservices.services.clem_align_and_merge:AlignAndMergeService"
CLEMProcessRawLIFs = "cryoemservices.services.clem_process_raw_lifs:ProcessRawLIFsService"
Expand All @@ -109,6 +111,7 @@ torch = [
ExtractClass = "cryoemservices.services.extract_class:ExtractClass"
IceBreaker = "cryoemservices.services.icebreaker:IceBreaker"
Images = "cryoemservices.services.images:Images"
ImodTomoAlign = "cryoemservices.services.tomo_align_imod:ImodTomoAlign"
MembrainSeg = "cryoemservices.services.membrain_seg:MembrainSeg"
MotionCorr = "cryoemservices.services.motioncorr:MotionCorr"
MurfeyDBConnector = "cryoemservices.services.murfey_db_connector:MurfeyDBConnector"
Expand All @@ -118,8 +121,6 @@ torch = [
Refine3D = "cryoemservices.services.refine3d:Refine3D"
SelectClasses = "cryoemservices.services.select_classes:SelectClasses"
SelectParticles = "cryoemservices.services.select_particles:SelectParticles"
TomoAlign = "cryoemservices.services.tomo_align:TomoAlign"
TomoAlignSlurm = "cryoemservices.services.tomo_align_slurm:TomoAlignSlurm"
TopazPick = "cryoemservices.services.topaz_pick:TopazPick"
[project.entry-points."cryoemservices.services.images.plugins"]
"mrc_central_slice" = "cryoemservices.services.images_plugins:mrc_central_slice"
Expand Down
2 changes: 1 addition & 1 deletion recipes/ispyb/em-tomo-align.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"tilt_axis": "{tilt_axis}"
},
"queue": "tomo_align",
"service": "TomoAlign"
"service": "AreTomoAlign"
},
"3": {
"parameters": {
Expand Down
2 changes: 1 addition & 1 deletion recipes/ispyb/sxt-aretomo.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"xrm_reference": "{xrm_reference}"
},
"queue": "tomo_align",
"service": "TomoAlign"
"service": "AreTomoAlign"
},
"3": {
"parameters": {
Expand Down
100 changes: 100 additions & 0 deletions recipes/ispyb/sxt-imod-beads-wbp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"1": {
"output": 2,
"parameters": {
"dcid": "{dcid}",
"ispyb_command": "insert_tomogram",
"program_id": "{appid}",
"store_result": "ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"2": {
"output": {
"denoise": 5,
"failure": 3,
"images": 6,
"ispyb_connector": 4,
"movie": 6,
"projxy": 6,
"projxz": 6,
"success": 7
},
"parameters": {
"manual_tilt_offset": "{manual_tilt_offset}",
"out_bin": 1,
"patch": 0,
"pixel_size": "{pixel_size}",
"sirt": 0,
"stack_file": "{stack_file}",
"tilt_axis": 0,
"txrm_file": "{txrm_file}",
"wbp": 1
},
"queue": "tomo_align_imod",
"service": "ImodTomoAlign"
},
"3": {
"parameters": {
"ispyb_command": "update_processing_status",
"status_message": "processing failure",
"program_id": "{appid}",
"status": "failure"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"4": {
"parameters": {
"dcid": "{dcid}",
"ispyb_command": "multipart_message",
"program_id": "{appid}",
"tomogram_id": "$ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"5": {
"output": {
"images": 6,
"ispyb_connector": 9,
"movie": 6,
"segmentation": 8
},
"queue": "denoise",
"service": "Denoise"
},
"6": {
"queue": "images",
"service": "Images"
},
"7": {
"parameters": {
"ispyb_command": "update_processing_status",
"status_message": "processing successful",
"program_id": "{appid}",
"status": "success"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"8": {
"output": {
"images": 6,
"ispyb_connector": 9,
"movie": 6
},
"queue": "segmentation",
"service": "MembrainSeg"
},
"9": {
"parameters": {
"ispyb_command": "insert_processed_tomogram",
"tomogram_id": "$ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"start": [[1, []]]
}
100 changes: 100 additions & 0 deletions recipes/ispyb/sxt-imod-patch-wbp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"1": {
"output": 2,
"parameters": {
"dcid": "{dcid}",
"ispyb_command": "insert_tomogram",
"program_id": "{appid}",
"store_result": "ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"2": {
"output": {
"denoise": 5,
"failure": 3,
"images": 6,
"ispyb_connector": 4,
"movie": 6,
"projxy": 6,
"projxz": 6,
"success": 7
},
"parameters": {
"manual_tilt_offset": "{manual_tilt_offset}",
"out_bin": 1,
"patch": 1,
"pixel_size": "{pixel_size}",
"sirt": 0,
"stack_file": "{stack_file}",
"tilt_axis": 0,
"txrm_file": "{txrm_file}",
"wbp": 1
},
"queue": "tomo_align_imod",
"service": "ImodTomoAlign"
},
"3": {
"parameters": {
"ispyb_command": "update_processing_status",
"status_message": "processing failure",
"program_id": "{appid}",
"status": "failure"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"4": {
"parameters": {
"dcid": "{dcid}",
"ispyb_command": "multipart_message",
"program_id": "{appid}",
"tomogram_id": "$ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"5": {
"output": {
"images": 6,
"ispyb_connector": 9,
"movie": 6,
"segmentation": 8
},
"queue": "denoise",
"service": "Denoise"
},
"6": {
"queue": "images",
"service": "Images"
},
"7": {
"parameters": {
"ispyb_command": "update_processing_status",
"status_message": "processing successful",
"program_id": "{appid}",
"status": "success"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"8": {
"output": {
"images": 6,
"ispyb_connector": 9,
"movie": 6
},
"queue": "segmentation",
"service": "MembrainSeg"
},
"9": {
"parameters": {
"ispyb_command": "insert_processed_tomogram",
"tomogram_id": "$ispyb_tomogram_id"
},
"queue": "ispyb_connector",
"service": "EMISPyB"
},
"start": [[1, []]]
}
2 changes: 1 addition & 1 deletion src/cryoemservices/services/denoise_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import List

from cryoemservices.services.denoise import Denoise, DenoiseParameters
from cryoemservices.services.tomo_align_slurm import (
from cryoemservices.services.tomo_align_aretomo_slurm import (
get_iris_state,
retrieve_files,
transfer_files,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_tilt_stack(input_file_list_of_lists: list[Any], stack_file: Path):
mrc.header.cella.z *= len(input_file_list_of_lists)


class TomoParameters(BaseModel):
class AreTomoParameters(BaseModel):
aretomo_version: Literal[2, 3] = 3
stack_file: str = Field(..., min_length=1)
pixel_size: float
Expand Down Expand Up @@ -173,14 +173,13 @@ def check_list_of_lists_is_not_empty(cls, v):
raise ValueError("input_file_list is not a list of lists")


class TomoAlign(CommonService):
class AreTomoAlign(CommonService):
"""
A service for grouping and aligning tomography tilt-series
with Newstack and AreTomo2 or AreTomo3
A service for grouping and aligning tomography tilt-series with AreTomo2 or AreTomo3
"""

# Logger name
_logger_name = "cryoemservices.services.tomo_align"
_logger_name = "cryoemservices.services.tomo_align_aretomo"

# Job name
job_type = "relion.reconstructtomograms"
Expand Down Expand Up @@ -216,7 +215,7 @@ def initializing(self):
)

@staticmethod
def check_visit(tomo_params: TomoParameters):
def check_visit(tomo_params: AreTomoParameters):
return True

def parse_tomo_output(self, tomo_stdout: str):
Expand Down Expand Up @@ -287,11 +286,13 @@ def tomo_align(self, rw, header: dict, message: dict):

try:
if isinstance(message, dict):
tomo_params = TomoParameters(
tomo_params = AreTomoParameters(
**{**rw.recipe_step.get("parameters", {}), **message}
)
else:
tomo_params = TomoParameters(**{**rw.recipe_step.get("parameters", {})})
tomo_params = AreTomoParameters(
**{**rw.recipe_step.get("parameters", {})}
)
except (ValidationError, TypeError) as e:
self.log.warning(
f"TomoAlign parameter validation failed for message: {message} "
Expand Down Expand Up @@ -881,15 +882,15 @@ def convert_txrm_to_stack(
txrm_file, str(tifftomo), custom_reference=xrm_reference or None
)
# Let this run, and check later if the output file exists
subprocess.run(["tif2mrc", str(tifftomo), stack_file])
subprocess.run(["tif2mrc", str(tifftomo), stack_file], capture_output=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're capturing the output, but it doesn't look there are any logs in place to note the output.

tifftomo.unlink(missing_ok=True)
return pixel_size_angstroms

def assemble_aretomo3_command(
self,
aretomo_executable: str,
input_file: str,
tomo_parameters: TomoParameters,
tomo_parameters: AreTomoParameters,
):
"""
Assemble the command to run AreTomo3, using a base command with
Expand Down Expand Up @@ -975,7 +976,7 @@ def assemble_aretomo2_command(
self,
aretomo_executable: str,
input_file: str,
tomo_parameters: TomoParameters,
tomo_parameters: AreTomoParameters,
aretomo_output_path: Path,
angle_file: Path,
):
Expand Down Expand Up @@ -1044,7 +1045,7 @@ def assemble_aretomo2_command(

def aretomo(
self,
tomo_parameters: TomoParameters,
tomo_parameters: AreTomoParameters,
aretomo_output_path: Path,
angle_file: Path,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import requests

from cryoemservices.services.tomo_align import TomoAlign, TomoParameters
from cryoemservices.services.tomo_align_aretomo import AreTomoAlign, AreTomoParameters
from cryoemservices.util.slurm_submission import slurm_submission_for_services


Expand Down Expand Up @@ -85,21 +85,21 @@ def get_iris_state(logger, wait=True) -> str:
return "unknown"


class TomoAlignSlurm(TomoAlign):
class AreTomoAlignSlurm(AreTomoAlign):
"""
A service for submitting AreTomo2 jobs to a slurm cluster via RestAPI
"""

# Logger name
_logger_name = "cryoemservices.services.tomo_align_slurm"
_logger_name = "cryoemservices.services.tomo_align_aretomo_slurm"

def initializing(self):
if not get_iris_state(self.log):
exit()
super().initializing()

@staticmethod
def check_visit(tomo_params: TomoParameters):
def check_visit(tomo_params: AreTomoParameters):
# Requeue visits that should not be sent via slurm
visit_search = re.search(
"/[a-z]{2}[0-9]{5}-[0-9]{1,3}/", tomo_params.stack_file
Expand Down Expand Up @@ -128,7 +128,7 @@ def parse_tomo_output_file(self, tomo_output_file: Path):

def aretomo(
self,
tomo_parameters: TomoParameters,
tomo_parameters: AreTomoParameters,
aretomo_output_path: Path,
angle_file: Path,
):
Expand Down
Loading
Loading