CCPEM Pipeliner
Guide

RELION Jobs: Maps, Post-processing and Utilities

RELION post-processing, local resolution, masks, map utilities, ModelAngelo and external jobs


Overview

This page covers the RELION post-processing, local resolution, mask creation, map utility, ModelAngelo model building, and external job types registered in ccpem-pipeliner. These jobs sit at the later stages of a typical SPA pipeline — after 3D refinement — and handle sharpening, resolution estimation, masking, map manipulation, automated model building, and wrapping arbitrary external scripts. Understanding the exact process names, input/output nodes, and key option keys lets you chain these jobs programmatically into automated workflows.


Usage

All jobs on this page are used through the same two interfaces: the pipeliner CLI (with a run.job or job.star file) and the PipelinerProject Python API. The pattern is identical regardless of job type:

  1. Generate a default parameter file.
  2. Edit it to set your inputs and options.
  3. Run or schedule the job.

Generating default parameter files

For CLI use, generate a run.job file (labels as keys):

pipeliner --default_runjob relion.postprocess
# writes relion_postprocess_run.job

For Python API use, generate a job.star file (option keys as keys):

pipeliner --default_jobstar relion.postprocess
# writes relion_postprocess_job.star

Running a job from the CLI

Edit the generated file to set your inputs, then run:

pipeliner --run_job relion_postprocess_run.job

To overwrite an existing job in place:

pipeliner --run_job relion_postprocess_run.job --overwrite PostProcess/job005/

To continue a job that supports continuation:

pipeliner --continue_job PostProcess/job005/

Running a job from the Python API

import os
os.chdir("/path/to/my/project")

from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar, job_default_parameters_dict

proj = PipelinerProject()

Set options via a parameters dict (use option keys, not labels):

params = job_default_parameters_dict("relion.postprocess")
params["fn_in"] = "Refine3D/job003/run_half1_class001_unfil.mrc"
params["fn_mask"] = "MaskCreate/job004/mask.mrc"
params["do_auto_bfac"] = "true"
job = proj.run_job(params, run_in_foreground=True)

Or use write_default_jobstar / edit_jobstar / run_job with a file:

template = write_default_jobstar("relion.postprocess")
out_star = edit_jobstar(
    template,
    {"fn_in": "Refine3D/job003/run_half1_class001_unfil.mrc",
     "fn_mask": "MaskCreate/job004/mask.mrc"},
    "my_postprocess.star",
)
job = proj.run_job(out_star, run_in_foreground=True)

Job option assignment via the API object

If you have a PipelinerJob object directly, set option values via the .value property:

from pipeliner.job_factory import new_job_of_type
job = new_job_of_type("relion.maskcreate")
job.joboptions["fn_in"].value = "Refine3D/job003/run_class001.mrc"
job.joboptions["lowpass_filter"].value = 15
job.joboptions["inimask_threshold"].value = 0.02

Job reference

relion.postprocess — RELION post-processing

Class: PostprocessJob | Output directory: PostProcess/

Sharpens and masks a map from 3D refinement using the gold-standard FSC procedure (relion_postprocess). Supports continuation (can_continue=True).

Key inputs

Option keyTypeDescription
fn_inInputNodeOne of the two unfiltered half-maps; file name must contain half
fn_maskInputNodeSoft-edged solvent mask (values 0–1)
fn_mtfInputNodeMTF STAR file (optional)

Key options

Option keyDefaultDescription
angpix(blank)Calibrated pixel size in Å; if blank, read from MRC header
do_auto_bfactrueEstimate B-factor automatically (Rosenthal & Henderson)
autob_lowres10Lowest resolution (Å) for auto-B fit
do_adhoc_bfacfalseUse a manually supplied B-factor instead
adhoc_bfac-1000User B-factor (negative = sharpening); required when do_adhoc_bfac=true
mtf_angpix(blank)Original detector pixel size (Å); used only when fn_mtf is set
do_skip_fsc_weightingfalseSkip FSC weighting and apply an ad-hoc low-pass filter instead
low_pass5Ad-hoc low-pass filter (Å); required when do_skip_fsc_weighting=true

