pacsomatic skill (K-Dense scientific-agent-skills)
- Install
- SKILL.md (verbatim)
- Overview
- When to Use This Skill
- Routing and Execution Rules
- Inputs Required
- Workflow
- Agent Response Contract
- Quick Start
- Configuration
- Testing
- References
- Other files in this skill
- references/agent-playbook.md (verbatim)
- What The User Needs To Provide
- references/config-and-output.md (verbatim)
- Required Inputs
- Core Optional Controls
- Execution Backend Controls
- Scheduler Controls (when executor is scheduler-backed)
- Helper Outputs
- Samplesheet Schema
- Run Modes
- Official Output Anchors
- references/pacsomaticguide.md (verbatim)
- What nf-core/pacsomatic runs
- Cross-agent reuse
- Minimal samplesheet format
- Platform-aware execution model in this skill
- Example: generate script only
- Example: dry-run validation
- Example: generate and submit immediately
- Example: submit on Slurm
- Direct command-line operation (no agent wrapper)
- Direct LSF script (no Python wrapper)
- LSF examples aligned with your cluster style
- Best practices
What it does. Operator toolkit for nf-core/pacsomatic matched tumor-normal workflows from BAM inputs. Use this skill when the user needs to validate run inputs, generate pacsomatic-compliant samplesheets, prepare reproducible Nextflow launch artifacts, run locally or submit to schedulers (LSF/Slurm/PBS/SGE), and triage execution failures. Triggers on requests to run pacsomatic, prepare launch commands/scripts, perform dry-run checks, or troubleshoot pipeline startup and scheduler submission errors. Part of K-Dense-AI/scientific-agent-skills (AI Scientist skills) (K-Dense-AI/scientific-agent-skills).
| Upstream | K-Dense-AI/scientific-agent-skills |
| Skill file | skills/pacsomatic/SKILL.md |
| License | MIT (skill folder LICENSE) |
| Author | K-Dense Inc. |
| Fetched | 2026-09-10 |
Install
npx skills add K-Dense-AI/scientific-agent-skills --skill pacsomatic, or copy the skill folder into~/.claude/skills/pacsomatic/.- Raw file:
curl -sL https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/pacsomatic/SKILL.md
SKILL.md (verbatim)
name: pacsomatic
description: Operator toolkit for nf-core/pacsomatic matched tumor-normal workflows from BAM inputs. Use this skill when the user needs to validate run inputs, generate pacsomatic-compliant samplesheets, prepare reproducible Nextflow launch artifacts, run locally or submit to schedulers (LSF/Slurm/PBS/SGE), and triage execution failures. Triggers on requests to run pacsomatic, prepare launch commands/scripts, perform dry-run checks, or troubleshoot pipeline startup and scheduler submission errors.
license: MIT
metadata:
version: "1.2"
skill-author: Beifang Niu
contributors: Haidong, Wenchao
upstream-pipeline: https://github.com/nf-core/pacsomatic
pacsomatic
Overview
This skill provides a reproducible execution workflow for nf-core/pacsomatic, centered on a single helper entrypoint that handles validation, artifact generation, and optional execution.
Primary entrypoint:
scripts/run_pacsomatic.py
The helper script:
- validates required identifiers, files, reference mode, and runtime prerequisites
- writes a pacsomatic-compatible samplesheet (
patient,sample,status,bam,pbi) - generates a params YAML and launch script for reproducible reruns
- supports dry-run validation and run/submit execution paths
Use this skill as the default path for pacsomatic operations. Do not bypass it with manually assembled nextflow run nf-core/pacsomatic commands unless the user explicitly asks for manual command construction.
When to Use This Skill
Invoke this skill when the user asks to:
- run matched tumor-normal analysis from BAM files
- generate or fix pacsomatic samplesheet and launch artifacts
- execute locally or submit to schedulers (LSF/Slurm/PBS/SGE)
- perform dry-run validation before execution
- troubleshoot launch failures or summarize run outputs
Do not use this skill for:
- deep biological interpretation beyond run-level sanity checks
- editing pipeline internals unless explicitly requested
Typical trigger phrases:
- "run nf-core/pacsomatic for this tumor-normal pair"
- "prepare pacsomatic samplesheet and launch script"
- "do a dry run first and tell me what is missing"
- "submit pacsomatic to slurm/lsf and return the job id"
- "why did pacsomatic submission fail"
Routing and Execution Rules
- Always collect required run inputs first.
- Always route through
scripts/run_pacsomatic.pyfor validation and artifact generation. - Default to
--dry-runwhen the user asks for checks/validation only. - Use
--runonly when the user asks to execute/submit. - For scheduler modes, include executor-specific resource arguments and return detected job ID when available.
- If execution fails, report first failure point and next triage target (
.nextflow.log,pipeline_info, failing task logs).
Inputs Required
Required:
- tumor BAM path
- normal BAM path
- patient ID
- tumor sample ID
- normal sample ID
- output directory
- exactly one reference mode:
--fastaor--genome
Optional:
- profile, resources, scheduler account/queue
- pipeline version (
-r) - params file, resume/report/dag flags
--dry-runand/or--run
Workflow
- Validate identity and input constraints.
- Validate required local paths (BAM, optional PBI, optional FASTA).
- Resolve runtime and dependency checks.
- Build samplesheet and generated params YAML.
- Generate launch script for selected executor.
- If
--dry-runand not--run, stop after artifact generation. - If
--run, execute locally or submit to scheduler. - Return command/script path, validation status, and job ID (if detected).
Agent Response Contract
Every response after invocation should include:
- exact command used or generated script path
- confirmation that validation checks ran
- run type (
dry-runvsrun) - scheduler job ID when available
- one concrete next step for validation/triage
Quick Start
Dry run:
python scripts/run_pacsomatic.py \
--tumor-bam /path/to/tumor.bam \
--normal-bam /path/to/normal.bam \
--patient-id P001 \
--tumor-sample-id P001_T \
--normal-sample-id P001_N \
--outdir /path/to/output \
--genome GRCh38 \
--profile singularity,sanger \
--dry-run
Scheduler execution example (Slurm):
python scripts/run_pacsomatic.py \
--tumor-bam /path/to/tumor.bam \
--normal-bam /path/to/normal.bam \
--patient-id P001 \
--tumor-sample-id P001_T \
--normal-sample-id P001_N \
--outdir /path/to/output \
--genome GRCh38 \
--profile singularity,sanger \
--executor slurm \
--queue compute \
--project my_account \
--cpus 16 \
--memory-gb 64 \
--walltime 48:00 \
--run
Configuration
Use config.yaml as the baseline for profile/executor/runtime defaults. Override at invocation time when user requirements differ.
Testing
Run unit tests from skill root:
python -m unittest discover -s tests/pacsomatic -v
References
references/agent-playbook.mdreferences/config-and-output.mdreferences/pacsomatic_guide.mdscripts/run_pacsomatic.py
Other files in this skill
- LICENSE
- config.yaml
- references/agent-playbook.md
- references/config-and-output.md
- references/pacsomatic_guide.md
- scripts/run_pacsomatic.py
references/agent-playbook.md (verbatim)
Agent Playbook
What The User Needs To Provide
Users only need to provide run inputs; they do not need to know pipeline internals:
- tumor BAM path
- normal BAM path
- reference input (
--fastapath or--genomekey) - output directory
Optional:
- sample metadata IDs
- executor/resource preferences
- optional
pbipaths
No repository checkout directory is required for this skill.
Use this sequence when helping a user run nf-core/pacsomatic:
- Collect required inputs.
- tumor BAM
- normal BAM
- patient ID
- tumor sample ID
- normal sample ID
- output directory
- one reference mode:
--fastaor--genome
- Validate naming rules. Patient/sample identifiers cannot contain spaces.
- Validate local input paths.
Local BAMs must exist.
pbiis optional, but if provided the file must exist. - Start with a dry run when uncertain.
Use
--dry-runto validate assumptions and generate artifacts without scheduling. - Launch when requested.
Use
--runwith a selected--executor(local,lsf,slurm,pbs, orsge). - After submission. Report generated samplesheet path, script path, printed run command, and detected job ID if present.
- If pipeline fails later. Inspect launcher logs first, then Nextflow report and DAG outputs.
Recommended helper command:
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /path/to/tumor.bam \
--normal-bam /path/to/normal.bam \
--patient-id P001 \
--tumor-sample-id P001_T \
--normal-sample-id P001_N \
--outdir /path/to/output \
--genome GRCh38 \
--profile singularity,sanger \
--executor local \
--dry-run
Launch command variant:
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /path/to/tumor.bam \
--normal-bam /path/to/normal.bam \
--patient-id P001 \
--tumor-sample-id P001_T \
--normal-sample-id P001_N \
--outdir /path/to/output \
--fasta /path/to/reference.fa \
--profile singularity,sanger \
--executor lsf \
--run
references/config-and-output.md (verbatim)
Config And Output
Required Inputs
--tumor-bam: tumor BAM path--normal-bam: normal BAM path--patient-id--tumor-sample-id--normal-sample-id--outdir- one reference mode:
--fasta, or--genome
Core Optional Controls
--profile: Nextflow profile list (for examplesingularity,sanger)--pipeline-version: release pin for reproducibility--params-file: structured pipeline params--resume: rerun interrupted work--with-report: Nextflow report path--with-dag: Nextflow DAG path
Execution Backend Controls
--executor:local,none,lsf,slurm,pbs, orsge
Direct CLI execution is supported in all modes. When --run is used, the
helper runs backend-native launch commands:
local/none:bash <script>lsf:bsub < <script>slurm:sbatch <script>pbs/sge:qsub <script>
Scheduler Controls (when executor is scheduler-backed)
--project--queue--cpus--memory-gb--walltime--job-name--logdir--stdout-file--stderr-file
Helper Outputs
The helper writes:
- samplesheet CSV (default
<outdir>/samplesheet.csv) - launch script (default
<outdir>/run_pacsomatic.<executor>.sh)
It also prints:
- backend-specific run command (for example
bash,bsub,sbatch, orqsub) - launcher output when
--runis used - detected job ID when parseable from scheduler output
Samplesheet Schema
Expected columns:
patientsamplestatusbampbi
Notes:
bamshould be the full path to the sample BAM.pbiis optional.
Status values:
- tumor:
1 - normal:
0
Run Modes
- generate only (default): write artifacts, no scheduler submission
--dry-run: validate inputs/dependencies and write artifacts--run: execute or submit generated launch script using selected--executor
Official Output Anchors
nf-core/pacsomatic organizes results under grouped directories, including:
alignmentgermline_snvsomatic_snvsomatic_svsomatic_cnvmethylationtumor_clonalitysignature_analysispipeline_infomultiqc
references/pacsomatic_guide.md (verbatim)
Pacsomatic Guide
This guide summarizes the official nf-core/pacsomatic usage and how this skill helps an agent validate, prepare, and launch runs across compute platforms.
What nf-core/pacsomatic runs
nf-core/pacsomatic is a Nextflow pipeline for matched tumor/normal PacBio HiFi somatic analysis.
Typical upstream command from official docs:
nextflow run nf-core/pacsomatic \
-profile <docker/singularity/.../institute> \
--input samplesheet.csv \
--outdir <OUTDIR> \
--genome GRCh38
Important notes from docs:
- Input is a CSV samplesheet with columns:
patient,sample,status,bam[,pbi]. statususes1for tumor and0for normal.- Pipeline parameters should be passed via CLI flags or
-params-file, not-c.
Cross-agent reuse
This skill can be reused by other agents in the same workspace.
- Keep the whole folder
.github/skills/pacsomaticintact when reusing. - Other agents can either:
- call
scripts/run_pacsomatic.pyto generate a backend-aware launch script, or - emit a direct platform-native script and return the matching launcher command.
- call
- If moving to another repository, copy the same folder structure and keep
SKILL.md,references/, andscripts/together. - Validate environment assumptions per cluster (Nextflow module version,
profile such as
singularity,sanger, queue/project names, and network access for remote BAM URLs).
Minimal samplesheet format
patient,sample,status,bam,pbi
ID1,ID1_tumor,1,/path/ID1_tumor.bam,/path/ID1_tumor.bam.pbi
ID1,ID1_normal,0,/path/ID1_normal.bam,/path/ID1_normal.bam.pbi
pbi is optional. If not available, leave it blank.
Platform-aware execution model in this skill
By default, the helper generates artifacts. With --run, it executes/submits
using the selected --executor backend.
It produces:
- A validated samplesheet CSV from tumor/normal BAM inputs
- A standalone launch script that runs Nextflow + nf-core/pacsomatic
- A ready run command (for example
bash,bsub,sbatch,qsub) - Launcher output and detected job ID when
--runis enabled
Example: generate script only
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /data/P1_tumor.bam \
--normal-bam /data/P1_normal.bam \
--patient-id P1 \
--tumor-sample-id P1_tumor \
--normal-sample-id P1_normal \
--fasta /refs/GRCh38.fa \
--outdir /results/p1 \
--profile singularity \
--executor local \
--queue normal \
--cpus 16 \
--memory-gb 64 \
--walltime 48:00
Example: dry-run validation
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /data/P1_tumor.bam \
--normal-bam /data/P1_normal.bam \
--patient-id P1 \
--tumor-sample-id P1_tumor \
--normal-sample-id P1_normal \
--genome GRCh38 \
--outdir /results/p1 \
--profile singularity \
--executor local \
--dry-run
Example: generate and submit immediately
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /data/P1_tumor.bam \
--normal-bam /data/P1_normal.bam \
--patient-id P1 \
--tumor-sample-id P1_tumor \
--normal-sample-id P1_normal \
--genome GRCh38 \
--outdir /results/p1 \
--profile singularity \
--executor lsf \
--run
Example: submit on Slurm
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /data/P1_tumor.bam \
--normal-bam /data/P1_normal.bam \
--patient-id P1 \
--tumor-sample-id P1_tumor \
--normal-sample-id P1_normal \
--genome GRCh38 \
--outdir /results/p1 \
--profile singularity \
--executor slurm \
--queue compute \
--cpus 16 \
--memory-gb 64 \
--run
Direct command-line operation (no agent wrapper)
The helper is a standalone CLI and can be run directly from shell scripts, terminal sessions, CI jobs, or workflow launch wrappers.
Supported HPC schedulers via --executor:
lsf(usesbsub)slurm(usessbatch)pbs(usesqsub)sge(usesqsub)
Local direct execution is also supported with:
--executor local(runs generated script withbash)
Direct LSF script (no Python wrapper)
If users request a ready-to-submit LSF script directly, provide a .lsf.sh
file that can be submitted as-is.
Example file: submit_pacsomatic_hg008.lsf.sh
#!/usr/bin/env bash
#BSUB -J Somatic_singularity
#BSUB -P Somatic_singularity
#BSUB -q heavy_io
#BSUB -n 16
#BSUB -M 64000
#BSUB -W 48:00
#BSUB -o out%J.out
#BSUB -e err%J.err
set -euo pipefail
RUN_DIR="${RUN_DIR:-$PWD/pacsomatic_hg008_run}"
OUTDIR="${OUTDIR:-$RUN_DIR/results}"
WORKDIR="${WORKDIR:-$RUN_DIR/work}"
SAMPLESHEET="$RUN_DIR/samplesheet.csv"
mkdir -p "$RUN_DIR" "$OUTDIR" "$WORKDIR"
cat > "$SAMPLESHEET" << 'CSV'
patient,sample,status,bam,pbi
Patient_HG008,DS_MT_T,1,https://raw.githubusercontent.com/nf-core/test-datasets/pacsomatic/testdata/HG008_Downsample_MT_tumor.bam,
Patient_HG008,DS_MT_N,0,https://raw.githubusercontent.com/nf-core/test-datasets/pacsomatic/testdata/HG008_Downsample_MT_normal.bam,
CSV
module load nextflow/21.10.5
export NXF_WORK="$WORKDIR"
nextflow run nf-core/pacsomatic \
-profile singularity,sanger \
--input "$SAMPLESHEET" \
--outdir "$OUTDIR" \
--genome GRCh38 \
-with-report "$OUTDIR/HiFi_Somatic_Nextflow_Run_Report.html" \
-with-dag "$OUTDIR/HiFi_Somatic_Flowchart.png" \
-resume
Submit with:
bsub < submit_pacsomatic_hg008.lsf.sh
LSF examples aligned with your cluster style
The script supports your style of submission, including -P, queue switching,
module load nextflow/21.10.5, -resume, and report/DAG outputs.
Built-in defaults now match your common combo:
- project:
Somatic_singularity - queue:
heavy_io - module-load:
module load nextflow/21.10.5
Default LSF output naming now follows your style:
- stdout:
out%J.out - stderr:
err%J.err
You can override with --stdout-file and --stderr-file, and optionally set
--logdir to place them under a specific directory.
python .github/skills/pacsomatic/scripts/run_pacsomatic.py \
--tumor-bam /data/P1_tumor.bam \
--normal-bam /data/P1_normal.bam \
--patient-id P1 \
--tumor-sample-id P1_tumor \
--normal-sample-id P1_normal \
--genome GRCh38 \
--outdir /results/p1 \
--project Somatic_test \
--queue heavy_io \
--memory-gb 20 \
--job-name Somatic_test \
--module-load "module load nextflow/21.10.5" \
--with-report HiFi_Somatic_Nextflow_Run_Report.html \
--with-dag HiFi_Somatic_Flowchart.png
For your Sanger configs usage, set combined profiles such as:
--profile singularity,sanger
Reference: https://nf-co.re/configs/sanger/
Best practices
- Ensure BAMs are coordinate-valid and index files are available when possible.
- Use explicit pipeline version with
--pipeline-versionfor reproducibility. - Prefer pinning
--pipeline-versionwhen using fixed test datasets to avoid schema drift across pipeline revisions. - Use
--params-filefor large parameter sets and keep script options minimal. - Prefer containerized profile (
singularityordocker) on HPC. - Set
NXF_OPTSmemory ceiling if Nextflow launcher memory spikes. - nf-core/pacsomatic may require a newer Nextflow than legacy module versions; if the cluster allows, prefer a modern Nextflow release compatible with the pipeline.
Back to K-Dense-AI/scientific-agent-skills (AI Scientist skills) or Agent skills.