Tomography Jobs: Picking and Subtomogram Averaging
Tomography picking, template matching and subtomogram averaging jobs
This page documents the tomography-specific picking, template matching, and subtomogram averaging job types registered in ccpem-pipeliner. These jobs cover the complete subtomogram averaging workflow: manual particle picking in Napari, pseudo-subtomogram extraction, initial model generation, 3D classification, 3D auto-refinement, CTF refinement, frame alignment (Bayesian polishing), and particle reconstruction — along with LTM-based template matching utilities and helper import jobs. Understanding which jobs support continuation (can_continue=True) and how optimisation sets link jobs together is essential for building automated tomography pipelines.
All tomography subtomogram averaging jobs follow the same pipeliner conventions: each job has a PROCESS_NAME you use with --default_runjob, --job_info, or new_job_of_type(); each reads from and writes to named output nodes that connect jobs together in the pipeline graph; and each stores its state in a sequential job directory (e.g. Picks/job003/). The table below lists every registered job type covered on this page in workflow order.
| Process name | Class | Output directory | Can continue |
|---|---|---|---|
relion.picktomo | RelionTomoNapariPickJob | Picks/ | No |
eulermate.import.coordinates | EulermateJob | Import/ | No |
relion.importtomo.coordinates | RelionImportCoordinates | Import/ | No |
ltm.create.mask | LtmCreateMaskJob | TemplateMatching/ | No |
ltm.create.template | LtmCreateTemplateJob | TemplateMatching/ | No |
ltm.template.match | LtmJob | TemplateMatching/ | No |
ltm.extract.peaks | LtmExtractPeaksJob | TemplateMatching/ | No |
ltm.halftomo.localcc | LtmHalfTomoLocalCCJob | TemplateMatching/ | No |
relion.pseudosubtomo | RelionPseudoSubtomoJob | Extract/ | Yes |
relion.initialmodel.tomo | RelionTomoInimodelJob | InitialModel/ | Yes |
relion.class3d.tomo | TomoRelionClass3DJob | Class3D/ | Yes |
relion.refine3d.tomo | TomoRelionRefine3D | Refine3D/ | Yes |
relion.refine3d.tomo.helical | TomoRelionRefine3DHelical | Refine3D/ | Yes |
relion.ctfrefinetomo | TomoRelionCtfRefine | CtfRefine/ | No |
relion.framealigntomo | TomoRelionBayesPolishJob | Polish/ | Yes |
relion.reconstructparticletomo | RelionReconstructParticleJob | Reconstruct/ | No |
relion.joinstar.tomograms | RelionJoinStarTomograms | JoinStar/ | No |
Note:
relion.reconstructparticletomo.helical(RelionReconstructParticleJobHelical) exists in the codebase but is not a registered entry-point job type. Callingnew_job_of_type('relion.reconstructparticletomo.helical')will fail.
Connecting jobs — the optimisation set
Most subtomogram averaging jobs accept either an optimisation set (optimisation_set.star, node type TomoOptimisationSet) that bundles tomograms, particles, and trajectories together, or individual direct entries for each. Use the in_optimisation / use_direct_entries pattern to switch between them (the key is do_use_direct_entries for relion.pseudosubtomo and relion.reconstructparticletomo). Passing an optimisation set is the recommended approach because pipeliner tracks it as a single pipeline node and downstream jobs inherit the latest metadata automatically.
Continuing jobs
Jobs marked Yes in the Can continue column support PipelinerProject.continue_job() and --continue_job on the CLI. For classification and refinement jobs (relion.class3d.tomo, relion.refine3d.tomo, relion.refine3d.tomo.helical, relion.initialmodel.tomo), continuation picks up the fn_cont option (the path to the current *_optimiser.star file) automatically via continuation_joboption_updates(); relion.class3d.tomo and relion.initialmodel.tomo also raise nr_iter by 10. For Bayesian polishing (relion.framealigntomo), continuation appends --only_do_unfinished. Pseudo-subtomogram generation (relion.pseudosubtomo) changes nothing on continuation: the continued job re-runs the same relion_tomo_subtomo command.
Jobs marked No (relion.ctfrefinetomo, relion.reconstructparticletomo) do not support continuation; PipelinerProject.get_continuation_job() will raise NotImplementedError for them.
External programs required
| Job type | External program(s) |
|---|---|
relion.picktomo | relion_python_tomo_pick, relion_python_tomo_get_particle_poses |
ltm.create.mask, ltm.create.template, ltm.template.match, ltm.extract.peaks, ltm.halftomo.localcc | ltm (declared in jobinfo.programs, so these jobs are marked unavailable when ltm is not found) |
relion.importtomo.coordinates | relion_tomo_import_coordinates |
relion.pseudosubtomo | relion_tomo_subtomo |
relion.initialmodel.tomo | relion_refine, relion_align_symmetry |
relion.class3d.tomo | relion_refine |
relion.refine3d.tomo, relion.refine3d.tomo.helical | relion_refine |
relion.ctfrefinetomo | relion_tomo_refine_ctf |
relion.framealigntomo | relion_tomo_align, relion_tomo_align_mpi |
relion.reconstructparticletomo | relion_tomo_reconstruct_particle |
relion.joinstar.tomograms | (none — pure Python) |
eulermate.import.coordinates | (none — Python script) |
If a required executable is missing, the job loads normally with job.jobinfo.is_available == False and job.jobinfo.unavailable_message explaining which executable could not be found. The job can still be scheduled but will fail at execution time.
Job-by-job option reference
relion.picktomo — Napari Manual Particle Picking
Opens the Napari interface to let you manually pick particles from reconstructed tomograms. Not recommended for remote sessions.
Key options
| Key | Label | Type | Default |
|---|---|---|---|
in_tomoset | Input tomograms: | InputNode (TomogramGroupMetadata) | (required) |
pick_mode | Picking model: | MultipleChoice | Spheres |
particle_spacing | Particle spacing: | Float | 60 |
in_star_file | Input particles: | InputNode (ParticleGroupMetadata) | (optional) |
Outputs: particles.star (ParticleGroupMetadata), optimisation_set.star (TomoOptimisationSet).
eulermate.import.coordinates — EulerMate Subtomogram Import
Reads an IMOD model file (.mod) and generates a RELION STAR file containing particle coordinates and Euler angles calculated from dipole tangent/normal vectors.
Key options
| Key | Label | Type | Default |
|---|---|---|---|
model_file | IMOD model: | InputNode (ParticleGroupMetadata) | (required) |
binning | Binning factor to apply on coordinates: | Float | 1.0 |
tomoname | Tomogram name: | String | (required) |
Outputs: imod2relion_particles.star (ParticleGroupMetadata).
relion.importtomo.coordinates — Import Tomography Coordinates
Imports particle coordinates into a tomography project, outputting a particles.star file as a ParticleGroupMetadata node. Note: is_tomo is False for this job type.
Key options: particle_star, use_wildcard, in_coords, remove_substring, is_center, scale_factor, add_factor.
Outputs: particles.star (ParticleGroupMetadata).
ltm.create.mask — Create Mask for Template Matching
Creates a spherical or disc-shaped mask for use in LTM template matching.
Key options
| Key | Label | Type | Default |
|---|---|---|---|
fn_ref | Reference map: | InputNode (DensityMap) | (required) |
center_x | Mask center coordinate - X (voxels): | Int | (required) |
center_y | Mask center coordinate - Y (voxels): | Int | (required) |
center_z | Mask center coordinate - Z (voxels): | Int | (required) |
radius | Mask radius (voxels): | Int | 10 |
geometry | Mask geometry: | MultipleChoice | sphere |
soft_edge | Soft edge width (voxels): | Int | 2 |
height | Disc height (voxels): | Int | 20 |
elongation_axis | Disc elongation axis: | MultipleChoice | z |
Outputs: ltm_template_mask.mrc (Mask3D).
ltm.create.template — Create Template for Template Matching
Prepares a CTF-weighted, low-pass filtered template for LTM template matching.
Key options
| Key | Label | Type | Default |
|---|---|---|---|
fn_tomogram | Tomogram file: | InputNode (Tomogram) | (required) |
fn_ref | Reference map: | InputNode (DensityMap) | (required) |
box_size_vox | Box size (voxels): | Int | (required) |
lowpass_resol | Low-pass resolution (A): | Float | 40.0 |
kV | Voltage (kV): | Int | 300 |
Cs | Spherical aberration (mm): | Float | 2.7 |
Q0 | Amplitude contrast: | Float | 0.1 |
defocus_um | Nominal defocus (um): | Float | 3.0 |
Outputs: template.mrc (DensityMap).
ltm.template.match — Template Matching with LTM
Runs GPU-accelerated template matching on a tomogram using a prepared template and mask. Produces cross-correlation score maps.
Key options
| Key | Label | Type | Default |
|---|---|---|---|
fn_tomogram | Tomogram file: | InputNode (Tomogram) | (required) |
fn_template | Template file: | InputNode (DensityMap) | (required) |
fn_template_mask | Template mask file: | InputNode (Mask3D) | (required) |
tilt_min | Minimum tilt angle (degrees, e.g. -40): | Float | -40.0 |
tilt_max | Maximum tilt angle (degrees, e.g. 40): | Float | 40.0 |
particle_diameter | Particle diameter (A): | Float | (required) |
mask_type | Mask type: | MultipleChoice | spherical |
angle_step | Angular step (degrees): | Float | (optional) |
psi_step | Psi step (degrees): | Float | (optional) |
chunk_size | Chunk size (angles): | Int | 4 |
gpu_id | Which GPU ID to use (e.g. 0 or 1 etc): | Int | 0 |
Outputs: best_score_map.mrc, best_angle_map.npy, std_cc_map.mrc (DensityMap); tm_config.yaml (ParamsData).
ltm.extract.peaks — Extract Peaks from Template Matching
Extracts particle positions from LTM score maps. is_tomo=True.
Key options (non-exhaustive): cc_min (label: CC minimum (Optional):, default None), use_conf_yaml, conf_yaml, extract_by_number, z_thresh_min, z_thresh_max.
ltm.halftomo.localcc — Half-Tomogram Local Cross-Correlation
Computes local cross-correlation for half-tomograms. is_tomo=True.
Key options: fn_half1_tomogram, fn_half2_tomogram, fn_template_mask_path.
relion.pseudosubtomo — Extract Pseudo-Subtomograms
Extracts 2D stacks or 3D pseudo-subtomograms from tilt series images for use in subtomogram averaging. Supports continuation (can_continue=True).
Key options
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional when using direct entries) |
do_use_direct_entries | OR: use direct entries? | Boolean | False |
in_tomograms | Input tomogram set: | InputNode (TomogramGroupMetadata) | (required if direct) |
in_particles | Input particle set: | InputNode (ParticleGroupMetadata) | (required if direct) |
in_trajectories | Input trajectory set: | InputNode (TomoTrajectoryData) | (optional) |
box_size | Box size (binned pix): | Int | 64 |
crop_size | Cropped box size (binned pix): | Int | (optional) |
binfactor | Binning factor: | Int | 4 |
max_dose | Maximum dose (e/A^2): | Float | (optional) |
min_nr_frames | Minimum nr. frames: | Int | 1 |
do_output_2dstacks | Write output as 2D stacks? | Boolean | True |
do_float16 | Write output in float16? | Boolean | True |
do_extract_reproject | Extract and re-project real subtomograms? | Boolean | False |
Outputs: particles.star (ParticleGroupMetadata), optimisation_set.star (TomoOptimisationSet).
MPI: Yes (get_runtab_options(mpi=True, threads=True, addtl_args=True)).
relion.initialmodel.tomo — Initial Model (Tomography)
Generates a de novo 3D initial model from pseudo-subtomograms using VDAM. Supports continuation (can_continue=True). is_tomo=True.
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
use_direct_entries | OR: use direct entries? | Boolean | False |
in_tomograms | Input tomogram set: | InputNode | (required if direct) |
in_particles | Input particle set: | InputNode | (required if direct) |
fn_cont | Continue from here: | InputNode (ProcessData) | (continue only) |
nr_iter | Number of VDAM mini-batches: | Int | 200 |
tau_fudge | Regularisation parameter T: | Float | 4.0 |
nr_classes | Number of classes: | Int | 1 |
particle_diameter | Mask diameter (A): | Float | 200.0 |
sym_name | Symmetry: | String | C1 |
do_ctf_correction | Do CTF-correction? | Boolean | True |
sigma_tilt | Prior width on tilt angle (deg): | Int | (optional) |
MPI: No (get_runtab_options(mpi=False, threads=True, addtl_args=True)).
relion.class3d.tomo — 3D Classification (Tomography)
Multi-reference 3D classification of pseudo-subtomograms. Supports continuation (can_continue=True).
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
use_direct_entries | OR: use direct entries? | Boolean | False |
in_particles | Input particle set: | InputNode | (required if direct) |
in_tomograms | Input tomogram set: | InputNode | (required if direct) |
in_trajectories | Input trajectory set: | InputNode | (optional) |
fn_ref | Reference map: | InputNode (DensityMap) | (required) |
fn_cont | Continue from here: | InputNode | (continue only) |
fn_mask | Reference mask (optional): | InputNode (Mask3D) | (optional) |
nr_classes | Number of classes: | Int | 1 |
nr_iter | Number of iterations: | Int | 25 |
tau_fudge | Regularisation parameter T: | Float | 4.0 |
particle_diameter | Mask diameter (A): | Float | 200.0 |
sym_name | Symmetry: | String | C1 |
trust_ref_size | Resize reference if needed? | Boolean | True |
sigma_tilt | Prior width on tilt angle (deg): | Int | (optional) |
do_ctf_correction | Do CTF-correction? | Boolean | True |
sampling | Angular sampling interval: | MultipleChoice | 7.5 degrees |
Continuation: Automatically sets fn_cont to the current optimiser file and increments nr_iter by 10.
MPI: Yes (inherits from RelionClass3DJob).
relion.refine3d.tomo — 3D Auto-Refine (Tomography)
Gold-standard 3D auto-refinement of pseudo-subtomograms. Supports continuation (can_continue=True).
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
use_direct_entries | OR: use direct entries? | Boolean | False |
in_particles | Input particle set: | InputNode | (optional, direct) |
in_tomograms | Input tomogram set: | InputNode | (optional, direct) |
in_trajectories | Input trajectory set: | InputNode | (optional) |
fn_ref | Reference map: | InputNode (DensityMap) | (required) |
fn_mask | Reference mask (optional): | InputNode (Mask3D) | (optional) |
fn_cont | Continue from here: | InputNode | (continue only) |
sym_name | Symmetry: | String | C1 |
particle_diameter | Mask diameter (A): | Float | 200.0 |
trust_ref_size | Resize reference if needed? | Boolean | True |
sampling | Initial angular sampling: | MultipleChoice | 7.5 degrees |
offset_range | Initial offset range (pix): | Float | 5.0 |
offset_step | Initial offset step (pix): | Float | 1.0 |
sigma_tilt | Prior width on tilt angle (deg): | Int | (optional) |
do_ctf_correction | Do CTF-correction? | Boolean | True |
do_solvent_fsc | Use solvent-flattened FSCs? | Boolean | False |
Continuation: Sets fn_cont to the current optimiser file via find_current_opt_name().
Outputs: run_half1_class001_unfil.mrc, run_half2_class001_unfil.mrc, run_class001.mrc (DensityMap), run_data.star (ParticleGroupMetadata), run_optimiser.star (OptimiserData), run_optimisation_set.star (TomoOptimisationSet).
relion.refine3d.tomo.helical — Helical 3D Auto-Refine (Tomography)
Helical variant of tomography 3D refinement. Sets can_continue=True; continuation sets fn_cont to the current optimiser file, as for relion.refine3d.tomo. Adds helical symmetry options on top of relion.refine3d.tomo.
Additional key options
| Key | Label | Type | Default |
|---|---|---|---|
helical_rise_initial | Initial helical rise (A): | Float | 0.0 |
helical_twist_initial | Initial helical twist (deg): | Float | 0.0 |
Note: uses the labels 'Initial helical rise (A):' and 'Initial helical twist (deg):'. Both default to 0.0.
relion.ctfrefinetomo — Refine CTF Parameters (Tomography)
Refines defocus and contrast scale parameters for each tilt image. Does not support continuation (can_continue defaults to False).
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
use_direct_entries | OR: use direct entries? | Boolean | False |
in_tomograms | Input tomogram set: | InputNode | (required if direct) |
in_particles | Input particle set: | InputNode | (required if direct) |
in_halfmaps | One of the 2 reference half-maps: | InputNode (DensityMap, kwds: halfmap) | (optional) |
in_refmask | Reference mask: | InputNode (Mask3D) | (required) |
in_post | Input postprocess STAR: | InputNode (ProcessData) | (required) |
box_size | Box size for estimation (pix): | Int | 256 |
do_defocus | Refine Defocus? | Boolean | True |
focus_range | Defocus search range (A): | Float | 3000.0 |
do_reg_def | Do defocus regularisation? | Boolean | False |
lambda | Defocus regularisation lambda: | Float | 0.1 |
do_scale | Refine Contrast Scale? | Boolean | True |
do_frame_scale | Refine scale per frame? | Boolean | True |
do_tomo_scale | Refine scale per tomogram: | Boolean | False |
Outputs: particles_ctf_refine.star (ParticleGroupMetadata), optimisation_set.star (TomoOptimisationSet), logfile.pdf (LogFile).
MPI: Yes (get_runtab_options(mpi=True, threads=True, addtl_args=True), default nr_mpi=1).
relion.framealigntomo — Tomogram Bayesian Polishing
Per-particle (and per-tilt) motion correction / frame alignment using the subtomogram version of Bayesian polishing. Supports continuation (can_continue=True); appends --only_do_unfinished on continue.
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
use_direct_entries | OR: use direct entries? | Boolean | False |
in_tomograms | Input tomogram set: | InputNode | (required if direct) |
in_particles | Input particle set: | InputNode | (required if direct) |
in_halfmaps | One of the 2 reference half-maps: | InputNode (DensityMap, kwds: halfmap) | (required) |
in_refmask | Reference mask: | InputNode (Mask3D) | (required) |
in_post | Input postprocess STAR: | InputNode (ProcessData) | (required) |
box_size | Box size for estimation (pix): | Int | 256 |
max_error | Max position error (pix): | Float | 5.0 |
do_shift_align | Align by shift only? | Boolean | False |
shift_align_type | Alignment model | MultipleChoice | Entire micrographs |
do_motion | Fit per-particle motion? | Boolean | False |
sigma_vel | Sigma for velocity (A/dose): | Float | 0.2 |
sigma_div | Sigma for divergence (A): | Float | 5000.0 |
do_sq_exp_ker | Use Gaussian decay? | Boolean | False |
Exactly one of do_shift_align and do_motion must be True: with both True, or both False (the defaults), generating the commands raises AssertionError.
Outputs: logfile.pdf (LogFile), optimisation_set.star (TomoOptimisationSet).
MPI: Yes.
relion.reconstructparticletomo — Reconstruct 3D Particle
Reprojects and back-projects tilt series data to reconstruct 3D particle maps from refined particle positions. Does not support continuation.
Key options (selected)
| Key | Label | Type | Default |
|---|---|---|---|
in_optimisation | Input optimisation set: | InputNode (TomoOptimisationSet) | (optional) |
do_use_direct_entries | OR: use direct entries? | Boolean | True |
in_tomograms | Relion tomograms STAR file: | InputNode (TomogramGroupMetadata) | (required if direct) |
in_particles | Particles STAR file: | InputNode (ParticleGroupMetadata) | (required if direct) |
in_trajectories | Input trajectory set: | InputNode (TomoTrajectoryData) | (optional) |
binfactor | Binning factor: | Int | 4 |
box_size | Box size (binned pix): | Int | 64 |
crop_size | Cropped box size (binned pix): | Int | (optional) |
Wiener_SNR | Wiener SNR constant: | Float | 0.0 |
point_group | Symmetry: | String | C1 |
Outputs: merged.mrc, half1.mrc, half2.mrc (DensityMap), optimisation_set.star (TomoOptimisationSet).
MPI: Yes (default nr_mpi=1).
relion.joinstar.tomograms — Join Tomogram/Tilt-Series STAR Files
Merges two or more tomogram or tilt-series STAR files. Validates at scheduling time that at least 2 input files are present. Column mismatches raise ValueError('Star files have different blocks/columns') at execution time.
Key options
| Key | Label | Type |
|---|---|---|
input_tomo_files | Merge tomogram STAR files | MultiInputNode (TomogramGroupMetadata) |
input_ts_files | OR: Merge tilt series STAR files | MultiInputNode (TiltSeriesGroupMetadata) |
remove_duplicates | Remove duplicate entries? | Boolean (default True) |
Outputs: merged_tomograms.star (TomogramGroupMetadata) or merged_tilt_series.star (TiltSeriesGroupMetadata) depending on input.
Multiple input values are stored with ::: as separator in run.job and STAR files.
1. Napari manual picking (relion.picktomo)
This job launches the Napari GUI for interactive particle picking on reconstructed tomograms. It requires relion_python_tomo_pick and relion_python_tomo_get_particle_poses on PATH.
import os
from pipeliner.api.manage_project import PipelinerProject
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.picktomo",
"in_tomoset": "Tomograms/job005/tomograms.star",
"pick_mode": "Spheres",
"particle_spacing": "60",
},
run_in_foreground=True,
)
print(job.output_dir)
Outputs: particles.star (ParticleGroupMetadata) and optimisation_set.star (TomoOptimisationSet) in Picks/jobNNN/.
To load existing particles as annotations, set pick_mode to Particles and provide in_star_file.
2. Extract pseudo-subtomograms (relion.pseudosubtomo)
This job supports continuation (can_continue = True). It accepts either an optimisation set or direct entries.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.pseudosubtomo",
"in_optimisation": "Picks/job006/optimisation_set.star",
"do_use_direct_entries": "No",
"box_size": "64",
"crop_size": "-1",
"binfactor": "4",
"do_output_2dstacks": "Yes",
"do_float16": "Yes",
"nr_mpi": "1",
"nr_threads": "4",
},
run_in_foreground=True,
)
Outputs: particles.star and optimisation_set.star in Extract/jobNNN/.
3. Generate an initial model (relion.initialmodel.tomo)
Supports continuation (can_continue = True). Does not support MPI (get_runtab_options(mpi=False)).
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.initialmodel.tomo",
"in_optimisation": "Extract/job007/optimisation_set.star",
"use_direct_entries": "No", # this job uses use_direct_entries, not do_use_direct_entries
"nr_iter": "200",
"tau_fudge": "4",
"nr_classes": "1",
"particle_diameter": "200",
"sym_name": "C1",
"do_run_C1": "Yes",
"nr_threads": "4",
},
run_in_foreground=False,
)
proj.wait_for_job_to_finish(job.output_dir, error_on_fail=True)
To continue from a previous iteration, use get_continuation_job(), which auto-populates fn_cont:
cont_job = proj.get_continuation_job("InitialModel/job008/")
# fn_cont is already set to the latest optimiser file
cont_job.joboptions["nr_iter"].value = 300
proj.run_job(cont_job, run_in_foreground=False)
4. 3D classification (relion.class3d.tomo)
Inherits from RelionClass3DJob. Supports continuation (can_continue = True). Accepts an optimisation set or direct entries.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.class3d.tomo",
"in_optimisation": "Extract/job007/optimisation_set.star",
"use_direct_entries": "No",
"fn_ref": "InitialModel/job008/run_it200_class001.mrc",
"nr_classes": "3",
"nr_iter": "25",
"tau_fudge": "4",
"particle_diameter": "200",
"sym_name": "C1",
"sigma_tilt": "-1",
"nr_threads": "4",
},
run_in_foreground=False,
)
Note: relion.class3d.tomo does not register do_solvent_fsc (that option belongs to relion.refine3d); including it raises ValueError.
sigma_tilt of -1 (the same as leaving it blank) means no prior on the tilt angle.
5. 3D auto-refinement (relion.refine3d.tomo)
Supports continuation (can_continue = True). Runs relion_refine (mpirun -n 3 relion_refine_mpi with the default nr_mpi of 3) with --auto_refine --split_random_halves. The sampling option default is '7.5 degrees'.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.refine3d.tomo",
"in_optimisation": "Class3D/job009/optimisation_set.star",
"use_direct_entries": "No",
"fn_ref": "Class3D/job009/run_it025_class001.mrc",
"particle_diameter": "200",
"sym_name": "C1",
"sampling": "7.5 degrees",
"offset_range": "5",
"offset_step": "1",
"nr_threads": "4",
},
run_in_foreground=False,
)
For continuation, fn_cont must point to the current *_optimiser.star file. Use get_continuation_job() to have it populated automatically:
cont = proj.get_continuation_job("Refine3D/job010/")
proj.run_job(cont, run_in_foreground=False)
6. Reconstruct 3D particle (relion.reconstructparticletomo)
Does not support continuation (can_continue is not set to True in this class). MPI default is 1.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.reconstructparticletomo",
"in_optimisation": "Refine3D/job010/run_optimisation_set.star",
"do_use_direct_entries": "No",
"box_size": "64",
"binfactor": "1",
"point_group": "C1",
"nr_mpi": "1",
"nr_threads": "4",
},
run_in_foreground=False,
)
Outputs: merged.mrc, half1.mrc, half2.mrc, and optimisation_set.star in Reconstruct/jobNNN/.
Note:
relion.reconstructparticletomo.helical(RelionReconstructParticleJobHelical) exists in the codebase but is not registered as an entry-point job type.new_job_of_type('relion.reconstructparticletomo.helical')will raise an error.
7. CTF refinement for tomography (relion.ctfrefinetomo)
Does not support continuation. MPI default is 1.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.ctfrefinetomo",
"in_optimisation": "Refine3D/job010/run_optimisation_set.star",
"use_direct_entries": "No",
"in_halfmaps": "Reconstruct/job011/half1.mrc",
"in_refmask": "MaskCreate/job012/mask.mrc",
"in_post": "PostProcess/job013/postprocess.star",
"do_defocus": "Yes",
"do_scale": "Yes",
"nr_mpi": "1",
"nr_threads": "4",
},
run_in_foreground=False,
)
Outputs: particles_ctf_refine.star, optimisation_set.star, and logfile.pdf in CtfRefine/jobNNN/.
8. Frame alignment / Bayesian polishing (relion.framealigntomo)
Supports continuation (can_continue = True). Uses relion_tomo_align and relion_tomo_align_mpi.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "relion.framealigntomo",
"in_optimisation": "CtfRefine/job014/optimisation_set.star",
"use_direct_entries": "No",
"in_halfmaps": "Reconstruct/job011/half1.mrc",
"in_refmask": "MaskCreate/job012/mask.mrc",
"in_post": "PostProcess/job013/postprocess.star",
"box_size": "256",
"max_error": "5",
"do_shift_align": "No",
"do_motion": "Yes",
"nr_mpi": "1",
"nr_threads": "4",
},
run_in_foreground=False,
)
Exactly one of do_shift_align and do_motion must be Yes; with both No (the defaults) or both Yes, generating the commands raises AssertionError. Continuing this job appends --only_do_unfinished to the relion_tomo_align command.
Outputs: logfile.pdf and optimisation_set.star in Polish/jobNNN/.
9. Template matching with LTM (ltm.template.match)
Part of the TemplateMatching output directory group. is_tomo = True. Does not support continuation.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "ltm.template.match",
"fn_tomogram": "Tomograms/job005/tomo001.mrc",
"fn_template": "TemplateMatching/job001/template.mrc",
"fn_template_mask": "TemplateMatching/job002/ltm_template_mask.mrc",
"tilt_min": "-40.0",
"tilt_max": "40.0",
"particle_diameter": "120.0",
"gpu_id": "0",
},
run_in_foreground=False,
)
Outputs: best_score_map.mrc, best_angle_map.npy, std_cc_map.mrc, and tm_config.yaml in TemplateMatching/jobNNN/.
The exact label for the GPU option is
'Which GPU ID to use (e.g. 0 or 1 etc):'in run.job files.
10. Extract peaks from template matching (ltm.extract.peaks)
is_tomo = True. Does not support continuation.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "ltm.extract.peaks",
"use_conf_yaml": "No",
"fn_tomogram": "Tomograms/job005/tomo001.mrc",
"fn_template": "TemplateMatching/job001/template.mrc",
"fn_template_mask": "TemplateMatching/job002/ltm_template_mask.mrc",
"particle_diameter": "120.0",
"fn_best_score_map": "TemplateMatching/job003/best_score_map.mrc",
"fn_best_angle_map": "TemplateMatching/job003/best_angle_map.npy",
"fn_std_cc_map": "TemplateMatching/job003/std_cc_map.mrc",
"tomo_id": "tomo001",
"num_peaks_to_extract": "500",
"cc_min": "",
},
run_in_foreground=True,
)
use_conf_yaml defaults to Yes, in which case only conf_yaml (the tm_config.yaml written by ltm.template.match) is used and the tomogram, template, mask, diameter and map options are deactivated; set it to No, as here, to give those inputs individually.
Registered outputs include histogram.pdf and cc_vs_std_scatter.pdf.
11. Create a mask for template matching (ltm.create.mask)
is_tomo = True. Does not support continuation. Requires the ltm executable.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "ltm.create.mask",
"fn_ref": "Reconstruct/job011/merged.mrc",
"center_x": "32",
"center_y": "32",
"center_z": "32",
"radius": "25",
"geometry": "sphere",
"soft_edge": "2",
},
run_in_foreground=True,
)
Output: ltm_template_mask.mrc (Mask3D node) in TemplateMatching/jobNNN/.
12. Create a template for template matching (ltm.create.template)
is_tomo = True. Does not support continuation.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "ltm.create.template",
"fn_tomogram": "Tomograms/job005/tomo001.mrc",
"fn_ref": "Reconstruct/job011/merged.mrc",
"box_size_vox": "64",
"lowpass_resol": "40",
"kV": "300",
"Cs": "2.7",
"Q0": "0.1",
"defocus_um": "3.0",
},
run_in_foreground=True,
)
Output: template.mrc (DensityMap node) in TemplateMatching/jobNNN/.
13. EulerMate subtomogram import (eulermate.import.coordinates)
is_tomo = True. Does not support continuation. Converts IMOD model files to RELION STAR particle files with Euler angles.
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
job = proj.run_job(
{
"_rlnJobTypeLabel": "eulermate.import.coordinates",
"model_file": "/data/picks/tomo001.mod",
"tomoname": "tomo001",
"binning": "4.0",
},
run_in_foreground=True,
)
Output: imod2relion_particles.star (ParticleGroupMetadata node) in Import/jobNNN/.
14. Using schedule_job to build an automated pipeline
For fully headless automation you can schedule multiple jobs and run them as a sequence. The example below schedules pseudo-subtomogram extraction followed by 3D classification, then runs them as a named schedule.
import os
from pipeliner.api.manage_project import PipelinerProject
os.chdir("/data/my_tomo_project")
proj = PipelinerProject()
extract_job = proj.schedule_job(
{
"_rlnJobTypeLabel": "relion.pseudosubtomo",
"in_optimisation": "Picks/job006/optimisation_set.star",
"do_use_direct_entries": "No",
"box_size": "64",
"binfactor": "4",
"do_output_2dstacks": "Yes",
"nr_threads": "4",
},
comment="Auto extraction step",
)
class3d_job = proj.schedule_job(
{
"_rlnJobTypeLabel": "relion.class3d.tomo",
"in_optimisation": extract_job.output_dir + "optimisation_set.star",
"use_direct_entries": "No",
"fn_ref": "InitialModel/job008/run_it200_class001.mrc",
"nr_classes": "3",
"nr_iter": "25",
"particle_diameter": "200",
"sym_name": "C1",
"sigma_tilt": "-1",
"nr_threads": "4",
},
comment="3D classification step",
)
schedule_name = proj.run_schedule(
fn_sched="my_tomo_schedule",
job_ids=[extract_job.output_dir, class3d_job.output_dir],
nr_repeat=1,
seconds_wait_after=5,
)
15. Checking job availability before scheduling
Before running a job whose external program may be missing, check availability:
from pipeliner.job_factory import new_job_of_type
job = new_job_of_type("ltm.template.match")
if not job.jobinfo.is_available:
print(job.jobinfo.unavailable_message)
else:
print("ltm.template.match is available")
You can also run pipeliner.check_setup from the command line to see availability for all registered job types:
pipeliner.check_setup