Validation: at least one of do_auto_bfac or do_adhoc_bfac must be true. If both are true, the automatic B-factor is used.

Outputs

FileNode type
postprocess.mrcDensityMap
postprocess_masked.mrcDensityMap
postprocess.starProcessData
logfile.pdfLogFile

Cleanup removes postprocess_masked.mrc (non-harsh).


relion.localres.own — RELION local resolution

Class: RelionLocalResOwn | Output directory: LocalRes/

Calculates local resolution by sweeping a soft spherical mask across the map using relion_postprocess --locres. Does not support continuation (can_continue defaults to False).

Key inputs

Option keyTypeDescription
fn_inInputNodeOne of the two unfiltered half-maps; name must contain _half
fn_maskInputNodeSolvent mask for the local resolution histogram
fn_mtfInputNodeMTF STAR file (optional)

Key options

Option keyDefaultDescription
angpix1Calibrated pixel size in Å (required)
adhoc_bfac-100B-factor for sharpening during local resolution calculation

Accepts MPI (get_runtab_options(mpi=True, threads=False)) and additional args.

Outputs

FileNode type
histogram.pdfLogFile
relion_locres_filtered.mrcDensityMap
relion_locres.mrcImage3D

relion.localres.resmap — RELION ResMap local resolution

Class: RelionLocalResResMap | Output directory: LocalRes/

Calculates local resolution using the external ResMap program. The ResMap executable is found via PIPELINER_RESMAP_EXECUTABLE or RELION_RESMAP_EXECUTABLE; defaults to ResMap-1.1.4-linux64 (Linux) or ResMap-1.1.4-mac64 (macOS).

Key inputs — same as relion.localres.own (fn_in, fn_mask, angpix).

Key options

Option keyDefaultDescription
pval0.05P-value threshold
minres0.0Highest resolution to evaluate (Å); 0 = auto
maxres0.0Lowest resolution to evaluate (Å); 0 = auto
stepres1.0Resolution step size (Å)

Output: half1_resmap.mrc (Image3D).


relion.maskcreate — RELION mask creation

Class: RelionMaskCreate | Output directory: MaskCreate/

Creates a 3D soft-edged mask from a density map using relion_mask_create. Supports continuation (can_continue=True).

Key inputs

Option keyTypeDescription
fn_inInputNodeInput 3D MRC map (DensityMap)

Key options

Option keyDefaultDescription
lowpass_filter10Low-pass filter applied before binarisation (Å)
angpix(blank)Pixel size (Å); read from header if blank
inimask_threshold0.02Initial binarisation threshold
extend_inimask3Extend binary mask by this many pixels
width_mask_edge3Width of the raised-cosine soft edge (pixels)
do_helixfalseGenerate a cylindrical helical mask spanning Z
helical_z_percentage30.0Central Z fraction (%) for helical mask

Uses threads (get_runtab_options(mpi=False, threads=True)). Number of threads is passed to relion_mask_create --j.

Output: mask.mrc (Mask3D).


relion.map_utilities.filter_map — Filter map

Class: RelionFilterMap | Output directory: FilterMap/

Applies low-pass and/or high-pass filters to one or more maps using relion_image_handler. Accepts multiple input maps (MultiInputNodeJobOption).

Key inputs

Option keyTypeDescription
input_mapMultiInputNodeOne or more input DensityMap nodes

Key options

Option keyDefaultDescription
do_lowpassfalseApply a low-pass filter
lowpass1Low-pass filter resolution (Å); required when do_lowpass=true
do_highpassfalseApply a high-pass filter
highpass1High-pass filter resolution (Å); required when do_highpass=true
do_advancedfalseEnable advanced options
filter_directionnon-directionalDirectionality of low-pass filter (non-directional, X, Y, Z)
filter_edge_width2Filter edge width in resolution shells (advanced)

Validation: at least one filter type must be enabled; low-pass and high-pass values must not be identical.

Outputs: one <basename>_filtered.mrc per input map, with node type inherited from the input node.


relion.map_utilities.flip_handedness — Flip map handedness

Class: RelionFlipMap | Output directory: Flip/

Flips the handedness of one or more maps using relion_image_handler --invert_hand. Accepts multiple input maps.

Key inputs

