Documentation
Complete reference for the sRNA-TAPS pipeline — installation, configuration, pipeline steps, benchmarking hooks, and output formats.
Start with conda, pip, or source installation, then move directly into project configuration and quick-start execution.
Each stage is documented in order, from genome setup and alignment through calling, background correction, and reporting.
Expected files, delta-score logic, SNP filtering, and test-dataset checkpoints stay close for practical troubleshooting.
Installation
From source
git clone https://github.com/HenzelerB/sRNA-TAPS
cd sRNA-TAPS
git checkout v1.0.0
python -m pip install -e .
From PyPI
python -m pip install sRNA-TAPS
The PyPI package 1.0.0 is the same code as the v1.0.0 tag. Pipeline tools such as Bowtie and samtools are installed separately, for example with the full environment below.
Full environment
conda env create -f environment.yaml
conda activate sRNA-TAPS
R packages
The conda environment already contains R and every package the report figures need, so each cluster node uses the same R. Only when you run the reports with an R outside conda, install the packages into your personal library:
Rscript install_R_packages.R
Quick Start
sRNA-TAPS runs as a Snakemake 9 profile-based workflow. All SLURM resource allocation is handled by the profile — no cluster submission strings or job scripts to manage.
# 1. Create a project with a complete config.yaml and a samples.tsv template
srnataps init --outdir ~/my_project --species human --fastq-dir /path/to/fastq
cd ~/my_project
# 2. Set the paths marked <REQUIRED> in config.yaml and list your samples in samples.tsv
# 3. Dry-run to verify the DAG
snakemake \
--snakefile /path/to/sRNA-TAPS/srnataps/workflow/Snakefile \
--configfile config.yaml \
--profile /path/to/sRNA-TAPS/srnataps/workflow/profiles/slurm \
--dry-run
# 4. Run the full pipeline
bash /path/to/sRNA-TAPS/sRNA_taps.bash
# — or directly in the background —
snakemake \
--snakefile /path/to/sRNA-TAPS/srnataps/workflow/Snakefile \
--configfile config.yaml \
--profile /path/to/sRNA-TAPS/srnataps/workflow/profiles/slurm &
# 5. Run with benchmarking (optional)
snakemake \
--snakefile /path/to/sRNA-TAPS/srnataps/workflow/Snakefile \
--configfile config.yaml \
--profile /path/to/sRNA-TAPS/srnataps/workflow/profiles/slurm \
all_benchmark
genome_fa or gtf are left blank, sRNA-TAPS derives the matching Ensembl files for the configured reference.species and builds the Bowtie1 index automatically. No pre-built index is needed for new users.Configuration
Project directory structure
my_project/
├── config.yaml # pipeline configuration
├── samples.tsv # sample sheet
└── rawfiles/ # input FASTQs (*.fq.gz)
config.yaml
Create the project with srnataps init. It writes a complete config.yaml containing every required section. Set the paths marked <REQUIRED> and keep the other defaults unless you have a reason to change them.
srnataps init --outdir my_project --species human --fastq-dir /data/fastq
The settings most often changed are:
reference:
species: human # run "srnataps species" to list supported values
ensembl_release: 112
dbsnp_vcf: "" # optional, leave empty to skip the dbSNP layer
condition_analysis:
test_min_coverage: 5
minimum_replicates: 3
minimum_delta: 0.10
replicate_test: "bayesian" # bayesian, beta_binomial, or mannwhitney
primary_control: "no_treat" # PB stays a background measurement
minimum_posterior_probability: 0.95
stringent_max_padj: 1.0e-20
reference.species and leave genome_fa, gtf, and bowtie1_index empty to use the Ensembl-backed registry. If you already have a matching FASTA and GTF, explicit paths override the automatic download.List supported species and assemblies with srnataps species:
| Configuration name | Species | Assembly |
|---|---|---|
human | Homo sapiens | GRCh38 |
mouse | Mus musculus | GRCm39 |
rat | Rattus norvegicus | mRatBN7.2 |
zebrafish | Danio rerio | GRCz11 |
fruit_fly | Drosophila melanogaster | BDGP6.46 |
c_elegans | Caenorhabditis elegans | WBcel235 |
chicken | Gallus gallus | bGalGal1.mat.broiler.GRCg7b |
genome_fa and gtf paths directly in config.yaml.samples.tsv
Tab-separated, one row per sample. Four columns are required:
| Column | Description |
|---|---|
sample | Unique sample identifier — used for all output filenames |
condition | One of the three conditions. Common labels are recognised, such as treat, pb_Ctrl, no-treat and no_treat, and a label that cannot be recognised stops the run |
cell_line | Cell line or biological source — any name; used to group SNP blacklists and colour palettes |
fastq | Full path to the input .fq.gz file (single-end) |
Example with two cell lines, three conditions, three replicates each:
sample condition cell_line fastq
no-treat_Ctrl_HEK_R1 no-treat HEK /data/rawfiles/no-treat_Ctrl_HEK_R1.fq.gz
no-treat_Ctrl_HEK_R2 no-treat HEK /data/rawfiles/no-treat_Ctrl_HEK_R2.fq.gz
no-treat_Ctrl_HEK_R3 no-treat HEK /data/rawfiles/no-treat_Ctrl_HEK_R3.fq.gz
pb_Ctrl_HEK_R1 pb_Ctrl HEK /data/rawfiles/pb_Ctrl_HEK_R1.fq.gz
pb_Ctrl_HEK_R2 pb_Ctrl HEK /data/rawfiles/pb_Ctrl_HEK_R2.fq.gz
pb_Ctrl_HEK_R3 pb_Ctrl HEK /data/rawfiles/pb_Ctrl_HEK_R3.fq.gz
treat_HEK_R1 treat HEK /data/rawfiles/treat_HEK_R1.fq.gz
treat_HEK_R2 treat HEK /data/rawfiles/treat_HEK_R2.fq.gz
treat_HEK_R3 treat HEK /data/rawfiles/treat_HEK_R3.fq.gz
no-treat_Ctrl_Caco2_R1 no-treat Caco2 /data/rawfiles/no-treat_Ctrl_Caco2_R1.fq.gz
... ... ... ...
Requirements
| Tool | Version | Purpose |
|---|---|---|
| Python | ≥ 3.10 (tested on 3.11) | Core pipeline |
| Snakemake | ≥ 9.0 | Workflow management |
| snakemake-executor-plugin-slurm | ≥ 2.7 | SLURM profile submission |
| bowtie | 1.3.1 | TAPS-aware alignment |
| samtools | ≥ 1.20 | BAM processing |
| bedtools | any | Site annotation |
| bcftools | ≥ 1.20 | Variant calling |
| fastqc | ≥ 0.12 | Quality control |
| trim-galore | ≥ 0.6.10 | Adapter trimming |
| multiqc | ≥ 1.21 | QC aggregation |
| wget | any | Reference auto-download |
| R | ≥ 4.3 | Report figures (automatic) |
| Rsamtools + GenomicRanges | any | Sequence logos |
| bismark | ≥ 0.24 | Benchmarking only |
| rastair | ≥ 2.1 | Benchmarking only |
| asTair | ≥ 3.3 | Benchmarking only (separate conda env) |
numpy<2 and click<8). Install it in a dedicated conda environment — the pipeline calls it via its full binary path automatically. See the Tutorial for setup instructions.Pipeline Overview
rawfiles/ Raw FASTQs (SE, TruSeq small RNA)
↓
[Genome setup — runs once per selected reference]
download_genome_fa Download Ensembl FASTA for configured species
download_gtf Download matching Ensembl GTF
index_genome_fa samtools faidx
bowtie1_index Build Bowtie1 index
↓
01. FastQC (pre-trim) QC on raw reads
02. Trim Galore TruSeq SR adapter trimming (--small_rna)
03. FastQC (post-trim) QC on trimmed reads
04. Three-letter Bowtie1 C-to-T/G-to-A alignment; original sequences restored
05. Biotype split miRNA > tRNA > piRNA > snoRNA > snRNA > rRNA > lncRNA > other
06. SNP filter 3-layer: cell-line + heterozygosity [+ dbSNP]
07. TAPS calling Strand-aware C/T counting and per-sample binomial screen
07a. Sample-profile QC UMAP/PCA of per-sample modification profiles
07b. Pool conditions Pool counts within condition and cell line
07c. Control contrast Pooled Fisher tests against PB-only and no-treatment
07d. Replicate calls Bayesian replicate model gated on no-treatment
07e. Stringent calls Configurable q-value, effect, and depth tier
↓
[Reports — generated automatically after each stage]
report_qc Read length distribution, mapping rates
report_biotype Biotype composition
report_modification Modification rates, top sites, condition comparison,
waterfall, trinucleotide context
report_seqlogos Sequence logos (±5 and ±10 nt, per biotype)
multiqc Aggregated QC HTML report
↓
[Benchmarking — opt-in: snakemake ... all_benchmark]
08. Benchmark* rastair · asTair · Bismark
09. Compare* Concordance · Pearson/Spearman correlation
report_benchmark Concordance heatmap, correlation, site overlap
* requires all_benchmark target
Stage 07a: Sample-profile QC
Stage 07a uses the raw, per-sample calls from stage 07 to inspect sample-level modification profiles before pooling and statistical filtering. It provides an early QC view of experimental structure, local neighbours, and unusual replicates.
The default three-condition UMAP uses the Aurora condition palette: PB- TET-, PB+ TET-, and PB+ TET+. Cell line is shown by point shape. DBSCAN membership, outliers, neighbours, and statistical tests are saved as tables instead of being printed on the figure.
For the direct PB+ TET- versus PB+ TET+ comparison, the pipeline also provides PCA with explained-variance axes. PCA is deterministic and is the preferred presentation for this focused two-group comparison. A four-of-six replicate centroid-proximity sensitivity analysis is available for QC only; it does not replace the prespecified six-replicate analysis.
Genome Setup
Tools: wget, samtools faidx, bowtie-build
c_elegans, and chicken. Human still defaults to GRCh38, but any supported species can be selected through reference.species.If the genome FASTA or GTF do not exist at the paths in config.yaml, the pipeline derives them from reference.species and downloads the matching Ensembl release automatically. The Ensembl release is set by ensembl_release in config (default: 112). The unmasked dna.toplevel FASTA is always used — the repeat-masked version soft-masks cytosines, which would suppress genuine C→T TAPS modification signal.
If your genome files already exist on disk, all download and indexing steps are skipped. The Bowtie1 index is built once from the FASTA and reused for all samples.
genome_fa, gtf, and bowtie1_index in config.yaml to your existing files. Snakemake will skip download automatically.Step 1 — Quality Control
Tool: FastQC, MultiQC
FastQC runs on raw FASTQs before trimming and on trimmed FASTQs after. MultiQC aggregates all results — FastQC, Trim Galore reports, and Bowtie1 alignment logs — into a single interactive HTML report at report/multiqc_report.html. For small RNA libraries, expect a dominant length peak at 18–22 nt (miRNA) and a second peak at 26–32 nt (tRNA fragments and piRNAs). All reads will contain adapter sequence since small RNA inserts are shorter than the read length.
Step 2 — Adapter Trimming
Tool: Trim Galore (Cutadapt)
Trim Galore removes the TruSeq small RNA 3′ adapter (TGGAATTCTCGGGTGCCAAGG) and quality-trims the 3′ end. Reads shorter than 18 nt are discarded. The --small_rna flag sets sensible defaults for this library type.
Step 3 — TAPS-aware Alignment
Tool: Bowtie 1.3.1, SAMtools
Alignment is to the whole reference genome rather than a transcriptome — tRNA families (~600 gene copies), piRNA clusters, and snoRNA loci need genomic coordinates for correct downstream annotation. Three-letter alignment neutralises TAPS conversions during mapping:
| Parameter | Purpose |
|---|---|
| C-to-T and G-to-A branches | Converted reads align to converted references for each genomic strand |
| Branch selection | The alignment with the fewest mismatches is retained for each read |
| Single-locus assignment | Each read is reported at one locus (-k 1), so reads from repetitive or paralogous loci go to one representative locus |
| Sequence restoration | Original bases and qualities are restored before modification calling |
Step 4 — Biotype Annotation
Tool: Custom Python script (pysam), Ensembl GTF for the configured species
Reads are assigned to the highest-priority overlapping biotype using the Ensembl GTF, and separate sorted BAMs are written per biotype per sample:
miRNA > tRNA > piRNA > snoRNA > snRNA > rRNA > lncRNA > other
A biotype composition summary (05.biotype_bams/*_biotype_summary.txt) is written alongside each BAM for downstream QC figures.
Step 5 — SNP Filtering
Tool: bcftools, custom Python
A C/T heterozygous SNP produces exactly the same signal as a TAPS m5C site. Filtering occurs in three layers before any C→T counts are made:
| Layer | Method | Flag |
|---|---|---|
| 1 | dbSNP common C→T/G→A variants (AF ≥ 1%) — optional, set dbsnp_vcf in config | SNP_KNOWN |
| 2 | Cell-line-specific C→T variants called from merged no-treat BAMs | SNP_SAMPLE |
| 3 | No-treat C→T rate ≥ 40% (heterozygosity proxy) | SNP_HET |
Only positions with snp_flag == PASS proceed to statistical testing. The snp_flag column is retained in every output TSV for full traceability.
Step 6 — TAPS Methylation Calling
Tool: Custom Python caller (pysam, multiprocessing)
For each cytosine position with sufficient coverage:
mod_rate = T_count / (C_count + T_count)
| Feature | Implementation |
|---|---|
| Strand-specific logic | Forward strand: modified C reads as T. Reverse strand: modified C reads as A. |
| CIGAR-aware parsing | get_aligned_pairs() handles indels and soft-clipping without positional offsets |
| Base quality filter | Bases with Phred Q < 20 are excluded |
| Parallel processing | Jobs distributed across chromosomes |
| Per-sample screening | Binomial test against a fixed background rate of 0.005, BH FDR correction. This result is retained for reference and does not gate later stages |
Output columns: chrom, start, end, strand, context, mod_count, unmod_count, coverage, mod_rate, pvalue, padj, snp_flag
Step 7 — Condition Testing
Tool: Custom Python
Pooled contrast. Counts are pooled within each condition. For sites with coverage of at least 5 in treatment and both controls, treatment is compared with each control using a one-sided Fisher's exact test with BH correction. This tier does not gate the replicate model.
Replicate model. With at least 3 replicates per condition, each rate has the posterior Beta(1 + total modified, 1 + total unmodified). A site is called against the untreated control when the posterior probability of a difference of at least 0.10 is at least 0.95, and the median-of-replicates difference is also at least 0.10. The same difference against pb_Ctrl quantifies PB-associated background and is not a pass/fail gate.
Step 8 — Genomic Annotation
Tool: bedtools intersect, Ensembl GTF for the configured species
Called sites are intersected with the Ensembl annotation to assign gene name, biotype, and feature. miRNA gene names follow miRBase nomenclature. Where a site overlaps multiple features, the most specific annotation is kept using the priority hierarchy from Step 4.
Step 9 — Report Generation
Tools: R (ggplot2, ggseqlogo, Rsamtools), MultiQC
Report figures are generated automatically as part of the pipeline — no manual steps needed. Each report stage runs immediately after its upstream data are ready, so QC figures appear while alignment is still running for the remaining samples.
| Rule | Script | Figures |
|---|---|---|
report_qc | 01_qc.R | Read length distributions, Bowtie1 mapping rates |
report_biotype | 02_biotype.R | Biotype composition per sample; mean by condition |
report_modification | 03_modification.R | Modification rate distributions, top sites, condition comparison scatter, waterfall, trinucleotide context |
report_seqlogos | 05_sequence_logos.R | Sequence logos ±5 and ±10 nt per biotype (requires BSgenome) |
report_benchmark | 04_benchmark.R | Concordance heatmap, Pearson correlation, site overlap (all_benchmark only) |
multiqc | MultiQC 1.21 | Aggregated FastQC + Trim Galore + Bowtie1 HTML report |
All figures are saved in PDF, PNG, and SVG at 300 dpi (Arial 8pt, sRNA-TAPS navy-to-teal palette). The R scripts read condition and cell line metadata directly from samples.tsv and adapt colour palettes, axis labels, and condition comparisons to any experimental design — not just HEK/Caco2.
SRNATAPS_CONDITION_LABELS="treat=TET + PB,pb_Ctrl=PB,no-treat=Ctrl" before running to override display names in figures.Benchmarking
The optional benchmark suite compares sRNA-TAPS calls against three established tools: rastair (Bowtie1 BAMs, CpG-only and all-context modes), asTair (biotype-split BAMs, all contexts), and Bismark (bisulfite contrast, chemistry inverted for comparison).
# Run benchmark + core pipeline in one command
snakemake \
--snakefile /path/to/sRNA-TAPS/srnataps/workflow/Snakefile \
--configfile config.yaml \
--profile /path/to/sRNA-TAPS/srnataps/workflow/profiles/slurm \
all_benchmark
This target includes everything in rule all plus rastair, asTair, Bismark, the comparison step, and the benchmark report figures. The benchmark is intentionally opt-in — Bismark genome preparation and asTair on large biotypes are slow and not needed for routine analysis.
astair_env) due to dependency conflicts with Snakemake. The pipeline calls it via its full binary path — no manual activation needed. See the Tutorial for setup.See the Benchmarking page for full results and interpretation, including the key finding that rastair produces identical output in CpG-only and all-context modes (confirming it is a CpG-only caller by design).
The Delta (δ) Score
δ_ct = median(treat rates) − median(no-treat rates) significance gate
δ_pb = median(treat rates) − median(pb_Ctrl rates) background-corrected level
A site at 70% in treat and 30% in pb_Ctrl is gated for significance against the untreated control and reported at a corrected level of about 40%.
| δ value | Interpretation |
|---|---|
| < 0.10 | Below the calling threshold |
| 0.10–0.20 | Low-level modification |
| 0.20–0.40 | Moderate modification |
| 0.40–0.70 | High modification |
| > 0.70 | Very high modification |
SNP Filtering
| Layer | Method | Flag |
|---|---|---|
| 1 | dbSNP common C→T/G→A variants (AF ≥ 1%) — optional | SNP_KNOWN |
| 2 | Cell-line SNPs from no-treat BAMs | SNP_SAMPLE |
| 3 | No-treat C→T rate ≥ 40% | SNP_HET |
Filtering happens upstream of the binomial test — SNP-flagged positions are excluded entirely. The snp_flag column in every output TSV records the reason for exclusion. Only PASS sites are tested.
Output Files
The reference bundle in 04a.genome/ reflects the configured species and Ensembl release for the run.
outdir/
├── 02.fastqc/
│ ├── pre_trim/ FastQC HTML + data per sample (raw)
│ └── post_trim/ FastQC HTML + data per sample (trimmed)
├── 03.trimGalore/ Trimmed FASTQs + trimming reports
├── 04a.genome/ Selected reference FASTA + GTF + Bowtie1 index
│ (auto-downloaded if not present)
├── 04b.aligned/ Sorted BAMs per sample + flagstat logs
├── 05.biotype_bams/ Per-biotype BAMs + *_biotype_summary.txt per sample
├── 06.snp_resources/ SNP blacklists per cell line (*.bed)
├── 07.taps_calls/ Per-biotype TAPS TSVs
│ (chrom, start, end, context, mod_count, unmod_count,
│ coverage, mod_rate, pvalue, padj, snp_flag)
├── 07a.umap/ Sample-profile QC figures and tables
│ ├── 01_umap_clusters.{png,pdf}
│ ├── umap_coordinates.tsv · dbscan_membership.tsv
│ ├── condition_statistics.tsv · pairwise_statistics.tsv
│ └── pb_tet_comparison/ · pb_tet_pca/
├── 08.benchmark/
│ ├── rastair/cpg/ rastair CpG-only calls per sample
│ ├── rastair/all/ rastair all-context calls (identical to cpg)
│ ├── astair/ asTair all-context calls per biotype per sample
│ └── bismark/ Bismark bisulfite calls per sample
├── 09.compare/
│ ├── concordance_summary.tsv
│ └── correlation_summary.tsv
└── report/
├── multiqc_report.html Aggregated QC (FastQC + Trim Galore + Bowtie1)
└── figures/
├── 01a_read_length_distribution.{pdf,png,svg}
├── 01b_mapping_rates.{pdf,png,svg}
├── 02_biotype_composition.{pdf,png,svg}
├── 03_global_modrate_distribution.{pdf,png,svg}
├── 04a_modrate_distribution.{pdf,png,svg}
├── 04c_condition_comparison.{pdf,png,svg}
├── 04d_waterfall.{pdf,png,svg}
├── 04e_trinucleotide_context.{pdf,png,svg}
├── 04k_top10_sites_heatmap.{pdf,png,svg}
├── 04b, 04f to 04j (when the data allow them)
├── 05a to 05e (benchmark only)
├── 06a_sequence_context_all.{pdf,png,svg}
├── 06c_sequence_context_enrichment.{pdf,png,svg}
└── 07_mirna_modification_atlas.{pdf,png,svg}
Test Dataset
The repository includes a synthetic FASTQ simulator (tests/simulate_taps_srna.py) that generates small RNA reads with TAPS chemistry from real GRCh38 miRNA, mitochondrial tRNA, rRNA and snoRNA fragments (tests/test_data/sim_templates.tsv). Known m5C sites convert at 60 to 90% in treat, against 5 to 10% in pb_Ctrl and 1 to 3% in no-treat. Each fragment contributes only reads that the three-letter alignment places back at their own locus, so every seeded site can be recovered. The same --seed gives identical files.
The test dataset uses 100 samples to stress-test the full pipeline at scale:
python3 tests/simulate_taps_srna.py \
--outdir ~/srnataps_sim \
--reads 1000000 \
--seed 42
This writes 100 .fastq.gz files, a samples.tsv and truth_sites.tsv, the seeded sites in genomic coordinates.
# Run the test pipeline
srnataps init --outdir ~/srnataps_test --species human --fastq-dir ~/srnataps_sim
cp ~/srnataps_sim/samples.tsv ~/srnataps_test/samples.tsv
cd ~/srnataps_test
snakemake \
--snakefile /path/to/sRNA-TAPS/srnataps/workflow/Snakefile \
--configfile config.yaml \
--profile /path/to/sRNA-TAPS/srnataps/workflow/profiles/slurm
Expected Results
Compare the calls with the seeded sites:
python3 tests/check_simulation_recovery.py \
--truth ~/srnataps_sim/truth_sites.tsv \
--project ~/srnataps_test
Seeded sites should show pooled rates near 60 to 90% in treat, 5 to 10% in pb_Ctrl and 1 to 3% in no-treat, and most should be in the replicate tier (07d.replicate_calls/).