Skip to content

Running the Pipeline

This guide covers different execution modes for the aa-tRNA-seq pipeline.

Execution Modes

flowchart TB
    subgraph Local
        A[pixi run snakemake<br/>--cores N]
    end
    subgraph Cluster
        B[pixi run snakemake<br/>--profile cluster/lsf]
        C[pixi run snakemake<br/>--profile cluster/generic]
    end
    subgraph Shortcuts
        D[pixi run test]
        E[pixi run test-lsf]
    end

Dry Run

Always start with a dry run to verify the DAG:

Bash
1
pixi run snakemake -n --configfile=config/config.yml

Or use the shortcut:

Bash
1
pixi run dry-run  # Uses config-test.yml

Expected output:

Text Only
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Building DAG of jobs...
Job stats:
job                      count
---------------------  -------
all                          1
merge_pods                   2
rebasecall                   2
bwa_align                    2
classify_charging            2
transfer_bam_tags            2
get_cca_trna                 2
get_cca_trna_cpm             2
...
total                       XX

Local Execution

Basic Execution

Bash
1
pixi run snakemake --cores 12 --configfile=config/config.yml

With Specific Rules

Run only specific rules:

Bash
1
2
3
4
5
# Run up to alignment
pixi run snakemake bwa_align --cores 12 --configfile=config/config.yml

# Run a single sample's outputs
pixi run snakemake results/myproject/bam/final/sample1.bam --cores 12 --configfile=config/config.yml

Resource Limits

Limit resources for local execution:

Bash
1
2
pixi run snakemake --cores 8 --resources mem_mb=32000 gpu=1 \
    --configfile=config/config.yml

Cluster Execution

LSF Clusters

Bash
1
pixi run snakemake --profile cluster/lsf --configfile=config/config.yml

Or use the shortcut:

Bash
1
pixi run test-lsf  # Uses config-test.yml with LSF profile

SLURM/Generic Clusters

Bash
1
pixi run snakemake --profile cluster/generic --configfile=config/config.yml

Submit Script

For long-running jobs, use a submit script:

Bash
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#!/bin/bash
#BSUB -J aa-tRNA-seq
#BSUB -o logs/pipeline.%J.out
#BSUB -e logs/pipeline.%J.err
#BSUB -q rna
#BSUB -n 1
#BSUB -R "rusage[mem=4000]"

pixi run snakemake --profile cluster/lsf \
    --configfile=config/config-myproject.yml

Submit:

Bash
1
bsub < run-myproject.sh

Monitoring Progress

Snakemake Summary

Bash
1
pixi run snakemake --summary --configfile=config/config.yml

Job Status

Bash
1
2
bjobs -u $USER
bjobs -l <job_id>  # Detailed status
Bash
1
2
squeue -u $USER
scontrol show job <job_id>

Log Files

Rule logs are stored in the output directory:

Bash
1
2
3
4
5
# List log files
ls results/myproject/logs/

# View specific rule log
cat results/myproject/logs/rebasecall/sample1.log

Real-Time Progress

Watch Snakemake output:

Bash
1
2
3
4
5
# If running in foreground
# Progress is shown automatically

# If running via submit script
tail -f logs/pipeline.*.out

Rerunning Failed Jobs

Automatic Rerun

Snakemake automatically reruns failed jobs. Just rerun the same command:

Bash
1
pixi run snakemake --profile cluster/lsf --configfile=config/config.yml

Force Rerun

Force rerun of specific rules:

Bash
1
2
3
4
5
6
7
# Rerun a specific rule for all samples
pixi run snakemake --forcerun classify_charging \
    --profile cluster/lsf --configfile=config/config.yml

# Rerun from a specific rule onwards
pixi run snakemake --forcerun classify_charging --forceall \
    --profile cluster/lsf --configfile=config/config.yml

Rerun Single Sample

Bash
1
2
pixi run snakemake results/myproject/bam/final/sample1.bam \
    --forcerun --profile cluster/lsf --configfile=config/config.yml

Advanced Options

Unlock Directory

If a previous run was interrupted:

Bash
1
pixi run snakemake --unlock --configfile=config/config.yml

Keep Going on Errors

Continue running independent jobs if some fail:

Bash
1
2
pixi run snakemake --keep-going --profile cluster/lsf \
    --configfile=config/config.yml

Limit Concurrent Jobs

Bash
1
2
pixi run snakemake --jobs 50 --profile cluster/lsf \
    --configfile=config/config.yml

Report Generation

Generate an HTML report after completion:

Bash
1
pixi run snakemake --report report.html --configfile=config/config.yml

With Demultiplexing

For demultiplexed samples, ensure WarpDemuX is installed (pixi run setup), then run as usual:

Bash
1
2
3
4
5
6
# Dry run
pixi run snakemake -n --configfile=config/config-demux.yml

# Execute
pixi run snakemake --profile cluster/lsf \
    --configfile=config/config-demux.yml

Pixi Task Shortcuts

Command Description
pixi run dry-run Dry run with test config
pixi run test Local execution with test data (4 cores)
pixi run test-lsf LSF execution with test data
pixi run run-preprint Run preprint pipeline
pixi run dag Generate workflow DAG image

Troubleshooting

Pipeline Stuck

If the pipeline appears stuck:

  1. Check cluster job status (bjobs or squeue)
  2. Check for lock files: ls .snakemake/locks/
  3. Unlock if needed: pixi run snakemake --unlock

Out of Memory

Increase memory for specific rules in cluster profile. See Cluster Setup.

GPU Errors

Ensure GPU jobs are submitted to GPU queue. See GPU Configuration.

Next Steps