CCPEM Pipeliner
Guide

Tomography Jobs: Picking and Subtomogram Averaging

Tomography picking, template matching and subtomogram averaging jobs


Overview

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.


Usage

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 nameClassOutput directoryCan continue
relion.picktomoRelionTomoNapariPickJobPicks/No
eulermate.import.coordinatesEulermateJobImport/No
relion.importtomo.coordinatesRelionImportCoordinatesImport/No
ltm.create.maskLtmCreateMaskJobTemplateMatching/No
ltm.create.templateLtmCreateTemplateJobTemplateMatching/No
ltm.template.matchLtmJobTemplateMatching/No
ltm.extract.peaksLtmExtractPeaksJobTemplateMatching/No
ltm.halftomo.localccLtmHalfTomoLocalCCJobTemplateMatching/No
relion.pseudosubtomoRelionPseudoSubtomoJobExtract/Yes
relion.initialmodel.tomoRelionTomoInimodelJobInitialModel/Yes
relion.class3d.tomoTomoRelionClass3DJobClass3D/Yes
relion.refine3d.tomoTomoRelionRefine3DRefine3D/Yes
relion.refine3d.tomo.helicalTomoRelionRefine3DHelicalRefine3D/Yes
relion.ctfrefinetomoTomoRelionCtfRefineCtfRefine/No
relion.framealigntomoTomoRelionBayesPolishJobPolish/Yes
relion.reconstructparticletomoRelionReconstructParticleJobReconstruct/No
relion.joinstar.tomogramsRelionJoinStarTomogramsJoinStar/No

Note: relion.reconstructparticletomo.helical (RelionReconstructParticleJobHelical) exists in the codebase but is not a registered entry-point job type. Calling new_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 typeExternal program(s)
relion.picktomorelion_python_tomo_pick, relion_python_tomo_get_particle_poses
ltm.create.mask, ltm.create.template, ltm.template.match, ltm.extract.peaks, ltm.halftomo.localccltm (declared in jobinfo.programs, so these jobs are marked unavailable when ltm is not found)
relion.importtomo.coordinatesrelion_tomo_import_coordinates
relion.pseudosubtomorelion_tomo_subtomo
relion.initialmodel.tomorelion_refine, relion_align_symmetry
relion.class3d.tomorelion_refine
relion.refine3d.tomo, relion.refine3d.tomo.helicalrelion_refine
relion.ctfrefinetomorelion_tomo_refine_ctf
relion.framealigntomorelion_tomo_align, relion_tomo_align_mpi
relion.reconstructparticletomorelion_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

KeyLabelTypeDefault
in_tomosetInput tomograms:InputNode (TomogramGroupMetadata)(required)
pick_modePicking model:MultipleChoiceSpheres
particle_spacingParticle spacing:Float60
in_star_fileInput 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

KeyLabelTypeDefault
model_fileIMOD model:InputNode (ParticleGroupMetadata)(required)
binningBinning factor to apply on coordinates:Float1.0
tomonameTomogram 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

KeyLabelTypeDefault
fn_refReference map:InputNode (DensityMap)(required)
center_xMask center coordinate - X (voxels):Int(required)
center_yMask center coordinate - Y (voxels):Int(required)
center_zMask center coordinate - Z (voxels):Int(required)
radiusMask radius (voxels):Int10
geometryMask geometry:MultipleChoicesphere
soft_edgeSoft edge width (voxels):Int2
heightDisc height (voxels):Int20
elongation_axisDisc elongation axis:MultipleChoicez

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

KeyLabelTypeDefault
fn_tomogramTomogram file:InputNode (Tomogram)(required)
fn_refReference map:InputNode (DensityMap)(required)
box_size_voxBox size (voxels):Int(required)
lowpass_resolLow-pass resolution (A):Float40.0
kVVoltage (kV):Int300
CsSpherical aberration (mm):Float2.7
Q0Amplitude contrast:Float0.1
defocus_umNominal defocus (um):Float3.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

