diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0cac1..a5b6d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ This file contains all notable changes to Bambu-Pipe. --- +## [v0.10.3] - 2026-10-01 + +### 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 + +### 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 +- 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 ### Fixed diff --git a/assets/10x_config/adapter_seq_config.csv b/assets/10x_config/adapter_seq_config.csv index 839572c..5fd3525 100644 --- a/assets/10x_config/adapter_seq_config.csv +++ b/assets/10x_config/adapter_seq_config.csv @@ -1,7 +1,7 @@ technology,fwd_primer_f,fwd_primer_r,rev_primer_f,rev_primer_r,TSO_f,TSO_r 10x3v2,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, -10x3v3,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCCTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGGGG,, -10x3v4,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCCTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGGGG,, +10x3v3,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, +10x3v4,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, 10x5v2,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,GTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTAC,TTTCTTATATGGG,CCCATATAAGAAA 10x5v3,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,GTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTAC,TTTCTTATATGGG,CCCATATAAGAAA visium-v1,CTACACGACGCTCTTCCGATCT,AGATCGGAAGAGCGTCGTGTAG,CCCATGTACTCTGCGTTGATACCACTGCTT,AAGCAGTGGTATCAACGCAGAGTACATGGG,, diff --git a/modules/preprocess_fastq.nf b/modules/preprocess_fastq.nf index 9bf4d27..2943718 100644 --- a/modules/preprocess_fastq.nf +++ b/modules/preprocess_fastq.nf @@ -64,7 +64,7 @@ process PREPROCESS_FASTQ { 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 \$flexiplex_f -e $params.flexiplex_e } # Trims reverse primer with cutadapt @@ -72,7 +72,8 @@ process PREPROCESS_FASTQ { cutadapt -a \$rev_primer_f --cores $task.cpus - } - # Re-searches all primer and TSO sequences to remove non-standard reads + # Re-searches all primer and TSO sequences to remove non-standard reads + # (--overlap 10: require >=10 bp of adapter overlap so we do not discard too many reads) cutadapt_re_search() { if [[ $meta.chemistry == 10x5* ]]; then args="-b \$fwd_primer_f -b \$fwd_primer_r -b \$TSO_f -b \$TSO_r -b \$rev_primer_f -b \$rev_primer_r" @@ -80,7 +81,7 @@ process PREPROCESS_FASTQ { args="-b \$fwd_primer_f -b \$fwd_primer_r -b \$rev_primer_f -b \$rev_primer_r" fi - cutadapt \$args --action none --discard --cores $task.cpus - + cutadapt \$args --overlap 10 --action none --discard --cores $task.cpus - } # Reverse complements FASTQ reads to orient them in the transcript direction (for 3' and visium chemistries only) @@ -102,7 +103,8 @@ process PREPROCESS_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) - flank_seq="-x \$left_flank -b \$barcode -u \$umi -x \$right_flank" + # 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 @@ -112,7 +114,7 @@ process PREPROCESS_FASTQ { else max_rank_arg="" fi - flexiplex -p $task.cpus \$flank_seq -f 0 ${sample}_chopper_out.fastq + 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 -> \ diff --git a/nextflow.config b/nextflow.config index 690c916..22b638f 100644 --- a/nextflow.config +++ b/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'Bambu-Pipe' description = 'Context-aware transcript quantification from long-read single-cell and spatial transcriptomics data' author = 'Andre Sim, Chin Hao Lee, Min Hao Ling' - version = 'v0.10.2' + version = 'v0.10.3' mainScript = 'main.nf' nextflowVersion = '!>=26.04.0' }