Option keyTypeDescription
input_mapMultiInputNodeOne or more input DensityMap nodes

Outputs: one <basename>_flipped.mrc per input map.


relion.map_utilities.apply_symmetry — Apply symmetry

Class: RelionApplySymmetry | Output directory: ApplySymmetry/

Applies the chosen symmetry operator to one or more maps using relion_image_handler --sym.

Key inputs

Option keyTypeDescription
input_mapMultiInputNodeOne or more input DensityMap nodes

Key options

Option keyDefaultDescription
symCyclic (C)Symmetry type: Cyclic (C), Dihedral (D), Tetrahedral (T), Octahedral (O), Icosahedral (I)
fold1Symmetry fold (required for C and D; ignored for T, O, I)

Outputs: one <basename>_<sym>sym.mrc per input map.


relion.map_utilities.align_symmetry — Align map symmetry

Class: RelionAlignSymmetry | Output directory: AlignSymmetry/

Aligns the symmetry axes of a map onto the main XYZ coordinate axes using relion_align_symmetry. Takes a single input map.

Key inputs

Option keyTypeDescription
input_mapInputNodeInput DensityMap

Key options

Option keyDefaultDescription
symCyclic (C)Symmetry type
fold1Symmetry fold
box_size64Box size for symmetry search (advanced)
do_recentretrueRecentre the map before finding symmetry axes
nr_uniform400Number of uniform orientations to search
only_rotfalseSearch only rotations (fix tilt and psi)

Output: aligned.mrc (DensityMap).


relion.map_utilities.apply_bfactor — Apply B-factor

Class: RelionApplyBFactor | Output directory: BFactor/

Applies a user-specified B-factor to one or more maps using relion_image_handler --bfactor.

Key inputs

Option keyTypeDescription
input_mapMultiInputNodeOne or more input DensityMap nodes

Key options

Option keyDefaultDescription
bfact-100B-factor to apply (Ų); use negative values for sharpening

Outputs: one <basename>_bfact.mrc per input map.


relion.map_utilities.rebox_rescale_map — Change map box and pixel size

Class: RelionReboxRescaleMap | Output directory: ReboxRescale/

Modifies box size and/or pixel size of one or more maps using relion_image_handler. When both operations are applied, the new box size must be even.

Key inputs

Option keyTypeDescription
input_mapMultiInputNodeOne or more input DensityMap nodes

Key options

Option keyDefaultDescription
do_reboxfalseTrim or pad the map to a new box size
box_size100New box size in pixels (required when do_rebox=true)
do_rescalefalseResample the map at a new pixel size
rescale_angpix1.0New pixel size (Å; required when do_rescale=true)
force_pixel_sizetrueForce the header pixel size to exactly match the requested value

Validation: at least one of do_rebox or do_rescale must be true.

Outputs: one <basename>_reboxed.mrc, <basename>_rescaled.mrc, or <basename>_reboxed_rescaled.mrc per input map.


relion.reconstruct — RELION reconstruct

Class: RelionReconstruct | Output directory: Reconstruct/

Generates a map from a set of particles using relion_reconstruct. Optionally reconstructs half-maps when _rlnRandomSubset assignments are present in the input.

Key inputs

Option keyTypeDescription
input_particlesInputNodeParticles STAR file (ParticleGroupMetadata)

Key options

Option keyDefaultDescription
do_halfmapsfalseReconstruct half-maps alongside the full map
do_ctftrueApply CTF correction during reconstruction
angpix(blank)Pixel size (Å); taken from first optics group if blank
symC1Symmetry to apply
maxres(blank)Maximum resolution to consider (Å); default is Nyquist

Accepts MPI (get_runtab_options(mpi=True, threads=False)) and additional args.

Outputs

FileNode type
reconstruction.mrcDensityMap
reconstruction_half1.mrcDensityMap (when do_halfmaps=true)
reconstruction_half2.mrcDensityMap (when do_halfmaps=true)

Validation at run time: if do_halfmaps=true, the particles STAR file must contain a particles block with a _rlnRandomSubset column; missing either raises ValueError.


relion.reproject — RELION reproject

Class: ReprojectJob | Output directory: Reproject/

