Lecture 10 — Running the Analysis Pipeline on Talapas

Bill Cresko and Shannon Snyder

Lecture 10: Running the Analysis Pipeline on Talapas

Where this fits

Goals of this lecture

  • See how the workshop’s 1:1:1:1 structure maps onto the cluster
  • Understand the 0108 scripts as a chained pipeline of batch jobs
  • Use the run_rscript.sbatch wrapper and run_core_pipeline.sbatch
  • Know why you pre-cache ifnb and what DATA_DIR is for
  • Understand why ifnb yields real biology, not a null result
  • Know where the bonus scripts 13–17 fit

The 1:1:1:1 mapping

Four legs, one workflow

  • Every module of the workshop has four parallel legs:
  • Lecture → concept slides (this deck)
  • Reading → long-form prose chapter
  • Laptop tutorial → rich learning notebook with output
  • Talapas script → the same workflow, streamlined for SLURM

Notebooks vs scripts

  • The laptop notebooks are teaching documents: prose, “Think about it” prompts, inline plots.
  • The Talapas scripts are the same analysis, stripped to runnable R.
  • Scripts carry only minimal comments that mark each step’s alignment with its notebook — the explanation lives in the notebook.
  • Same dataset, same biology — no new analysis to learn, just a new place to run it.

The chained pipeline

0108: each output feeds the next

  • The eight core scripts chain on a shared ifnb object.
  • Each step reads the previous step’s .rds/.csv and writes the next one’s input.
  • Only external input is ifnb itself, fetched by script 01 (I have also already loaded it for you).
  • They must run in order — a missing or corrupt hand-off breaks the chain.

The hand-off chain

Script Reads Writes
01_qc_preprocessing muscData::Kang18_8vs8() ifnb_preprocessed.rds
02_dimreduction_clustering ifnb_preprocessed.rds ifnb_clustered.rds
03_markers_annotation ifnb_clustered.rds ifnb_annotated.rds
04_reference_annotation ifnb_annotated.rds ifnb_annotated_final.rds
05_integration ifnb_annotated_final.rds ifnb_integrated.rds
06_pseudobulk_de ifnb_integrated.rds ifnb_pseudobulk_de.csv
07_functional_analysis ifnb_pseudobulk_de.csv functional/*.csv
08_differential_abundance ifnb_integrated.rds ifnb_milo_da.csv

Why .rds hand-offs?

  • Each .rds is a checkpoint — a fully-formed Seurat object on disk.
  • Re-run step 6 without re-running 1–5; just point it at the saved object.
  • Steps can be right-sized independently (06 and 08 want more memory).
  • A clean, inspectable contract between steps — exactly how reproducible pipelines are built.

Confirm before launching the next

  • The steps are chained — don’t fire step 2 until step 1 truly finished.
  • Check the .out log for the Wrote ... line.
  • Run seff <jobid> and confirm State: COMPLETED (not OUT_OF_MEMORY / TIMEOUT).
  • A job killed mid-write leaves a corrupt .rds that poisons the next step.

run_sc_pipeline.sbatch — the whole series at once

STEPS=(01_qc_preprocessing.R 02_dimreduction_clustering.R … 08_differential_abundance.R)
for step in "${STEPS[@]}"; do
  echo "==== RUNNING ${step} ===="
  Rscript "${step}"
done
  • Runs all eight in order, in a single allocation (~12 h, ~96 GB).
  • Submit once: sbatch run_sc_pipeline.sbatch
  • Simplest way to reproduce the entire core analysis end-to-end.

Memory per step — not all steps are equal

  • Steps 06 (pseudobulk_de) and 08 (differential_abundance) use more RAM — override with --mem=96G.
  • Confirm each step is COMPLETED — a job killed mid-write leaves a corrupt .rds that poisons the chain.

Setup details

Pre-caching ifnb

  • Script 01 downloads ifnb (~25 MB) via ExperimentHub on first use.
  • Compute nodes may have no outbound internet — the download would fail inside the job.
  • So populate the cache once on a login node (which has internet) before submitting:
  • If this doesn’t work for you, I have already download the data and intermediate data files so you don’t get stuck

DATA_DIR — where the hand-off files land

  • By default the scripts write their .rds/.csv hand-offs to ../data/.
  • Set DATA_DIR to redirect them — e.g. to fast, roomy /scratch:
  • Keeps large intermediates off /home/ and makes the run reproducible and relocatable.

The biology

Why ifnb gives real results

  • ifnb (Kang et al. 2017) has a real conditionstim: CTRL vs IFN-β.
  • And real biological replicatesind: 8 lupus donors, each in both conditions.
  • So scripts 05/06/08 use genuine sample and donor structure.
  • Integration corrects the CTRL/STIM axis; DE and DA recover a real interferon-stimulated gene (ISG) response — not a null.

Same dataset, same biology

  • This is the identical dataset and biology as the laptop notebooks.
  • The cluster run isn’t a toy demo — it reproduces the workshop’s real findings at scale.
  • A single dissociated-tumor run would lack condition + replicate structure; ifnb has both by design.

Bonus scripts

Scripts 13–17 — standalone tracks

  • Parallel the downstream bonus notebooks; run after the core, not in sequence.
  • 13_wgcna — co-expression modules, its own GSE152418 dataset.
  • 14_trajectory_cellcomm — runs on the annotated ifnb object.
  • 15_scatac_signac — scATAC on PBMC 10k, its own data.
  • 16_spatialstxBrain spatial data.
  • 17_fair_metadata — exports ifnb for submission (.h5ad).

What’s next

  • You can now run the full ifnb analysis on Talapas as chained SLURM jobs.
  • For the raw-FASTQ upstream path, see the Cell Ranger bonus modules and the full Talapas run roadmap.

Key takeaways

  • The pipeline is a chain: .rds checkpoints hand off step to step, in order.
  • run_sc_pipeline.sbatch runs all eight analysis scripts.
  • Pre-cache ifnb on a login node; use DATA_DIR to relocate outputs.