Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ 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
- Shortened the polyT right flank for 3' and Visium chemistries (`flexiplex_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
- flexiplex flank (`-f`) and barcode (`-e`) edit distances are now set per chemistry in `flexiplex_config.csv` (`flank_max_edit_distance`, `barcode_max_edit_distance`), using the flexiplex preset defaults (`-f 8`, `-e 2`); this replaces the `flexiplex_f_5prime`, `flexiplex_f_3prime` and `flexiplex_e` developer parameters. The previous `-f 13` for 3' and Visium chemistries allowed too many errors for the shortened 9 T flank, causing spurious flank matches that slowed `PREPROCESS_FASTQ` considerably
- Moved the 10x config files out of `assets/10x_config/` into `assets/`, and renamed `adapter_seq_config.csv` to `cutadapt_config.csv` and `flank_seq_config.csv` to `flexiplex_config.csv`

### 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
- Corrected the 10x3v3 and 10x3v4 end adapter (`rev_primer_f`/`rev_primer_r` in `cutadapt_config.csv`) to `CCCATGTACTCTGCGTTGATACCACTGCTT`, matching 10x3v2 and Visium; the previous sequence does not occur in these reads, so the adapter was rarely trimmed
- Resolved an edge case where `PREPROCESS_FASTQ` failed if the input FASTQ filename had the same length as the barcode (16) or UMI (10/12) pattern; the unquoted `?` wildcards in the flexiplex pattern were expanded by the shell to match the filename, which was not intended

## [v0.10.2] - 2026-09-23
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
technology,left_flank,barcode,umi,right_flank
10x3v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTTTTTTT
10x3v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT
10x3v4,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT
10x5v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTCTTATATGGG
10x5v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTCTTATATGGG
visium-v1,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT
visium-v2,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT
visium-v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT
technology,left_flank,barcode,umi,right_flank,flank_max_edit_distance,barcode_max_edit_distance
10x3v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTTTTTTT,8,2
10x3v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT,8,2
10x3v4,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT,8,2
10x5v2,CTACACGACGCTCTTCCGATCT,????????????????,??????????,TTTCTTATATGGG,8,2
10x5v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTCTTATATGGG,8,2
visium-v1,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT,8,2
visium-v2,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT,8,2
visium-v3,CTACACGACGCTCTTCCGATCT,????????????????,????????????,TTTTTTTTT,8,2
3 changes: 0 additions & 3 deletions conf/dev.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ params {
valid_quantification_modes = ['no_quant', 'EM', 'clusteredEM']
save_intermediates = false
qfilter_threshold = 10
flexiplex_f_5prime = 8
flexiplex_f_3prime = 13
flexiplex_e = 1
process_by_chromosome = true
seurat_dim_single = 15
seurat_dim_multi = 30
Expand Down
8 changes: 4 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ workflow STANDARD {
def ndrArg = ndr != null ? ndr : 'NULL'

// load config files
ch_barcode_coordinate_config = file("${projectDir}/assets/10x_config/barcode_coordinate_config.csv", checkIfExists: true)
ch_adapter_seq_config = file("${projectDir}/assets/10x_config/adapter_seq_config.csv", checkIfExists: true)
ch_flank_seq_config = file("${projectDir}/assets/10x_config/flank_seq_config.csv", checkIfExists: true)
ch_barcode_coordinate_config = file("${projectDir}/assets/barcode_coordinate_config.csv", checkIfExists: true)
ch_cutadapt_config = file("${projectDir}/assets/cutadapt_config.csv", checkIfExists: true)
ch_flexiplex_config = file("${projectDir}/assets/flexiplex_config.csv", checkIfExists: true)

ch_n_samples = ch_rows.count()

Expand All @@ -79,7 +79,7 @@ workflow STANDARD {

// process fastq samples
ch_preprocess_fastq_in = ch_input_fastq.map { sample, path, meta -> [sample, path, meta, meta.barcode] } // add whitelist path to fastq input tuple
PREPROCESS_FASTQ(ch_preprocess_fastq_in, ch_flank_seq_config, ch_adapter_seq_config)
PREPROCESS_FASTQ(ch_preprocess_fastq_in, ch_flexiplex_config, ch_cutadapt_config)
ALIGNMENT(PREPROCESS_FASTQ.out.fastq, ch_genome, ch_annotation)

if (!params.bam_only) {
Expand Down
18 changes: 6 additions & 12 deletions modules/preprocess_fastq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ process PREPROCESS_FASTQ {

input:
tuple val(sample), path(fastq), val(meta), path(whitelist)
path(flank_seq_config)
path(adapter_seq_config)
path(flexiplex_config)
path(cutadapt_config)

output:
tuple val(sample), path("${sample}_preprocessed_reads.fastq.gz"), val(meta), emit: fastq
Expand Down Expand Up @@ -55,16 +55,10 @@ process PREPROCESS_FASTQ {
}

# Demultiplexing with flexiplex
# Arguments: 1=barcode list file generated by flexiplex-filter
# Arguments: 1=barcode list file (flexiplex-filter output, or the whitelist for visium chemistries)
flexiplex_demux() {
local barcode_list=\$1
if [[ $meta.chemistry == 10x5* ]]; then
flexiplex_f=$params.flexiplex_f_5prime
else
flexiplex_f=$params.flexiplex_f_3prime
fi

flexiplex -p $task.cpus -k \$barcode_list "\${flank_seq[@]}" -f \$flexiplex_f -e $params.flexiplex_e
flexiplex -p $task.cpus -k \$barcode_list "\${flank_seq[@]}" -f \$flank_max_edit_distance -e \$barcode_max_edit_distance
}

# Trims reverse primer with cutadapt
Expand Down Expand Up @@ -101,8 +95,8 @@ process PREPROCESS_FASTQ {
decompress | chopper_cmd | save_intermediate "${sample}_intermediate_qfilter.fastq.gz" > ${sample}_chopper_out.fastq

# Extract chemistry specfic parameters from config files
IFS=',' read -r _ left_flank barcode umi right_flank < <(awk -F',' -v chem=$meta.chemistry '\$1 == chem' $flank_seq_config)
IFS=',' read -r _ fwd_primer_f fwd_primer_r rev_primer_f rev_primer_r TSO_f TSO_r < <(awk -F',' -v chem=$meta.chemistry '\$1 == chem' $adapter_seq_config)
IFS=',' read -r _ left_flank barcode umi right_flank flank_max_edit_distance barcode_max_edit_distance < <(awk -F',' -v chem=$meta.chemistry '\$1 == chem' $flexiplex_config)
IFS=',' read -r _ fwd_primer_f fwd_primer_r rev_primer_f rev_primer_r TSO_f TSO_r < <(awk -F',' -v chem=$meta.chemistry '\$1 == chem' $cutadapt_config)
# 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")

Expand Down
Loading