CCPEM Pipeliner
Guide

Maintenance Commands

The other console scripts: check_setup, recover_project, merge_projects, regenerate_results and more


Overview

This page documents the auxiliary console scripts that ship with ccpem-pipeliner alongside the main pipeliner command. These scripts handle installation verification, project recovery, multi-project merging, result regeneration, tutorial generation, and deposition credentials — tasks you run occasionally rather than as part of every processing workflow. Understanding when and how to use each script helps you maintain healthy projects, onboard new users, and integrate pipeliner into facility automation systems.


Prerequisites

Before using any of the commands on this page you need:

  • Python ≥ 3.9
  • ccpem-pipeliner installed in your active environment:
    pip install ccpem-pipeliner
    
  • A pipeliner project directory (for scripts that operate on a project). The project must contain default_pipeline.star. The .CCPEM_pipeliner_project marker file is created automatically if it is missing, for example in a project started in RELION.
  • For pipeliner.setup_onedep_credentials: a valid OneDep refresh token obtained from the wwPDB portal.
  • For pipeliner.make_project_tutorial: a project containing the terminal job you specify, with a readable run.job file in the directory of that job and of every job upstream of it. Job status is not checked.
  • For pipeliner.merge_projects: one or more existing pipeliner project directories with readable default_pipeline.star files and intact output node files, and a --new_project path that does not hold anything you want to keep: if that directory already exists, it is deleted and replaced by the merged project.

Usage

Each script is installed as a named console entry point. pipeliner.recover_project, pipeliner.merge_projects, pipeliner.regenerate_results, pipeliner.make_project_tutorial, pipeliner.setup_onedep_credentials and pipeliner.bfactor_plot print their flags with --help. pipeliner.check_setup, pipeliner.update_nodes, pipeliner.update_metadata_schema and pipeliner.update_onedep_dict take no arguments and ignore --help: they run immediately, so pipeliner.update_nodes --help edits the project's pipeline, pipeliner.update_metadata_schema --help updates any out-of-date schema files inside the installed package (and prompts to delete stale ones), and pipeliner.update_onedep_dict --help downloads the dictionary and can replace the bundled copy. The sections below describe each script's purpose, arguments, and when to reach for it.


pipeliner.check_setup

Verifies that the pipeliner console scripts are reachable on your PATH and that the external programs needed by each registered job type are present. Run this immediately after installation and any time a job reports an unexpected availability problem.

pipeliner.check_setup

The command prints four sections:

  1. Python version check — confirms Python ≥ 3.9.
  2. Available job types check — tests every registered job type; marks each as Success (all executables found) or Unavailable (one or more executables missing), and prints the missing executable name for each gap.
  3. Pipeliner setup check — looks for the six console scripts pipeliner, pipeliner.bfactor_plot, pipeliner.update_metadata_schema, pipeliner.recover_project, pipeliner.check_setup, and pipeliner.regenerate_results on your PATH.
  4. Final setup report — summarises overall health.

The final line is one of:

  • SUCCESS: The pipeliner and all job types appear to be correctly installed and ready to use — everything is in order.
  • The pipeliner is correctly installed, but some jobs are unavailable — the pipeliner itself is fine; install the missing external programs (e.g. RELION, CTFFIND) when you need them.
  • The pipeliner is not installed correctly — one or more console scripts are missing; reinstall with pip install --force-reinstall ccpem-pipeliner.

Note: pipeliner.merge_projects, pipeliner.make_project_tutorial, pipeliner.update_nodes, pipeliner.update_onedep_dict, and pipeliner.setup_onedep_credentials are not checked by pipeliner.check_setup. Their absence does not affect the final report.


pipeliner.recover_project

Attempts to repair a project whose default_pipeline.star has become inconsistent or whose .relion_lock directory was left behind after a crash. Run this from the project root directory.

cd /path/to/project
pipeliner.recover_project

By default the script prompts Perform recovery (Y/N)? before making any changes. To skip the prompt in automated contexts pass -y / --assume-yes:

pipeliner.recover_project --assume-yes

What it does:

  1. Checks that default_pipeline.star exists in the current directory. If it is completely missing, the script exits immediately — it cannot restore from per-job backups when there is no pipeline file at all.
  2. Removes .relion_lock if present.
  3. Searches all */job* subdirectories for a copy of default_pipeline.star (written there at scheduling time), starting from the highest-numbered job and working backwards, and restores the newest copy found.

Warning: Jobs scheduled after the backup was written are lost from the restored pipeline. pipeliner.recover_project is a crash-recovery tool, not a general reconciliation utility. Do not use it to undo deliberate changes.

The script is mostly silent on success because logging is not configured at the script level; it prints only warnings and errors. To confirm recovery succeeded, check that default_pipeline.star has been updated and that .relion_lock no longer exists.


pipeliner.merge_projects

Combines one or more existing pipeliner projects into a single unified project (--old_projects accepts a single project). You can run it from any directory — it does not need to be a project root — by providing explicit paths:

pipeliner.merge_projects \
  --old_projects /path/to/projectA /path/to/projectB \
  --new_project /path/to/merged_project

