CCPEM Pipeliner
Guide

RELION Compatibility

How pipeliner projects stay interchangeable with RELION


Overview

This page explains how pipeliner projects remain interchangeable with RELION projects. It covers the shared STAR-file pipeline format, how pipeliner converts job-type names from older RELION conventions, the rules for reading and converting RELION 3 and RELION 4 pipeline files, and the differences between RELION's and pipeliner's job exit-status sentinel files. Understanding these compatibility mechanisms matters if you work with projects originally created in the RELION GUI, run pipeliner alongside RELION tools, or need to open pipeliner projects in the RELION GUI.


Prerequisites

Before working with RELION-compatible projects you need:

  • ccpem-pipeliner installed in a Python ≥ 3.9 environment (pip install ccpem-pipeliner)
  • A project directory containing a valid default_pipeline.star file (either created by pipeliner or by RELION 4 / RELION 5)
  • RELION installed if you intend to run RELION job types (optional for reading pipeline files)
  • Sufficient filesystem permissions to write into the project directory when converting older pipeline files

Usage

Shared pipeline graph file

Both pipeliner and RELION represent the entire workflow as a STAR-format pipeline graph file. By default this file is named default_pipeline.star and lives in the project root. It contains up to five STAR blocks (pipeliner writes each block other than pipeline_general only when it has rows, so a new project or one without input edges has fewer):

  • pipeline_general — job counter and pipeline-level metadata
  • pipeline_processes — one row per job with name, alias, type label, and status
  • pipeline_nodes — one row per data node with file path and type
  • pipeline_input_edges — edges from nodes to the jobs that consume them
  • pipeline_output_edges — edges from jobs to the nodes they produce

Because pipeliner writes this file in the same format RELION expects, a project created with pipeliner can be opened directly in the RELION GUI or Doppio without any conversion step.

Opening a RELION project in pipeliner

Change into the RELION project directory and instantiate PipelinerProject. Pipeliner detects the existing default_pipeline.star and treats the project as imported from RELION:

import os
os.chdir("/path/to/relion_project")

from pipeliner.api.manage_project import PipelinerProject
proj = PipelinerProject()  # opens the existing project

No --new_project flag or make_new_project=True is needed — pipeliner finds the pipeline file automatically.

From the command line, cd into the project directory and run pipeliner commands there; each command opens default_pipeline.star in the current directory when it needs it. Note that pipeliner --available_jobs does not check that the project can be read: it only lists the registered job types and never opens the pipeline file.

Pipeline file version detection and conversion

When pipeliner opens a pipeline file for editing it inspects the file version:

Pipeline formatRead-only openWritable open
ccpem-pipelinerRead as-isRead as-is
RELION 4Node-type names mapped in memoryNode-type names mapped in memory; the whole file is rewritten in pipeliner format when the writable session closes (no .old backup)
RELION 3Raises RuntimeErrorConverted in-place; original moved to <filename>.old

RELION 4 node-type names such as MicrographsData, MicrographsCoords, MicrographMoviesData, Images2DData, and ParticlesData are remapped to their pipeliner equivalents (MicrographGroupMetadata, MicrographCoordsGroup, etc.) in memory every time the file is read. A read-only open never rewrites the file on disk, but any command that opens the project for writing (for example pipeliner --run_job or pipeliner --set_status) rewrites the whole file in pipeliner format when it finishes, without keeping a backup. To convert the file explicitly and keep a backup first, run:

pipeliner --convert_pipeline_file default_pipeline.star

For a RELION 4 file this command replaces the RELION 4 node-type names in the file and saves a copy of the original as default_pipeline.star.old (the copy is made only if some names needed replacing).

RELION 3 pipelines use integer job-type codes and integer node-type codes, both of which are converted to string labels during the in-place conversion that happens automatically on the first writable open.

RELION 3 job-type integer mapping

