Fix meta_fb never defined in CELLRANGER_MULTI (#9798)#9803
Fix meta_fb never defined in CELLRANGER_MULTI (#9798)#9803
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where an undefined variable meta_fb was referenced in the CELLRANGER_MULTI module, replacing it with the correct variable fb_options.
Changes:
- Fixed undefined variable reference by changing
meta_fb.optionstofb_options.optionson lines 126-127
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fb_options_r1_length = fb_options_use && fb_options.options.containsKey("r1-length") ? "r1-length,${fb_options.options["r1-length"]}" : '' | ||
| fb_options_r2_length = fb_options_use && fb_options.options.containsKey("r2-length") ? "r2-length,${fb_options.options["r2-length"]}" : '' |
There was a problem hiding this comment.
While this PR correctly fixes the immediate issue (undefined variable meta_fb), there appears to be a related bug on line 95 (outside the scope of this PR) that prevents fb_options_use from ever being truthy.
On line 95, fb_options is assigned the value of meta_ab.options or meta_crispr.options (the options map itself), but on line 105, the code checks fb_options?.options, which would be looking for a nested options property. Since fb_options is a map (e.g., ["r1-length": "26"]), not a meta object, fb_options?.options will always be null, making fb_options_use null, and these lines 126-127 will never execute.
Line 95 should likely be: fb_options = meta_ab?.options ? meta_ab : (meta_crispr?.options ? meta_crispr : [:]) to assign the entire meta object rather than just the options map. This would make it consistent with how meta_vdj and meta_gex are used in lines 123-124 and 107-117 respectively.
This issue should be addressed in a follow-up PR to make the feature barcode options functional.
| fb_options_r1_length = fb_options_use && fb_options.options.containsKey("r1-length") ? "r1-length,${fb_options.options["r1-length"]}" : '' | |
| fb_options_r2_length = fb_options_use && fb_options.options.containsKey("r2-length") ? "r2-length,${fb_options.options["r2-length"]}" : '' | |
| // Normalize feature-barcode options: support both meta objects (with `.options`) and raw option maps | |
| def fb_options_map = fb_options?.options ?: fb_options ?: [:] | |
| fb_options_r1_length = fb_options_use && fb_options_map.containsKey("r1-length") ? "r1-length,${fb_options_map["r1-length"]}" : '' | |
| fb_options_r2_length = fb_options_use && fb_options_map.containsKey("r2-length") ? "r2-length,${fb_options_map["r2-length"]}" : '' |
tgelafr-pfzr
left a comment
There was a problem hiding this comment.
Ditto to what copilot said, but more fundamentally we need a new test for this use case, the two bugs reveal a lack of coverage.
Yeah. I saw that and I am working on it. |
|
Please keep this PR open as it is not done. Currently, the logic in this module is not contained but highly dependent on the local align_cellrangermulti subworkflow in scrnaseq pipeline. Some logic needs to be re-written. |
PR checklist
Closes #9798
topic: versions- See version_topicslabelnf-core modules test <MODULE> --profile dockernf-core modules test <MODULE> --profile singularitynf-core modules test <MODULE> --profile condanf-core subworkflows test <SUBWORKFLOW> --profile dockernf-core subworkflows test <SUBWORKFLOW> --profile singularitynf-core subworkflows test <SUBWORKFLOW> --profile conda