KeyLabelTypeDefault
fn_tomogramTomogram file:InputNode (Tomogram)(required)
fn_templateTemplate file:InputNode (DensityMap)(required)
fn_template_maskTemplate mask file:InputNode (Mask3D)(required)
tilt_minMinimum tilt angle (degrees, e.g. -40):Float-40.0
tilt_maxMaximum tilt angle (degrees, e.g. 40):Float40.0
particle_diameterParticle diameter (A):Float(required)
mask_typeMask type:MultipleChoicespherical
angle_stepAngular step (degrees):Float(optional)
psi_stepPsi step (degrees):Float(optional)
chunk_sizeChunk size (angles):Int4
gpu_idWhich GPU ID to use (e.g. 0 or 1 etc):Int0

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

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional when using direct entries)
do_use_direct_entriesOR: use direct entries?BooleanFalse
in_tomogramsInput tomogram set:InputNode (TomogramGroupMetadata)(required if direct)
in_particlesInput particle set:InputNode (ParticleGroupMetadata)(required if direct)
in_trajectoriesInput trajectory set:InputNode (TomoTrajectoryData)(optional)
box_sizeBox size (binned pix):Int64
crop_sizeCropped box size (binned pix):Int(optional)
binfactorBinning factor:Int4
max_doseMaximum dose (e/A^2):Float(optional)
min_nr_framesMinimum nr. frames:Int1
do_output_2dstacksWrite output as 2D stacks?BooleanTrue
do_float16Write output in float16?BooleanTrue
do_extract_reprojectExtract and re-project real subtomograms?BooleanFalse

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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
use_direct_entriesOR: use direct entries?BooleanFalse
in_tomogramsInput tomogram set:InputNode(required if direct)
in_particlesInput particle set:InputNode(required if direct)
fn_contContinue from here:InputNode (ProcessData)(continue only)
nr_iterNumber of VDAM mini-batches:Int200
tau_fudgeRegularisation parameter T:Float4.0
nr_classesNumber of classes:Int1
particle_diameterMask diameter (A):Float200.0
sym_nameSymmetry:StringC1
do_ctf_correctionDo CTF-correction?BooleanTrue
sigma_tiltPrior 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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
use_direct_entriesOR: use direct entries?BooleanFalse
in_particlesInput particle set:InputNode(required if direct)
in_tomogramsInput tomogram set:InputNode(required if direct)
in_trajectoriesInput trajectory set:InputNode(optional)
fn_refReference map:InputNode (DensityMap)(required)
fn_contContinue from here:InputNode(continue only)
fn_maskReference mask (optional):InputNode (Mask3D)(optional)
nr_classesNumber of classes:Int1
nr_iterNumber of iterations:Int25
tau_fudgeRegularisation parameter T:Float4.0
particle_diameterMask diameter (A):Float200.0
sym_nameSymmetry:StringC1
trust_ref_sizeResize reference if needed?BooleanTrue
sigma_tiltPrior width on tilt angle (deg):Int(optional)
do_ctf_correctionDo CTF-correction?BooleanTrue
samplingAngular sampling interval:MultipleChoice7.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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
use_direct_entriesOR: use direct entries?BooleanFalse
in_particlesInput particle set:InputNode(optional, direct)
in_tomogramsInput tomogram set:InputNode(optional, direct)
in_trajectoriesInput trajectory set:InputNode(optional)
fn_refReference map:InputNode (DensityMap)(required)
fn_maskReference mask (optional):InputNode (Mask3D)(optional)
fn_contContinue from here:InputNode(continue only)
sym_nameSymmetry:StringC1
particle_diameterMask diameter (A):Float200.0
trust_ref_sizeResize reference if needed?BooleanTrue
samplingInitial angular sampling:MultipleChoice7.5 degrees
offset_rangeInitial offset range (pix):Float5.0
offset_stepInitial offset step (pix):Float1.0
sigma_tiltPrior width on tilt angle (deg):Int(optional)
do_ctf_correctionDo CTF-correction?BooleanTrue
do_solvent_fscUse solvent-flattened FSCs?BooleanFalse

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

KeyLabelTypeDefault
helical_rise_initialInitial helical rise (A):Float0.0
helical_twist_initialInitial helical twist (deg):Float0.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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
use_direct_entriesOR: use direct entries?BooleanFalse
in_tomogramsInput tomogram set:InputNode(required if direct)
in_particlesInput particle set:InputNode(required if direct)
in_halfmapsOne of the 2 reference half-maps:InputNode (DensityMap, kwds: halfmap)(optional)
in_refmaskReference mask:InputNode (Mask3D)(required)
in_postInput postprocess STAR:InputNode (ProcessData)(required)
box_sizeBox size for estimation (pix):Int256
do_defocusRefine Defocus?BooleanTrue
focus_rangeDefocus search range (A):Float3000.0
do_reg_defDo defocus regularisation?BooleanFalse
lambdaDefocus regularisation lambda:Float0.1
do_scaleRefine Contrast Scale?BooleanTrue
do_frame_scaleRefine scale per frame?BooleanTrue
do_tomo_scaleRefine scale per tomogram:BooleanFalse

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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
use_direct_entriesOR: use direct entries?BooleanFalse
in_tomogramsInput tomogram set:InputNode(required if direct)
in_particlesInput particle set:InputNode(required if direct)
in_halfmapsOne of the 2 reference half-maps:InputNode (DensityMap, kwds: halfmap)(required)
in_refmaskReference mask:InputNode (Mask3D)(required)
in_postInput postprocess STAR:InputNode (ProcessData)(required)
box_sizeBox size for estimation (pix):Int256
max_errorMax position error (pix):Float5.0
do_shift_alignAlign by shift only?BooleanFalse
shift_align_typeAlignment modelMultipleChoiceEntire micrographs
do_motionFit per-particle motion?BooleanFalse
sigma_velSigma for velocity (A/dose):Float0.2
sigma_divSigma for divergence (A):Float5000.0
do_sq_exp_kerUse Gaussian decay?BooleanFalse

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)

KeyLabelTypeDefault
in_optimisationInput optimisation set:InputNode (TomoOptimisationSet)(optional)
do_use_direct_entriesOR: use direct entries?BooleanTrue
in_tomogramsRelion tomograms STAR file:InputNode (TomogramGroupMetadata)(required if direct)
in_particlesParticles STAR file:InputNode (ParticleGroupMetadata)(required if direct)
in_trajectoriesInput trajectory set:InputNode (TomoTrajectoryData)(optional)
binfactorBinning factor:Int4
box_sizeBox size (binned pix):Int64
crop_sizeCropped box size (binned pix):Int(optional)
Wiener_SNRWiener SNR constant:Float0.0
point_groupSymmetry:StringC1

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

KeyLabelType
input_tomo_filesMerge tomogram STAR filesMultiInputNode (TomogramGroupMetadata)
input_ts_filesOR: Merge tilt series STAR filesMultiInputNode (TiltSeriesGroupMetadata)
remove_duplicatesRemove 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.


Examples

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