Usage¶
Pixi tasks¶
Pixi wraps the Snakemake invocations used on the bundled integration test as named
tasks, so you don't have to remember the flags. They all run on .tests/integration/;
for your own data call Snakemake directly (see below).
lint, dry-run, test and test-report take two optional positional arguments:
<config>: a config stem under.tests/integration/configs/:remote-references,local-referencesoradaptive-trim.<profile>: a test profile under.tests/integration/profiles/:laptop,hpcorci(see Test profiles).
Defaults: remote-references laptop for lint and dry-run, local-references laptop
for test and test-report. Extra Snakemake options go after --, e.g.
pixi run -e dev test local-references laptop -- --cores 4.
| Task | Command | What it does |
|---|---|---|
| setup | pixi run -e dev setup |
Runs git lfs install && git lfs pull (git-lfs comes with the dev environment) to fetch the test data |
| lint | pixi run lint <config> <profile> |
Runs snakemake --lint (code-quality checks on the workflow) with a test config |
| dry-run | pixi run dry-run <config> <profile> |
Shows jobs that would run without executing them |
| test | pixi run -e dev test <config> <profile> |
Runs setup, then the pipeline on the integration test data |
| test-report | pixi run -e dev test-report <config> <profile> |
Runs test (a no-op if results are up to date), then writes the Snakemake report to .tests/integration/report.zip |
Examples¶
# Lint the workflow code (developers)
pixi run lint local-references laptop
# See the job plan without running anything
pixi run dry-run local-references laptop
# Run the integration test on a laptop
pixi run -e dev test local-references laptop
# Run using remote references (downloads mm10 from Refgenie)
pixi run -e dev test remote-references laptop
Direct Snakemake invocation¶
For production runs or custom flags, call Snakemake directly through Pixi. The examples
below use profile/slurm, your copy of profile/slurm-example; use profile/default to
run locally (see Advanced Profiles). config/my_config.yaml
stands for your own config file; config/examples/ has templates to start from.
Override a single config value without editing the file:
pixi run snakemake \
--profile profile/slurm \
--configfile config/my_config.yaml \
--config globals:results_folder="results/rerun_v2"
Results layout¶
Everything is written below globals.results_folder; the sub-folders are fixed and
cannot be configured. <comparison> is the name of an entry under comparisons,
<sample> the name column of its sample sheet.
<results_folder>/
├── qc/
│ ├── fastqc-raw/<comparison>/ FastQC on raw reads
│ ├── fastqc-trimmed/<comparison>/ FastQC on trimmed reads
│ ├── fastqc-markdup/<comparison>/ FastQC on deduplicated alignments
│ ├── star/<comparison>/ FastQC on STAR alignments
│ └── multiqc/<comparison>/multiqc_report.html
├── trim/
│ ├── _shared/<hash>/ trimmed reads, shared between comparisons
│ └── <comparison>/ links to _shared/, trimming stats
├── alignments/
│ ├── star/
│ │ ├── _shared/<hash>/ single-copy gene alignments
│ │ └── <comparison>/ BAM, BAI, bigWig, ReadsPerGene, STAR logs
│ ├── star_markdup/
│ │ ├── _shared/<hash>/
│ │ └── <comparison>/ duplicate-marked BAM and stats
│ └── starTE/
│ ├── _shared/<hash>/{random,multihit}/
│ └── <comparison>/
│ ├── random/ multihit/ TE alignments
│ ├── filter/ TE-only BAMs
│ ├── featureCount/ TE counts (random, multihit)
│ ├── DESeq2/ TE differential expression (lfc.csv, dds_random.rds)
│ └── random/datavzrd/ interactive TE results report
├── salmonTE/
│ ├── quant/<comparison>/ SalmonTE quantification
│ └── de_analysis/<comparison>/ SalmonTE differential expression
├── tRNA_coverage/<comparison>/ tRNA coverage, counts, DESeq2 results, datavzrd report
├── analysis/
│ ├── tables/deseq2/<comparison>/ gene DESeq2 results (results.csv, results.shrink.csv)
│ ├── rdata/deseq2/<comparison>/ DESeq2 object (dds.rds)
│ ├── rdata/deseq2/ann.rds gene annotation used by DESeq2 (from the GTF)
│ ├── datavzrd/<comparison>/ interactive gene results report
│ └── pictures/ notebooks/ created at start-up, currently left empty
├── references/
│ ├── <label>/ processed FASTA and GTF
│ ├── STAR/ STAR index
│ ├── rmsk/ RepeatMasker annotation
│ ├── gtrnadb/ GtRNAdb tRNA annotation
│ └── refgenie/ Refgenie genome config
├── log/<YYYY-MM-DD>/<tool>/ job logs, one folder per run date
└── tmp/ scratch space for STAR
salmonTE/, alignments/starTE/ and tRNA_coverage/ are only created when the
corresponding analysis is enabled (see disable_*_analysis in the
configuration reference). The _shared/ folders are
explained in Deduplication.
Generating a report¶
pixi run snakemake \
--report report.zip \
--profile profile/slurm \
--configfile config/my_config.yaml
Unzip report.zip and open report.html; see
Running & Reporting for what it contains.
Use the same profile and configfile as the run that produced the results, otherwise
Snakemake cannot match outputs to rules for the provenance data.
The integration test shortcut, which writes .tests/integration/report.zip:
Troubleshooting¶
Config validation fails¶
WorkflowError:
Invalid config file:
comparisons[0] (comparison 'lung'): missing 'protocol'. Set 'protocol: pe' (paired-end, sample sheet columns filename_1/filename_2) or 'protocol: se' (single-end, column filename). 1.x inferred it from the sample sheet; 2.0 does not.
globals.qc_folder: Output folders are now derived from 'globals.results_folder'; remove this key.
See the 2.0 migration guide: docs/migration/ (https://github.com/boulardlab/3t-seq/tree/main/docs/migration)
Every schema problem is listed, one per line, with the path of the offending key. Keys
removed since 1.x get a hint on what replaces them; any other unknown key lists the keys
allowed at that place. Re-check after editing with a dry-run
(pixi run snakemake --profile profile/default --configfile config/my_config.yaml -n);
pixi run lint does not read your config. Common causes:
- Missing required key (
globals.results_folder,genome.label, orcomparisons). - A comparison entry missing
name,sample_sheetorprotocol. - No
deseq2.reference_levelfor a comparison (neither in the comparison nor indefaults.deseq2). bamCoveragewith--normalizeUsing RPGCbut no--effectiveGenomeSize, on a genome other thanmm10/mm39.fasta_pathprovided withoutgtf_path(or vice versa), or withoutannotation_type.genome.labelother thanmm10/mm39withoutfasta_pathandgtf_path.- A 1.x key still present (e.g.
globals.reads_folder,globals.qc_folder). See Migrating from 1.x.
Sample sheet files not found¶
WorkflowError:
Sample sheet validation failed:
Sample sheet missing: /path/to/samples.csv
Sample sheet /path/to/lung.csv lacks column(s) filename_1, filename_2 required by 'protocol: pe' of comparison 'lung' in the config file.
Serie 'liver' / Sample 'WT_1': Could not resolve filename ('reads/wt_1')
All sample sheets are checked when the workflow starts, and every problem is reported in one error. Each line is one of:
Sample sheet missing: …: thesample_sheetpath does not exist.Sample sheet … lacks column(s) …: the columns do not matchprotocol(peneedsfilename_1andfilename_2,seneedsfilename; both needname).Serie '…' / Sample '…': Could not resolve …: the FASTQ file was not found, with or without the extensions.fastq.gz,.fq.gz,.fastq,.fq.
To fix them:
- Relative paths in the sample sheet are resolved relative to
--directory(the working directory passed to Snakemake), not relative to the config file or sample sheet location. - Confirm the FASTQ files actually exist at those paths on disk.
STAR runs out of memory¶
The STAR rules request 32 GB for the genome index plus 4 GB per GB of compressed FASTQ
input (at least 5 GB), so at least 37 GB per alignment job. On a cluster these values are
passed to Slurm. Locally they are only enforced if you pass --resources mem_mb=...;
otherwise STAR fails when the machine runs out of memory.
- For full genomes, run on a cluster with a Slurm profile based on
profile/slurm-example. - For local testing, use
selected_chromosomes: [chr19]in thegenomesection to restrict to a single chromosome.
Pipeline appears stuck¶
Check the log files: every rule writes to <results_folder>/log/<YYYY-MM-DD>/, dated by
the day the run started. On a cluster you can also inspect the Slurm queue:
Snakemake's --rerun-incomplete flag re-runs any jobs that terminated abnormally:
pixi run snakemake \
--profile profile/slurm \
--configfile config/my_config.yaml \
--rerun-incomplete
Deprecation warning about sequencing_libraries¶
If you see:
CONFIG DEPRECATION: 'sequencing_libraries' has been renamed to 'comparisons'. Please update your config file; 'sequencing_libraries' will be removed in a future release. See the migration guide: docs/migration/ (https://github.com/boulardlab/3t-seq/tree/main/docs/migration)
Open your config file and rename the top-level key from sequencing_libraries to
comparisons. The old key still works but will be removed in a future release. Other
1.x keys need changes too; see Migrating from 1.x.
A config with both keys is rejected: