Repository navigation
Add bwa-mem3 (TAPS and bisulfite/EM-seq) and rastair version 2 - #638
eduard-watchmaker wants to merge 35 commits into
Conversation
- --aligner bwamem3: bwa-mem3 mem --meth=taps against a bwa-mem3 index --meth index (built from --fasta or given with --bwamem3_index), then Picard MarkDuplicates and samtools stats (local subworkflow FASTQ_ALIGN_DEDUP_BWAMEM3; FASTA_INDEX_METHYLSEQ patched for the index). - --taps_caller rastair2: rastair version 2 call (VCF + CpG BED), opt-in via --accept_rastair2_licence because of its non-commercial licence. meta.single_end adds --unpaired; --non_directional adds --guess-read-orientation; --trim_OT/--trim_OB set clipping. - Install bwamem3/index, bwamem3/mem and rastair2/call from nf-core/modules. - Schema, docs, CITATIONS and CHANGELOG. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --bwamem3_index accepts an index prefix (e.g. s3://bucket/hg38.fa) as well as a directory or .tar.gz, and can come from a genome config (`bwamem3` attribute). - MultiQC for --taps_caller rastair2: bcftools stats of the VCF, and a local RASTAIR2_SUMMARY module (bin/rastair2_summary.sh) for genome-wide and per-contig CpG methylation and a methylation distribution. Works with or without spike-ins. - test_taps profile, assets/samplesheet_taps.csv and tests/bwamem3_taps.nf.test (rastair, rastair2, licence check) on TAPS test data pending in nf-core/test-datasets#2370. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without --taps, --aligner bwamem3 aligns with `bwa-mem3 mem --meth` (unmethylated C->T) and MethylDackel extracts methylation, as for bwameth; with --taps it stays in TAPS mode with rastair. Both modes use the same `bwa-mem3 index --meth` index. Adds tests/bwamem3_bisulfite.nf.test. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rence nf-core/test-datasets#2370 now ships rastair's full mm10 chr19 (plus spike-ins) as reference/genome_taps.fa.gz instead of a 41 kb slice, so alignments are at real chr19 coordinates. Methylation and mapping figures are unchanged. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Uses reference/Bwamem3_Index.tar.gz from nf-core/test-datasets (methylseq branch, added in nf-core/test-datasets#2370). Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs/usage.md + schema: build the bwa-mem3 --meth index once for human-sized genomes and pass it with --bwamem3_index (prefix incl. S3, directory or .tar.gz); measured hg38 figures (23 GB peak for BWAMEM3_MEM; the plain .bwt.2bit.64 and .meth.fa aren't needed for alignment). - Warn at launch when --aligner bwamem3 has no --bwamem3_index and the FASTA is over 300 MB. - fasta_index_methylseq: sync the local patch with nf-core/modules#13622 (bwamem/bwamem3 share one branch; supplied tarballs unpack via UNTAR_BWAMEM). - rastair2_summary.sh: per-contig MultiQC columns in natural order (chr1..22, X, Y, M, then spike-ins). - CHANGELOG and test_taps profile description for the new TAPS test data. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Snapshots made on Apple Silicon lack MultiQC's exported plots (MultiQC skips plot export under Rosetta), so regenerate them on x86_64 to match CI. Also picks up the rastair2 per-contig column order and the UNTAR_BWAMEM alias. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Newer version of the nf-core template is available. Your pipeline is using an old version of the nf-core template: 4.2.1. For more documentation on how to update your pipeline, please see the Synchronisation documentation. |
|
The pipeline is on template 4.0.3, whose container_configs lint expects 'container =' entries; tools 4.2.1 had rewritten them as 'conda ='. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Regenerate conf/containers_conda_lock_files_*.config with nf-core tools 4.2.1 (conda = ...) - Apply dev's MultiQC static-plot ignore to the bwamem3 pipeline tests and drop plot entries from their snapshots - Sync ro-crate-metadata.json description with the README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nft-utils 1.2.1 (from the 4.2.1 template) returns removeNextflowVersion() as sorted TreeMaps, so the bwamem3 and bwamem3-index snapshots need the same order. Content unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Regenerate conf/containers_*.config with nf-core tools 4.2.1 (bwameth 0.2.10 + bwamem3/rastair2/bcftools) - README: keep the bwa-mem3 column and take #633's methurator correction for the bwa-mem + TAPS column - Sync ro-crate-metadata.json with the README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Install the nf-core subworkflow fastq_align_dedup_bwamem3 (nf-core/modules#13640) and drop the local copy. bwa-mem3 now writes the alignment BAI itself (bwamem3/mem updated for its index_format input). - Update fasta_index_methylseq to nf-core/modules#13622. The patch now only adds methylseq's methurator input. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verride - Run both TAPS callers through BAM_TAPS_CONVERSION (nf-core/modules#13641, installed from its branch until it is merged). rastair version 2 now estimates trims with rastair2/mbias (#13678), like rastair 0.8 does with mbias + mbiasparser. When they can't be estimated, nothing is trimmed. - --trim_OT/--trim_OB (default unset) replace the estimate for both callers. - --rastair2_mbias_region: region for the rastair2 M-bias estimate, by default the first 10 Mb of the longest contig. - Warn when rastair 0.8 gets single-end samples: it only calls properly paired reads, so they get no methylation calls. - rastair 0.8 modules updated to nf-core master (version topics); the mbiasparser patch is no longer needed. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- bwamem3 TAPS: new test with --trim_OT/--trim_OB 0,0,10,0 (no rastair2 M-bias step; reproduces the previous default BED exactly); the default rastair2 test now checks the M-bias outputs (paired-end only); the rastair 0.8 test checks the single-end warning. - Snapshots regenerated on x86_64 (full suite, 53 tests): the bwa-mem3 BAI now comes from BWAMEM3_MEM (no SAMTOOLS_INDEX_ALIGN), rastair 0.8 reports version "0.8.2" through topics, and rastair2 outputs change with the estimated trims. All other snapshots are unchanged. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he patch nf-core/modules#13643 added the bam_aligned emit upstream, so the local patch is no longer needed. main.nf only gains the licence header; outputs are unchanged. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
Update parabricks/fq2bam and parabricks/fq2bammeth (4.8.0-1), the samtools and Picard modules (1.25, 3.5.0), methyldackel and bwa/mem, and the fastq_align_dedup_bwameth, fastq_align_dedup_bwamem, fastq_align_bwa, bam_sort_stats_samtools, bam_stats_samtools and bam_methyldackel subworkflows to nf-core/modules master. fq2bam now takes known sites with their index. Add a GPU test for --aligner bwamem --taps (parabricks/fq2bam). Snapshots for the CPU tests were regenerated on x86_64; the GPU snapshots were built from AWS Batch GPU runs whose Parabricks 4.6 outputs reproduce the existing GPU snapshot exactly. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ro-crate-metadata.json
Ignore the Parabricks fq2bam BAMs (parabricks/*.bam, *.bai) in snapshots, as for the other alignment BAMs: their headers hold run-specific paths, so the md5 changes between runs. Their reads are still checked through getReadsMD5, which drops leading zeros. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A note that I'll be testing this pull request (on rastair 0.8) on internal datasets over the next couple days, sorry for taking a little while. For sequencing, should this be merged at bwa-mem3 version 0.16.0, or should we push version 0.17.0 up through modules first? |
Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thanks so much, much appreciated! Let me know how it goes and I will be very happy to add any suggestions. I would love to upgrade to bwa mem3 0.17.0 but the builds fail to upload so I can't use these containers yet, I asked @nh13 to re-build/push and I can update this PR as soon as these images are out. Actually they were just pushed but 0.17.0 do not carry any changes for TAPS, I think it's specific for EM/BS data. |
|
@eduard-watchmaker I think the CI runs completed for bioconda for 0.17.0. Let me know if you don't see them |
|
And I'll say, if you see any issues with bwa-mem3, I'd be glad to look into them and fix them! |
|
Thanks so much @nh13 , I actually edited my message when I saw them published. For now the new version 0.17.0 doesnt really change for TAPS, but I will reach out if we need anything. So far, bwamem3 has been a great addition in every single aspect, so kudos to you (and the team involved) on this work! |
Update Parabricks to 4.8.0-1 (with samtools 1.25 and Picard 3.5.0)
FelixKrueger
left a comment
There was a problem hiding this comment.
Main blocker is in the rastair 0.8 path: trims and BAMs reach RASTAIR_CALL unpaired, so samples can be called with each other's trims (inline). Also inline: RRBS dedup, non-directional libraries with bwamem3, .gz index prefixes and the CHANGELOG. Not in the diff: BWAMEM3_INDEX has no process label, so it gets 1 CPU and 4 h from conf/base.config, which won't build a human --meth index. The Parabricks/Picard bump and the nf-amazon fix would be easier to review as separate PRs.
This review was generated with Claude-assisted review and checked by me.
- bam_taps_conversion (local patch): join BAM, BAI and M-bias trims by sample before RASTAIR_MBIAS and RASTAIR_CALL, which took them as separate channels and so paired them by arrival order - --aligner bwamem3 skips deduplication with --rrbs, as bismark and bwameth do - --aligner bwamem3 errors on --pbat and --non_directional: bwa-mem3 --meth seeds read 1 as C->T and read 2 as G->A - --bwamem3_index: only .tar.gz goes to UNTAR, so a genome.fa.gz index prefix works - BWAMEM3_INDEX gets 12 CPUs and 24 h (the module has no resource label) - tests: rastair 0.8 call and methylKit output back in the snapshot, spike-in methylation checks for both callers, and a bwamem3 + --pbat error test - CHANGELOG: one sentence per new entry; --trim_OT/--trim_OB now take effect Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dedness, publishing) - CollectHsMetrics: pass an empty GZI tuple instead of an empty channel, which made the targeted subworkflow's combine() emit nothing - fastq_align_dedup_bwamem (local patch): the CPU path now emits the BAM index and samtools stats, so --skip_deduplication gives TAPS calling its input and MultiQC its samtools sections - bam_taps_conversion (local patch): rastair 0.8 uses the reference as a value channel, as the rastair2 path does - --rrbs skips deduplication for bwamem too; bwamem publish selectors cover the GPU path, and PARABRICKS_FQ2BAM publishes only with --save_align_intermeds - --taps with bismark errors; bwamem3 errors on --zymo/--single_cell as well; bwameth and rastair 0.8 warn that they ignore non-directional options; rastair2 guesses read orientation for all of them - --methyl_kit with targeted sequencing (MethylDackel) errors; warn about options that have no effect in the run - bismark_hisat coverage2cytosine and targeted outputs go under bismark_hisat/ - docs: output.md bwa-mem/bwa-mem3 alignments, usage.md TAPS advice, schema help for --ignore_3prime_r1/r2; index_downloads uses the HISAT2 index Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use the American spelling, as rastair's own `rastair license` subcommand does, in the parameter name and the pipeline's text (review by heuermh). The nf-core meta.yml `licence` key is left as the schema requires. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the plugin declared so S3 paths (the iGenomes default) resolve, without the 2.15.0 pin. This matches #642 line for line, which carries the CHANGELOG entry, so the two merge cleanly in either order. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… publishing - targeted sequencing: CollectHsMetrics now runs (coverage metrics and the MultiQC HsMetrics tables) - bwamem (CPU): samtools stats reach MultiQC - index_downloads: the HISAT2 scenario uses the pre-built index, so no genome preparation - bwamem TAPS GPU: no raw Parabricks BAMs in parabricks/ and no stray indexes in deduplicated/ (checked against a stub run with -profile gpu) Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ore lint nf-core lint fails any plugin without a pinned version (nextflow_config: "Plugin 'nf-amazon' does not have a pinned version"), and pinning a newer release would break other Nextflow versions and Seqera Platform. Like the nf-core template, declare no nf-amazon: Nextflow loads the matching release for S3 paths, as the AWS Batch validation runs with Nextflow 25.10.4 showed. Generated by Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I’d suggest updating to 0.17.0 before merging: TAPS scoring is unchanged, but it includes performance and memory improvements. BS/EM-seq tests need revalidation because the default scoring changed to |
|
@nh13 thanks, agreed. I've opened nf-core/modules#13715 to bump For bisulfite and EM-seq, methylseq will use the new
🤖 Addressed by Claude Code |
This PR adds bwa-mem3 as a methylation-aware aligner for both TAPS and bisulfite/EM-seq data, and rastair version 2 as an optional TAPS caller. Both TAPS callers now estimate read-end trims from each sample's M-bias by default.
What's new
--aligner bwamem3. bwa-mem3 aligns directional libraries against a conversion-aware index (bwa-mem3 index --meth);--pbat,--non_directional,--zymoand--single_cellstop with an error. The data type picks the mode:--taps: TAPS mode (mem --meth=taps), then rastair calls methylation (--taps_caller).--taps: bisulfite/EM-seq mode (mem --meth), then MethylDackel extracts methylation, as with--aligner bwameth.Both modes use the same index. Alignment is followed by Picard MarkDuplicates and samtools stats/flagstat/idxstats.
--bwamem3_index. Pass a pre-built index as a directory, a.tar.gzor an index prefix (S3 works). Otherwise it's built from--fasta(keep it with--save_reference).docs/usage.mdexplains building it once for human-sized genomes, and the pipeline warns at launch when it would build one from a FASTA over 300 MB. iGenomes has no bwa-mem3 index; hosting one is proposed in Add bwa-mem3 index generation (plain and methylation--meth) references#171.--taps_caller rastair2. rastair version 2 replaces the rastair 0.8 steps (rastair 0.8 stays the default). It jointly calls SNVs, indels and CpG methylation, writing a bgzipped VCF and a CpG BED. Single-end samples get--unpaired.--accept_rastair2_licenseand prints the license notice.M-bias read-end trims by default, for both callers.
rastair mbias+rastair/mbiasparser, as before.rastair2 mbiason--rastair2_mbias_region(default: the first 10 Mb of the longest contig; a methylated spike-in such as lambda is better, and needed for shallow libraries).--trim_OT/--trim_OB(now unset by default; previously0,0,10,0for rastair version 2 only) replace the estimate for both callers.rastair 0.8 single-end warning. rastair 0.8 only calls properly paired reads, so single-end samples get no calls with
--taps_caller rastair. The pipeline warns at the start of the TAPS step and the docs point to rastair version 2.-profile test_taps. Mouse TAPS reads from the TAPS paper (GEO GSE112520, via rastair's test data) against mm10 chr19 plus methylated and unmodified spike-ins (methylseq: add bwa-mem3 --meth index and TAPS test data test-datasets#2370).New tests.
tests/bwamem3_taps.nf.test: rastair 0.8 (with the single-end warning), rastair version 2 with M-bias trims, rastair version 2 with--trim_OT/--trim_OB, and the licence-not-accepted error.tests/bwamem3_bisulfite.nf.test: default,skip_deduplication,save_reference+save_align_intermeds.tests/index_downloads.nf.test.Fixes picked up along the way
nf-amazonwithout the2.15.0pin that came with the template sync (Important! Template update for nf-core/tools v4.2.1 #634), exactly as Drop version pin on nf-amazon plugin #642 does (which carries the CHANGELOG entry). That release doesn't work with Nextflow 25.10 (NoSuchMethodErroronSession.getExecConfigProp), so every run reading S3 paths or using AWS Batch failed at startup, ondevtoo.bwameth/alignno longer writes into the shared staged index (bwameth/align: stop writing the fasta link into the shared staged index (race, read-only index) modules#13642). This replaces the local patch from Update bwameth to 0.2.10 #637 with the same code.bam_alignedfrom fastq_align_dedup_bismark: emit raw aligned BAM (bam_aligned) modules#13643).Fixes from review and a pipeline-wide audit
After @FelixKrueger's review I audited the whole pipeline (channel pairing, every parameter against every aligner, and a stub run of about 480 parameter combinations). Fixed here:
bam_taps_conversionpaired BAMs, BAIs and M-bias trims by arrival order, so a sample could be called with another sample's trims. They are now joined by sample (local patch; the upstream fix has a two-sample test that fails on every run without it).--collecthsmetricsnever ran CollectHsMetrics (an empty GZI channel emptied the input); it does now.--aligner bwamemwithout GPU emitted no BAM index or samtools stats, so--skip_deduplicationleft TAPS calling without input (local patch offastq_align_dedup_bwamemuntil the upstream fix merges).--rrbsnow skips deduplication for bwamem and bwamem3 too, as for bismark and bwameth.--tapswith bismark stops with an error instead of producing no calls;--methyl_kitwith targeted sequencing (MethylDackel) errors, since it removes the bedGraphs the targeted step reads.--pbat/--non_directional/--zymo/--single_cell; rastair version 2 guesses read orientation for all of them.--collecthsmetricswithout targeted sequencing,--bamqc_regions_filewithout Qualimap,--slamseqoutside Bismark or with--bismark_index).bismark_hisatcoverage2cytosine and targeted outputs go underbismark_hisat/; GPU bwamem no longer publishes raw Parabricks BAMs toparabricks/or stray indexes todeduplicated/.--bwamem3_index genome.fa.gzprefixes work (only.tar.gzis untarred);BWAMEM3_INDEXgets 12 CPUs and 24 h; the--ignore_3prime_r1/r2help texts were swapped; the HISAT2 index test never used a pre-built index;--trim_OT/--trim_OBnow take effect for rastair 0.8, so old params files that set them change results.Most of these were already on
dev; they are fixed here so they land together.nf-core components
Everything is installed from nf-core/modules master, with no local subworkflows or branch installs:
fastq_align_dedup_bwamem3andbwamem3/memindex_format(bwamem3/mem: index_format (BAI) input; new subworkflow fastq_align_dedup_bwamem3 modules#13640)fasta_index_methylseqwith bwamem3 (fasta_index_methylseq: add bwamem3 aligner modules#13622; the local patch only keeps the methurator input, as before)bam_taps_conversionwithuse_rastair2and atrimsinput (bam_taps_conversion: optional rastair version 2 caller (use_rastair2) modules#13641)rastair2/calland the newrastair2/mbias(rastair2/mbias: new module; rastair2/call: take M-bias cutoffs modules#13678)fastq_align_dedup_bismarkbam_aligned(fastq_align_dedup_bismark: emit raw aligned BAM (bam_aligned) modules#13643) andbwameth/align(bwameth/align: stop writing the fasta link into the shared staged index (race, read-only index) modules#13642)nf-core/modules#13699 (drop the plain
.bwt.2bit.64from--methindexes) isn't needed here. With--bwamem3_index <prefix>the pipeline already stages only the files alignment reads.Testing
nf-test: all 54 tests pass (everything except GPU) on native x86_64 with Docker and Nextflow 25.10.4. The bwa-mem3 snapshots were generated on x86_64. On Apple Silicon, MultiQC skips plot export under Rosetta, so snapshots made there lack
multiqc_plots.nf-core pipelines lint: 480 passed, 0 failed.Human TAPS data on AWS Batch: two in-house NA12878 TAPS libraries (1 ng and 200 ng input, 250k read pairs each) on hg38 + lambda + an unmodified 2 kb control, with the bwa-mem3 index given as an S3 prefix. Pooled CpG methylation:
2,1,5,0/2,2,5,0; OB2,1,11,0/2,1,4,0--rastair2_mbias_region J02459.1)2,0,5,0/2,0,6,0; OB4,0,4,00,0,10,0(previous default)BWAMEM3_MEMpeaked at 23 GB of RAM.PR checklist
nf-core pipelines lint).nextflow run . -profile test,docker --outdir <OUTDIR>).nextflow run . -profile debug,test,docker --outdir <OUTDIR>).docs/usage.mdis updated.docs/output.mdis updated.CHANGELOG.mdis updated.README.mdis updated (including new tool citations and authors/contributors).Generated by Claude Code
🤖 Generated with Claude Code