Skip to content

Fix meta_fb never defined in CELLRANGER_MULTI (#9798)#9803

Draft
SZhengP wants to merge 2 commits intomasterfrom
bug/9798-meta-fb-not-defined-CELLRANGER-MULTI
Draft

Fix meta_fb never defined in CELLRANGER_MULTI (#9798)#9803
SZhengP wants to merge 2 commits intomasterfrom
bug/9798-meta-fb-not-defined-CELLRANGER-MULTI

Conversation

@SZhengP
Copy link
Contributor

@SZhengP SZhengP commented Jan 29, 2026

PR checklist

Closes #9798

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR.
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity
      • nf-core modules test <MODULE> --profile conda
    • For subworkflows:
      • nf-core subworkflows test <SUBWORKFLOW> --profile docker
      • nf-core subworkflows test <SUBWORKFLOW> --profile singularity
      • nf-core subworkflows test <SUBWORKFLOW> --profile conda

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.options to fb_options.options on lines 126-127

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +126 to +127
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"]}" : ''
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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"]}" : ''

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@tgelafr-pfzr tgelafr-pfzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SZhengP
Copy link
Contributor Author

SZhengP commented Jan 29, 2026

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.

@SZhengP
Copy link
Contributor Author

SZhengP commented Jan 29, 2026

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.

@mashehu mashehu marked this pull request as draft January 29, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] meta_fb never defined in CELLRANGER_MULTI

2 participants