Generates 2D projections from a 3D map using relion_project. Projections can be generated from a supplied angles file or as a uniform set.

Key inputs

Option keyTypeDescription
map_filenameInputNodeInput MRC map (DensityMap)
angles_filenameInputNodeSTAR file with Euler angles (EulerAngles; takes precedence over nr_uniform if both are set)

Key options

Option keyDefaultDescription
nr_uniform(blank)Generate this many uniform projections (used only when angles_filename is blank)
apix(blank)Reference pixel size (Å)

No MPI or threads (get_runtab_options(mpi=False, threads=False)).

Outputs

FileNode type
reproj.mrcsImage2DStack
reproj.starEulerAngles (only when using uniform projections)

Validation: an angles_filename or a positive nr_uniform must be supplied; if both are set, the angles file is used.


modelangelo — ModelAngelo automated model building

Class: ModelAngelo | Output directory: ModelAngelo/

Builds an atomic model automatically from a cryo-EM map using ModelAngelo. Can optionally run an HMMer sequence search. Supports continuation (can_continue=True).

The executable is resolved via PIPELINER_MODELANGELO_EXECUTABLE or RELION_MODELANGELO_EXECUTABLE; defaults to relion_python_modelangelo if on PATH, otherwise modelangelo.

Key inputs

Option keyTypeDescription
fn_mapInputNodeB-factor sharpened map (MRC; typically from relion.postprocess)
fn_maskInputNodeOptional 3D mask
p_seqInputNodeFASTA sequence for proteins (optional but strongly recommended)
d_seqInputNodeFASTA sequence for DNA (optional)
r_seqInputNodeFASTA sequence for RNA (optional)
hmmer_inputInputNodeCIF model from a previous ModelAngelo job (for standalone HMMer run)
fn_libInputNodeFASTA library for HMMer search (required when do_hmmer=true)

Key options

Option keyDefaultDescription
do_hmmerfalseRun HMMer search (deactivated when sequences are provided)
alphabetaminoHMMer alphabet: amino, DNA, or RNA
F10.02HMMer F1 parameter
F20.001HMMer F2 parameter
F30.00001HMMer F3 parameter
E10HMMer E-value
use_gputrueUse GPU for inference
gpu_ids""Comma-separated GPU IDs (optional override)

Validation: hmmer_input, if set, must come from a ModelAngelo/ job directory.

Output: <job_dir_name>.cif (AtomCoords; only when fn_map is set).


relion.external — Run external program (RELION compatibility)

Class: RelionExternal | Output directory: External/

Wraps an arbitrary external script and passes standard pipeliner data nodes to it as command-line arguments. This job type is retained for compatibility with RELION's external job mechanism. For new workflows, prefer pipeliner.run_external_program.

Note: jobinfo.alternative_unavailable_reason is set on this job type to indicate that pipeliner.run_external_program is the recommended replacement. The job still loads and can be run.

Key options

Option keyDescription
fn_exePath to the external script
in_movInput movies STAR (MicrographMovieGroupMetadata) — passed as --in_movies
in_micInput micrographs STAR (MicrographGroupMetadata) — passed as --in_mics
in_partInput particles STAR (ParticleGroupMetadata) — passed as --in_parts
in_coordsInput coordinates (MicrographCoordsGroup) — passed as --in_coords
in_3drefInput 3D reference map (DensityMap) — passed as --in_3Dref
in_maskInput 3D mask (Mask3D) — passed as --in_mask
param1_label … param10_labelLabel for optional parameter N
param1_value … param10_valueValue for optional parameter N; passed as --<label> <value>
fn_outputOutput file name (optional; creates an output node if set)
output_nodetypeNode type to assign to the output file
alt_nodetypeCustom node type string (required when output_nodetype is NEW NODE TYPE (not recommended))
output_kwdsKeywords for the output node (separated by :::)

No MPI; uses threads and additional args (get_runtab_options(mpi=False, threads=True, addtl_args=True)).

Success is determined by the script's exit code. The job runner writes PIPELINER_JOB_EXIT_SUCCESS when the script exits 0, and PIPELINER_JOB_EXIT_FAILED on any non-zero exit.


Examples

