Single cell wrapper and removal of barcodesToFilter, sampleName, cleanReads#561
Single cell wrapper and removal of barcodesToFilter, sampleName, cleanReads#561ch99l merged 11 commits intodevel_pre_v4from
Conversation
…anReads/sampleNames/barcodesToFilter, drop CSV input for demultiplexed and clusters
|
[UPDATED] Transcript Comparison Report (comparing SummarisedExperimentObject from devel_pre_v4 and sc_spatial_wrapper) |
There was a problem hiding this comment.
Pull request overview
This PR refactors bambu’s single-cell/multiplexed interface by removing deprecated parameters, renaming the barcode/UMI extraction flag, and adding a single-cell wrapper intended to group single-cell options.
Changes:
- Removed deprecated arguments (
barcodesToFilter,sampleNames,cleanReads) and renameddemultiplexed→extractBarcodeUMIacross the pipeline. - Simplified barcode/UMI extraction in BAM preprocessing to only support CB/UB tags or
CB_UMI#READNAMEparsing. - Added
bambu.singlecell()wrapper and exported it viaNAMESPACE.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| R/bambu.R | Updates bambu() signature/logic for extractBarcodeUMI, simplifies clusters handling, and adds exported bambu.singlecell() wrapper. |
| R/bambu-processReads.R | Propagates renamed/simplified single-cell parameters through read processing and removes deprecated inputs. |
| R/prepareDataFromBam.R | Removes barcode-map-file and cleanReads logic; retains CB/UB/read-name parsing under extractBarcodeUMI. |
| R/bambu_utilityFunctions.R | Updates parallel parameter selection and colData generation to use extractBarcodeUMI; removes sampleNames input checks. |
| R/bambu-assignDist.R | Renames function parameter and call site to extractBarcodeUMI. |
| R/bambu-extendAnnotations-utilityExtend.R | Removes CSV fallback for clusters and updates barcode matching logic. |
| R/readWrite.R | Comment update from demultiplexed to extractBarcodeUMI. |
| NAMESPACE | Exports the new bambu.singlecell() entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code reviewFound 1 issue:
bambu/R/bambu-extendAnnotations-utilityExtend.R Lines 893 to 897 in 7f55cae Related barcode prefixing at: Lines 70 to 72 in 7f55cae 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Code review (below default threshold)The following issues scored between 25-75 out of 100 confidence — below the default reporting threshold of 80. Included here for completeness. Score 75:
Lines 276 to 278 in 7f55cae
Lines 332 to 335 in 7f55cae
Lines 71 to 74 in 7f55cae
Lines 338 to 357 in 7f55cae Score 25:
bambu/R/bambu_utilityFunctions.R Lines 8 to 10 in 7f55cae
Lines 56 to 58 in 7f55cae 🤖 Generated with Claude Code |
f259cdd to
d26f253
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
R/prepareDataFromBam.R:76
dedupUMI=TRUEcurrently does not requireextractBarcodeUMI=TRUE, but the dedup logic implicitly depends onCB/UMIbeing present; withextractBarcodeUMI=FALSEit will silently skip (or behave unpredictably). Add an explicit validation (or automatically enableextractBarcodeUMI) whendedupUMIis requested.
if(dedupUMI){
#UMI deduplication by barcode
start.ptm <- proc.time()
numUMIs <- length(na.omit(unique(mcols(readGrgList)$UMI))) # remove NA UMIs
if(numUMIs > 100){
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jonathangoeke
left a comment
There was a problem hiding this comment.
- simplify input to bambu.singlecell
- add more description in code
- update documentation to remove incorrect parts
- add draft issue regarding documentation updates
- writeBambuOutput function: is that section necessary?
…wrapper, include single cell .bam example, update writeBambuOutput
jonathangoeke
left a comment
There was a problem hiding this comment.
minor comment to change order of code in bambu()
jonathangoeke
left a comment
There was a problem hiding this comment.
please test again after all changes
There was a problem hiding this comment.
I have reviewed the code manually, and have tested on single cell data, for both one sample and multiple samples. I can not get the result from the pacBio demo data, but I think that is related to the demo data it self, all of the read classes were filtered out from this sample. I will update the demo data later. One small thing is that maybe we can message the changes in writeBambuOutput, like "We don't support .... anymore" to users.
The code changes look good to me, I approve it.
Related Issue
Fixes # 570
Type of Change
Description
Summary of Changes
a. Group related single-cell parameters (dedupUMI, clusters, extractBarcodeUMI) into a opt.singlecell list argument
Implementation Details
NAMESPACE
R/bambu.R
bambu() signature: Removed demultiplexed, sampleNames, cleanReads, barcodesToFilter; added extractBarcodeUMI = FALSE.
mode = "multiplexed": Now sets extractBarcodeUMI <- TRUE (previously set demultiplexed <- TRUE + cleanReads <- TRUE).
checkInputs() call: sampleNames argument removed.
setBiocParallelParameters() and bambu.processReads() calls: Receive extractBarcodeUMI instead of demultiplexed; sampleNames, cleanReads,
barcodesToFilter removed from the latter.
assignReadClasstoTranscripts() call (quant loop): demultiplexed → extractBarcodeUMI.
New function bambu.singlecell(): Added as a wrapper around bambu() that unpacks opt.singlecell (extracting extractBarcodeUMI, dedupUMI,
clusters) and passes all other args through.
R/bambu-assignDist.R
demultiplexed → extractBarcodeUMI in the assignReadClasstoTranscripts() signature and its generateColData() call.
R/bambu-extendAnnotations-utilityExtend.R
No functional changes — only trailing whitespace removed.
R/bambu-processReads.R
bambu.processReads(): Removed demultiplexed, cleanReads, sampleNames, barcodesToFilter; added extractBarcodeUMI = FALSE. Removed
sampleNames-based renaming of reads. Non-barcode CB assignment changed from sampleNames[i] to names(reads)[i]. All !isFALSE(demultiplexed)
checks replaced with extractBarcodeUMI.
bambu.processReadsByFile(): Same parameter simplification; barcodesToFilter filtering step removed; demultiplexed → extractBarcodeUMI
throughout.
bambu.readsByFile(): Same parameter simplification; barcodesToFilter filtering step removed; demultiplexed → extractBarcodeUMI throughout.
R/bambu_utilityFunctions.R
setBiocParallelParameters(): demultiplexed → extractBarcodeUMI; condition simplified from isFALSE(demultiplexed) to !extractBarcodeUMI.
checkInputs(): sampleNames parameter and its length-mismatch validation removed.
generateColData(): demultiplexed → extractBarcodeUMI throughout (signature, doc comment, and all conditionals).
R/prepareDataFromBam.R
cleanReads parameter removed entirely. File-path-based barcode mapping (where demultiplexed could be a CSV path) removed. The demultiplexed
= TRUE vs path branching collapsed — extractBarcodeUMI = TRUE is now the only mode, always parsing CB/UB tags or CB_UMI#READNAME read names.
Entire cleanReads logic removed (soft/hard clip calculation and primary alignment selection by minimum 5' clip). cells and umi variables
removed. demultiplexed → extractBarcodeUMI in remaining checks.
R/readWrite.R
Comment-only update: demultiplexed → extractBarcodeUMI in an inline comment.
Impact of Changes
The implemented changes do not affect the results (only deprecated arguments are removed)
Checklist
Note: Documentation to be updated later