RELION 3 stores each process's type as an integer (the _rlnJobType key). Pipeliner maps these integers to general directory names (for example 0 → Import, 1 → MotionCorr) and then inspects the job's option values to resolve the precise subtype (for example relion.motioncorr.own versus relion.motioncorr.motioncor2). If the subtype cannot be determined unambiguously the process is recorded as <GeneralName>.AMBIGUOUS_TYPE in the converted file, and a warning is logged. The one exception is Select jobs: ambiguous Select processes are always converted to relion.select.interactive.

The get_job_type() function in pipeliner.relion_compatibility handles both the old integer key (_rlnJobType) and the new string key (_rlnJobTypeLabel), so job.star files from either RELION version are parsed correctly.

Additional ad-hoc job-name conversions

Some RELION 5 job names diverge from the pipeliner names and some old pipeliner names have been renamed. These are handled by additional_job_conversions() in pipeliner.relion_compatibility:

Source namePipeliner name
relion.extract.reextractrelion.extract
relion.ctfrefine.anisomagrelion.ctfrefine
relion.import.otherrelion.import

These conversions are applied transparently whenever a pipeline file or job.star file is read.

Job exit-status sentinel files

Pipeliner and RELION use the same directory-based sentinel-file convention to record job status, but the file names differ:

Statuspipeliner fileRELION file
SucceededPIPELINER_JOB_EXIT_SUCCESSRELION_JOB_EXIT_SUCCESS
FailedPIPELINER_JOB_EXIT_FAILEDRELION_JOB_EXIT_FAILURE
AbortedPIPELINER_JOB_EXIT_ABORTEDRELION_JOB_EXIT_ABORTED
Abort triggerPIPELINER_JOB_ABORT_NOWRELION_JOB_ABORT_NOW

Note the spelling difference in the failed-status file: pipeliner uses FAILED while RELION uses FAILURE. Jobs that were run by RELION and left a RELION_JOB_EXIT_* file are recognised by the RELION GUI but not automatically by pipeliner's status queries; use pipeliner --set_status <job> success (or the equivalent API call PipelinerProject.update_job_status(job, 'Succeeded')) to write the pipeliner sentinel if needed. This raises ValueError if the pipeline already records the job as Succeeded.

Project lock file

Both pipeliner and RELION lock the project at the pipeline level by creating a .relion_lock directory next to the pipeline file. Individual job directories do not have per-job locks — only the status sentinel files described above. If pipeliner or RELION crashes while the lock is held, use pipeliner.recover_project to remove the stale lock:

cd /path/to/project
pipeliner.recover_project --assume-yes

Examples

Example 1 — Open a RELION project and list its jobs

This example shows how to open an existing RELION project from Python and inspect the pipeline graph.

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.project_graph import ProjectGraph

os.chdir("/path/to/relion_project")

# PipelinerProject detects the existing default_pipeline.star automatically.
# No make_new_project=True is needed.
proj = PipelinerProject()

# Inspect the pipeline graph directly (read-only).
with ProjectGraph(read_only=True) as pipeline:
    for proc in pipeline.process_list:
        print(proc.name, proc.type, proc.status)

Example 2 — Explicitly convert a RELION 4 pipeline file to pipeliner format on disk

RELION 4 node-type names are remapped in memory on every read. Opening the pipeline read-only leaves the file untouched, but any operation that opens it for writing (such as running a job) rewrites it in pipeliner format when it closes, without keeping a backup. Use the CLI flag first to convert it once and keep a backup:

cd /path/to/relion_project
pipeliner --convert_pipeline_file default_pipeline.star

After this command, the RELION 4 node-type names in default_pipeline.star are replaced with their pipeliner names and the original is preserved as default_pipeline.star.old. If no node-type name needs changing, the file is left as it is and no .old file is written.

Example 3 — Read a RELION 3-style job.star file using the compatibility layer

The jobstar_options_as_dict() function in pipeliner.relion_compatibility transparently handles both old (_rlnJobType integer) and new (_rlnJobTypeLabel string) job.star formats.

from pipeliner.relion_compatibility import jobstar_options_as_dict, get_job_type