Key behaviours:

  • If the --new_project directory already exists, it is deleted (the script logs Target dir: <path> already exists, overwriting) and replaced by the merged project.
  • STAR files are copied into the merged project; all other files are symlinked to save disk space.
  • Relative paths inside all copied STAR files are updated to point to their new locations within the merged project structure.
  • Each sub-project is placed in a named subdirectory inside the new project. If two input projects share the same directory name, the second receives an auto-generated name (MergedProj001, etc.).
  • A MergeProjects/job001 job is created in the new project; its merge log is written to MergeProjects/job001/run.out.
  • The merged sub-project subdirectories can be opened in Doppio for inspection, but must not be modified — do not run new jobs or recalculate results displays inside them.

pipeliner.regenerate_results

Rebuilds the results display files for completed jobs and/or nodes without re-running the underlying processing. This is useful after upgrading pipeliner, after manually editing output files, or when display files have become corrupted.

Run from the project root:

# Regenerate everything in the project
pipeliner.regenerate_results

# Regenerate specific jobs
pipeliner.regenerate_results --jobs MotionCorr/job002/ CtfFind/job003/

# Regenerate specific nodes
pipeliner.regenerate_results --nodes MotionCorr/job002/corrected_micrographs.star

# Generate node summary objects instead of normal display objects
pipeliner.regenerate_results --nodes MotionCorr/job002/corrected_micrographs.star --node_summary

# Continue past errors on individual jobs/nodes
pipeliner.regenerate_results --ignore_errors

When called with no --jobs or --nodes arguments, the script regenerates results for every job and every node in the project.


pipeliner.make_project_tutorial

Reads an existing project and writes a dated .rst tutorial document describing how to reproduce the workflow up to a specified terminal job. The document lists each job in the upstream graph, highlights parameters that differ from their defaults, and notes which GUI panel to use for each step.

Run from the project root and supply the terminal job with --job (the flag is required):

cd /path/to/completed_project
pipeliner.make_project_tutorial --job Refine3D/job007/

The output file is named <YYYYMMDD>_doppio_tutorial.rst and is written to the current directory.

Important: pipeliner.make_project_tutorial reads an existing project — it does not create a new one or populate sample data. The terminal job and every job upstream of it must have a readable run.job file in its directory; job status is not checked, so scheduled, failed or aborted jobs are included too. The --job flag is required; omitting it causes the script to fail.


pipeliner.update_nodes

Adds expected output nodes that are missing from default_pipeline.star. This is typically needed when you adopt a project that was originally started in RELION, because RELION does not write all the node entries that pipeliner expects.

Run from the project root:

cd /path/to/project
pipeliner.update_nodes

The script prints a list of any nodes it adds, or reports that the pipeline is already up to date.


pipeliner.update_metadata_schema

Regenerates the JSON metadata schemas stored in pipeliner/metadata_schema/. Run this after adding or modifying job types to keep the schema directory consistent with the registered job set. It is primarily a developer/facility-engineer tool.

pipeliner.update_metadata_schema

The script compares the current schema on disk with what each registered job type declares, updates any that are out of date, and prompts you to delete stale schema files for job types that no longer exist.


pipeliner.update_onedep_dict

Downloads the latest PDBx/mmCIF dictionary from the wwPDB (mmcif.pdb.org) and replaces the bundled copy inside the package if it has changed. Run this periodically to keep deposition validation current.

pipeliner.update_onedep_dict

No arguments are required. The script logs whether the dictionary was updated or was already current.


pipeliner.setup_onedep_credentials

Creates or updates the OneDep credential configuration from a refresh token. The token is read from a hidden prompt (or from the ONEDEP_REFRESH_TOKEN environment variable) and is never written to a pipeliner project directory.

pipeliner.setup_onedep_credentials

Credentials are stored by default at:

  • Linux: ~/.config/ccpem/pipeliner/onedep/config.toml
  • macOS: ~/Library/Application Support/ccpem/pipeliner/onedep/config.toml

To write to a different location pass --config-path:

pipeliner.setup_onedep_credentials --config-path /custom/path/onedep/config.toml

The path can also be overridden at runtime by setting the PIPELINER_ONEDEP_CONFIG_PATH environment variable.


pipeliner.bfactor_plot

Produces B-factor (resolution vs. particle count) plots from an existing refinement and post-processing job pair. Run from the project root; the --postprocess_job flag is required.

pipeliner.bfactor_plot --postprocess_job PostProcess/job012/

Additional flags:

FlagPurpose
--start_at_ppResume from the post-processing step, assuming all refinement jobs have already completed
--only_analysisRun only the analysis step when refinement and post-processing have already been done
--angpix <value>Pixel size for post-processing jobs
--min_particles <value>Minimum particle count below which resolution is not calculated

Examples

Verify installation after pip install

pipeliner.check_setup

Recover a crashed project without a confirmation prompt

cd /data/my_project
pipeliner.recover_project --assume-yes

Merge two facility projects into one