Generate and run a post-processing job via the Python API

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

# Generate a default job.star template for post-processing
template = write_default_jobstar("relion.postprocess")

# Edit the template: set the half-map, mask, and pixel size
edited = edit_jobstar(
    template,
    {
        "fn_in": "Refine3D/job007/run_half1_class001_unfil.mrc",
        "fn_mask": "MaskCreate/job008/mask.mrc",
        "angpix": "1.06",
        "do_auto_bfac": "Yes",
        "autob_lowres": "10",
    },
    "postprocess_run.job.star",
)

# Run the job and wait for it to finish
job = proj.run_job(edited, run_in_foreground=True)
print(job.output_dir)  # e.g. PostProcess/job009/

Run a post-processing job from the CLI

# Generate a default run.job file
pipeliner --default_runjob relion.postprocess
# This writes relion_postprocess_run.job in the current directory

# Edit the file — lines use the format: <label> == <value>
# Key lines to set:
#   One of the 2 unfiltered half-maps: == Refine3D/job007/run_half1_class001_unfil.mrc
#   Solvent mask: == MaskCreate/job008/mask.mrc
#   Calibrated pixel size (A) == 1.06

pipeliner --run_job relion_postprocess_run.job

Create and run a mask from a refined map

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

template = write_default_jobstar("relion.maskcreate")
edited = edit_jobstar(
    template,
    {
        "fn_in": "PostProcess/job009/postprocess.mrc",
        "lowpass_filter": "15",
        "inimask_threshold": "0.03",
        "extend_inimask": "3",
        "width_mask_edge": "6",
    },
    "maskcreate_run.job.star",
)

job = proj.run_job(edited, run_in_foreground=True)

Run ModelAngelo with a protein sequence

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

template = write_default_jobstar("modelangelo")
edited = edit_jobstar(
    template,
    {
        "fn_map": "PostProcess/job009/postprocess_masked.mrc",
        "p_seq": "sequences/myprotein.fasta",
        "use_gpu": "Yes",
    },
    "modelangelo_run.job.star",
)

# Schedule now, run later
job = proj.schedule_job(edited)
print(job.output_dir)  # e.g. ModelAngelo/job010/

Apply symmetry to a map

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

template = write_default_jobstar("relion.map_utilities.apply_symmetry")
edited = edit_jobstar(
    template,
    {
        "input_map": "PostProcess/job009/postprocess.mrc",
        "sym": "Cyclic (C)",
        "fold": "4",
    },
    "apply_symmetry_run.job.star",
)

job = proj.run_job(edited, run_in_foreground=True)
# Output: ApplySymmetry/job011/postprocess_c4sym.mrc

Run RELION local resolution and continue post-processing

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

template = write_default_jobstar("relion.localres.own")
edited = edit_jobstar(
    template,
    {
        "fn_in": "Refine3D/job007/run_half1_class001_unfil.mrc",
        "angpix": "1.06",
        "fn_mask": "MaskCreate/job008/mask.mrc",
        "adhoc_bfac": "-50",
        "nr_mpi": "4",
    },
    "localres_run.job.star",
)

job = proj.run_job(edited, run_in_foreground=True)
# Outputs: LocalRes/jobNNN/relion_locres.mrc, relion_locres_filtered.mrc, histogram.pdf

Wrap an external script with relion.external

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar

os.chdir("/path/to/my/project")
proj = PipelinerProject()

template = write_default_jobstar("relion.external")
edited = edit_jobstar(
    template,
    {
        "fn_exe": "/path/to/my_script.sh",
        "in_mic": "MotionCorr/job002/corrected_micrographs.star",
        "param1_label": "threshold",
        "param1_value": "0.5",
        "fn_output": "my_result.star",
        "output_nodetype": "ParticleGroupMetadata",
    },
    "external_run.job.star",
)

job = proj.run_job(edited, run_in_foreground=True)

The script at /path/to/my_script.sh will be called with --in_mics, --o, and --threshold 0.5 arguments. It must exit with code 0 on success. The pipeliner writes PIPELINER_JOB_EXIT_SUCCESS or PIPELINER_JOB_EXIT_FAILED in the job directory based on the exit code.