# Works with job.star files from RELION 3.x (integer _rlnJobType)
# or RELION 4+/pipeliner (string _rlnJobTypeLabel).
options = jobstar_options_as_dict("MotionCorr/job002/job.star")
job_type, type_key = get_job_type(options)
print(job_type)   # e.g. 'relion.motioncorr.own'
print(type_key)   # '_rlnJobTypeLabel' or '_rlnJobType'

Troubleshooting

Opening a RELION 3 pipeline file raises RuntimeError

Symptom: RuntimeError: Error reading pipeline file default_pipeline.star when the pipeline is opened read-only, for example with ProjectGraph(read_only=True) or by a pipeliner command that first looks a job up by name (such as --set_status or --delete_job). Creating PipelinerProject() does not raise it on its own, because the constructor does not open the pipeline file.

Cause: RELION 3 pipeline files use integer codes for job types and node types. Pipeliner can only convert them when the pipeline is opened for writing; in read-only mode it raises RuntimeError rather than attempting an in-place conversion.

Fix: Open the project in writable mode (for example with pipeliner --run_job, used without --overwrite) so pipeliner converts the file automatically, or run the explicit conversion command first:

pipeliner --convert_pipeline_file default_pipeline.star

The original file is saved as default_pipeline.star.old.


Job type appears as <GeneralName>.AMBIGUOUS_TYPE after conversion

Symptom: After converting a RELION 3 pipeline, some processes in default_pipeline.star have a type ending in .AMBIGUOUS_TYPE.

Cause: The RELION 3 integer job-type code maps to a general category (for example MotionCorr) but the specific subtype could not be determined from the job's options, perhaps because the job.star file for that job is missing or has been modified. (If a missing job.star file is needed to convert one of the job's output nodes, the conversion stops with FileNotFoundError instead.)

Fix: Select jobs never end up with this type — ambiguous Select processes are automatically resolved to relion.select.interactive. For other ambiguous types, manually set the correct status or recreate the job. You can also use pipeliner --set_status <job> success to mark a job completed so the pipeline graph is consistent.


pipeliner does not see a job's RELION exit-status file

Symptom: A job that RELION marked as finished (leaving RELION_JOB_EXIT_SUCCESS) shows as Running or Scheduled in pipeliner.

Cause: Pipeliner reads its own sentinel files (PIPELINER_JOB_EXIT_SUCCESS, PIPELINER_JOB_EXIT_FAILED, PIPELINER_JOB_EXIT_ABORTED). RELION's RELION_JOB_EXIT_SUCCESS is not automatically recognised by pipeliner's status queries.

Fix: Update the job status so pipeliner writes its own sentinel:

pipeliner --set_status MotionCorr/job001/ success

Or via the Python API:

proj.update_job_status("MotionCorr/job001/", "Succeeded")

Project is locked after a RELION or pipeliner crash

Symptom: RuntimeError: Trying to open pipeline … could not acquire lock after waiting for 60 seconds when trying to open the project.

Cause: A .relion_lock directory was left behind by a crashed RELION or pipeliner process.

Fix: Use the recovery tool to remove the stale lock. Note that it also replaces default_pipeline.star with the backup copy from the highest-numbered job directory that has one, if any exists:

cd /path/to/project
pipeliner.recover_project --assume-yes

Verify that .relion_lock has been removed and that default_pipeline.star is intact before continuing.


RELION GUI does not recognise the pipeline after running jobs with pipeliner

Symptom: After running jobs with pipeliner, the RELION GUI shows the project but some jobs or nodes are missing.

Cause: Pipeliner writes PIPELINER_JOB_EXIT_* sentinel files; RELION looks for RELION_JOB_EXIT_* files to determine status. The pipeline graph file (default_pipeline.star) itself is compatible, but job status indicators may differ.

Fix: The pipeline graph is the source of truth for both tools. RELION reads job status primarily from the pipeline graph, so the project should be readable. If specific jobs appear missing, check that their entries are present in default_pipeline.star. Use pipeliner.update_nodes from the project directory to add any expected nodes that are absent from the pipeline file.