pipeliner.merge_projects \
  --old_projects /data/session_20240101 /data/session_20240108 \
  --new_project /data/merged_sessions

Regenerate all result displays after a pipeliner upgrade

cd /data/my_project
pipeliner.regenerate_results

Regenerate results for two specific jobs, ignoring errors on others

pipeliner.regenerate_results \
  --jobs MotionCorr/job002/ CtfFind/job003/ \
  --ignore_errors

Write a tutorial for a completed project up to the final refinement job

cd /data/completed_project
pipeliner.make_project_tutorial --job Refine3D/job009/

Add missing nodes from a project originally started in RELION

cd /data/relion_project
pipeliner.update_nodes

Store OneDep credentials for deposition

pipeliner.setup_onedep_credentials
# Paste the OneDep refresh token: (hidden input)

Run a B-factor plot analysis on an existing post-processing job

cd /data/my_project
pipeliner.bfactor_plot --postprocess_job PostProcess/job012/ --angpix 1.05

Regenerate results using the Python API (equivalent to pipeliner.regenerate_results)

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

proj = PipelinerProject()

with ProjectGraph(name=proj.pipeline_name) as pipeline:
    job_names = [proc.name for proc in pipeline.process_list]

for job_name in job_names:
    job = proj.get_job(job_name)
    job.save_results_display_files()

Troubleshooting

Console scripts not found after installation

Symptom: Running pipeliner.check_setup (or any other pipeliner script) produces a command not found error.

Cause: pip entry points were not installed correctly, or the scripts directory is not on PATH.

Fix: Reinstall the package to force entry-point recreation:

pip install --force-reinstall ccpem-pipeliner

For an editable install from a source checkout, run pip install -e . from the repository root instead; pip install --force-reinstall ccpem-pipeliner would replace the editable install of your checkout with the release from PyPI. Then confirm the scripts directory (e.g. ~/.local/bin for user installs) is on your PATH.


pipeliner.check_setup reports jobs as Unavailable

Symptom: One or more job types are listed as Unavailable with a message like '<command>' missing from system path.

Cause: The external executable required by that job type (e.g. ctffind, MotionCor2, Gctf) is not installed or not on PATH.

Fix: Install the missing program and ensure its directory is on PATH, or add its directory to PIPELINER_ADDITIONAL_PROGRAM_PATHS. Job types with missing executables can still be scheduled via the API; they will fail at execution time when the underlying command is invoked.


pipeliner.recover_project exits with "No pipeline file found"

Symptom: The script prints an error about no pipeline file and exits without recovering anything.

Cause: default_pipeline.star is completely missing from the project directory. The script requires this file to exist before it can restore from per-job backups.

Fix: Restore default_pipeline.star manually (e.g. from a filesystem backup or by copying the newest per-job backup from a job subdirectory). Then rerun pipeliner.recover_project.


pipeliner.recover_project runs but jobs are missing from the pipeline

Symptom: After recovery the pipeline is missing some jobs that existed before the corruption.

Cause: The script restores from the newest per-job backup of default_pipeline.star. Jobs scheduled after that backup was written are not recorded in the restored file.

Fix: This is expected behaviour. Re-schedule the missing jobs manually if needed. pipeliner.recover_project is a crash-recovery tool, not a general reconciliation method.


pipeliner.make_project_tutorial fails immediately

Symptom: The script exits with an error or usage message without producing a .rst file.

Cause: The --job flag was not supplied, or the specified job name does not exist in the current project.

Fix: The --job flag is required. Provide the full job name of a completed terminal job, for example:

pipeliner.make_project_tutorial --job Refine3D/job010/

Confirm the job name by inspecting default_pipeline.star. (pipeliner --available_jobs lists job types such as relion.refine3d, not the jobs in the project.)


pipeliner.setup_onedep_credentials reports a credential setup failure

Symptom: The script prints OneDep credential setup failed: ... and exits with status 1.

Cause: The refresh token was empty, invalid, or the config directory could not be created.

Fix: Ensure you paste a valid, non-empty OneDep refresh token at the prompt (or set ONEDEP_REFRESH_TOKEN before running). Check that the config directory (~/.config/ccpem/pipeliner/onedep/ on Linux) is writable, or override the path with --config-path.


pipeliner.regenerate_results fails on one job and stops

Symptom: The script raises an exception and exits after failing to regenerate results for a single job.

Cause: Default behaviour stops on the first error.

Fix: Add --ignore_errors to skip failing jobs and continue processing the rest:

pipeliner.regenerate_results --ignore_errors

Investigate the skipped jobs individually once the rest have been regenerated.


Settings directory not writable warning

Symptom: On import or first run pipeliner logs: CCP-EM Pipeliner could not create a settings file at <path>. Settings can still be set using environment variables.

Cause: The platform-specific config directory is not writable.

Fix: This is a non-fatal warning. All settings can be provided via environment variables (e.g. PIPELINER_QSUB_TEMPLATE, PIPELINER_QUEUE_NAME). Alternatively, fix the directory permissions so pipeliner can write ccpem-pipeliner-settings.json there.