From 9d898177cff7ad0ff2e235e12eb47ab721565128 Mon Sep 17 00:00:00 2001 From: ch99l Date: Thu, 1 Oct 2026 15:54:13 +0800 Subject: [PATCH] v0.10.3: Visium whitelist demultiplexing, 9T polyT flank and chemistry updates --- CHANGELOG.md | 6 ++++++ README.md | 20 +++++++++---------- assets/10x_config/adapter_seq_config.csv | 2 -- .../10x_config/barcode_coordinate_config.csv | 2 -- assets/10x_config/flank_seq_config.csv | 14 ++++++------- conf/dev.config | 2 +- modules/preprocess_fastq.nf | 16 +++++++-------- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b6d1c..74eb60a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ This file contains all notable changes to Bambu-Pipe. ### Changed - Increased the minimum adapter overlap in the `PREPROCESS_FASTQ` adapter re-search from the cutadapt default (3 bp) to 10 bp, reducing the number of valid reads discarded due to short chance matches at read ends +- Shortened the polyT right flank for 3' and Visium chemistries (`flank_seq_config.csv`) from 30 T to 9 T, matching the flexiplex presets; ONT reads rarely call the full 30 T homopolymer, so few reads matched the flank during barcode discovery +- Visium samples (`visium-v*`) are now demultiplexed directly against the spot whitelist, as recommended by flexiplex; barcode discovery and flexiplex-filter are skipped, replacing the `-u 0` knee detection workaround +- Updated the supported chemistry names in the README to the official 10x Genomics assay names, with a link to the 10x Genomics long-read compatibility article + +### Removed +- `visium-v4` and `visium-v5` (Visium CytAssist Spatial Gene Expression) chemistries, as these probe-based assays do not produce full-length transcripts ### Fixed - Corrected the 10x3v3 and 10x3v4 end adapter (`rev_primer_f`/`rev_primer_r` in `adapter_seq_config.csv`) to `CCCATGTACTCTGCGTTGATACCACTGCTT`, matching 10x3v2 and Visium; the previous sequence does not occur in these reads, so the adapter was rarely trimmed diff --git a/README.md b/README.md index c8bafd1..90a5c53 100644 --- a/README.md +++ b/README.md @@ -97,17 +97,15 @@ sample,path,chemistry,technology *Supported 10x Library Chemistries* -For the following chemistries, the pipeline handles the full workflow — FASTQ preprocessing, genome alignment, and transcript discovery and quantification. Please specify the sample chemistry in the samplesheet as shown: +For the following chemistries, the pipeline handles the full workflow — FASTQ preprocessing, genome alignment, and transcript discovery and quantification. Please specify the sample chemistry in the samplesheet as shown (see 10x Genomics' [long-read compatibility article](https://kb.10xgenomics.com/s/article/10618695456781-Which-10x-Genomics-assays-are-compatible-with-long-read-sequencing-applications)): - `10x3v2` (Single Cell 3' v2) -- `10x3v3` (Single Cell 3' v3 & Next GEM Single Cell 3' v3.1) -- `10x3v4` (GEM-X Single Cell 3' v4) -- `10x5v2` (Single Cell 5' v2) -- `10x5v3` (GEM-X Single Cell 5' v3) -- `visium-v1` (Visium Spatial Gene Expression Slide 6.5 mm; serial prefix V1) -- `visium-v2` (Visium Spatial Gene Expression Slide 6.5 mm; serial prefix V2) -- `visium-v3` (Visium Spatial Gene Expression Slide 6.5 mm; serial prefix V3) -- `visium-v4` (Visium CytAssist Spatial Gene Expression Slide 6.5 mm; serial prefix V4) -- `visium-v5` (Visium CytAssist Spatial Gene Expression Slide 11 mm; serial prefix V5) +- `10x3v3` (Universal 3' Gene Expression – Single Cell 3' v3 & Next GEM 3' v3.1) +- `10x3v4` (Universal 3' Gene Expression – GEM-X 3' v4) +- `10x5v2` (Universal 5' Gene Expression – Next GEM 5' v2) +- `10x5v3` (Universal 5' Gene Expression – GEM-X 5' v3) +- `visium-v1` (Visium Spatial Gene Expression for Fresh Frozen; slide serial prefix V1) +- `visium-v2` (Visium Spatial Gene Expression for Fresh Frozen; slide serial prefix V2) +- `visium-v3` (Visium Spatial Gene Expression for Fresh Frozen; slide serial prefix V3) > **Note:** Visium Spatial Gene Expression samples (`visium-v*`) must be run one at a time and require a Loupe manual alignment file. See the [Visium Spatial Gene Expression](#visium-spatial-gene-expression) section for details. @@ -117,7 +115,7 @@ If your dataset uses a chemistry not listed above, or if you prefer to handle FA *Visium HD* -The pipeline also supports Visium HD samples. See the [Visium HD](#visium-hd) section for more details. +The pipeline also supports Visium HD 3' Spatial Gene Expression samples. See the [Visium HD](#visium-hd) section for more details. **Pipeline Configuration** diff --git a/assets/10x_config/adapter_seq_config.csv b/assets/10x_config/adapter_seq_config.csv index 5fd3525..6d6d9c8 100644 --- a/assets/10x_config/adapter_seq_config.csv +++ b/assets/10x_config/adapter_seq_config.csv @@ -7,5 +7,3 @@ technology,fwd_primer_f,fwd_primer_r,rev_primer_f,rev_primer_r,TSO_f,TSO_r visium-v1,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, visium-v2,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, visium-v3,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, -visium-v4,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, -visium-v5,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, \ No newline at end of file diff --git a/assets/10x_config/barcode_coordinate_config.csv b/assets/10x_config/barcode_coordinate_config.csv index 5c9085a..99616b5 100644 --- a/assets/10x_config/barcode_coordinate_config.csv +++ b/assets/10x_config/barcode_coordinate_config.csv @@ -7,5 +7,3 @@ technology,barcode_path,spatial_coordinate_path visium-v1,visium-v1.txt,visium-v1_coordinates.txt visium-v2,visium-v2.txt,visium-v2_coordinates.txt visium-v3,visium-v3.txt,visium-v3_coordinates.txt -visium-v4,visium-v4.txt,visium-v4_coordinates.txt -visium-v5,visium-v5.txt,visium-v5_coordinates.txt \ No newline at end of file diff --git a/assets/10x_config/flank_seq_config.csv b/assets/10x_config/flank_seq_config.csv index 0b69b18..e81b390 100644 --- a/assets/10x_config/flank_seq_config.csv +++ b/assets/10x_config/flank_seq_config.csv @@ -1,11 +1,9 @@ technology,left_flank,barcode,umi,right_flank -10x3v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -10x3v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -10x3v4,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT +10x3v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTTTTTTT +10x3v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT +10x3v4,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT 10x5v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTCTTATATGGG 10x5v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTCTTATATGGG -visium-v1,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -visium-v2,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -visium-v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -visium-v4,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT -visium-v5,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT \ No newline at end of file +visium-v1,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT +visium-v2,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT +visium-v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT diff --git a/conf/dev.config b/conf/dev.config index ba53fc2..5bbf7eb 100644 --- a/conf/dev.config +++ b/conf/dev.config @@ -1,7 +1,7 @@ // Development parameters — not intended for end users params { bambu_path = null - valid_chemistries = ['10x3v2', '10x3v3', '10x3v4', '10x5v2', '10x5v3', 'visium-v1', 'visium-v2', 'visium-v3', 'visium-v4', 'visium-v5'] + valid_chemistries = ['10x3v2', '10x3v3', '10x3v4', '10x5v2', '10x5v3', 'visium-v1', 'visium-v2', 'visium-v3'] valid_technologies = ['ONT', 'PacBio'] valid_quantification_modes = ['no_quant', 'EM', 'clusteredEM'] save_intermediates = false diff --git a/modules/preprocess_fastq.nf b/modules/preprocess_fastq.nf index 2943718..0220967 100644 --- a/modules/preprocess_fastq.nf +++ b/modules/preprocess_fastq.nf @@ -106,21 +106,21 @@ process PREPROCESS_FASTQ { # Store flexiplex search pattern as an array so the '?' wildcards are not expanded as shell globs flank_seq=(-x "\$left_flank" -b "\$barcode" -u "\$umi" -x "\$right_flank") - # Flexiplex filter (barcode filtering) - # For visium chemistries, search the whole rank curve instead - # (previous runs using the default parameters failed to search the whole rank curve for the inflection point) + # Barcode list for demultiplexing + # For visium chemistries, every whitelisted barcode is a spot on the slide, so demultiplex against the whitelist directly + # For single cell chemistries, discover barcodes, then filter them with the whitelist and inflection point (flexiplex-filter) if [[ $meta.chemistry == visium-v* ]]; then - max_rank_arg="-u 0" + barcode_list=$whitelist else - max_rank_arg="" + flexiplex -p $task.cpus "\${flank_seq[@]}" -f 0 ${sample}_chopper_out.fastq + flexiplex-filter -w $whitelist --outfile my_filtered_barcode_list.txt flexiplex_barcodes_counts.txt + barcode_list=my_filtered_barcode_list.txt fi - flexiplex -p $task.cpus "\${flank_seq[@]}" -f 0 ${sample}_chopper_out.fastq - flexiplex-filter \$max_rank_arg -w $whitelist --outfile my_filtered_barcode_list.txt flexiplex_barcodes_counts.txt # Chain commands: Flexiplex demultiplexing -> (Optional) Save intermediate file after flexiplex -> Cutadapt trimming of reverse primer -> \ # Cutadapt re-search for all primer and TSO sequences to remove non-standard reads -> Reverse complementation of reads for 3' and visium chemistry -> Compression with pigz cat ${sample}_chopper_out.fastq | - flexiplex_demux my_filtered_barcode_list.txt | + flexiplex_demux \$barcode_list | save_intermediate "${sample}_intermediate_flexiplex.fastq.gz" | cutadapt_trim | cutadapt_re_search |