Skip to content

feat: add literal string to make contrasts in variancepartition/dream #8231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 16, 2025

Conversation

atrigila
Copy link
Contributor

@atrigila atrigila commented Apr 7, 2025

POC of nf-core/differentialabundance#386

Current implementation is:

  • If comparison is provided, then it is passed as a literal string to limma::makeContrasts.
  • Otherwise, the previous design remains.
  • The comparison is only used in inputs.contrasts_for_diff_with_formula, which is the input to VARIANCEPARTITION_DREAM in ABUNDANCE_DIFFERENTIAL_FILTER for now.

@grst , when you have a chance, could you take a look and let me know if this implementation makes sense? If anything needs updating, I’m happy to make the changes.

PR checklist

Closes #XXX

  • 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.
  • Emit the versions.yml file.
  • 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

@atrigila atrigila requested a review from grst April 7, 2025 18:47
Copy link
Member

@grst grst left a comment

Choose a reason for hiding this comment

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

Few, minor things

@atrigila atrigila marked this pull request as ready for review April 15, 2025 12:52
@atrigila atrigila requested a review from pinin4fjords as a code owner April 15, 2025 12:52
Copy link
Member

@pinin4fjords pinin4fjords left a comment

Choose a reason for hiding this comment

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

Making optional things mandatory in module and subworkflow inputs complicates workflow logic. Suggest this new thing goes via ext.args, passed from meta at the workflow level.

This is how blocking variables are handled in deseq2, for example.

Edit: this is more complex than I'd considered- see discussion below. I think this will be OK after resolution of minor points.

@@ -8,7 +8,7 @@ process VARIANCEPARTITION_DREAM {
'community.wave.seqera.io/library/bioconductor-edger_bioconductor-variancepartition_r-optparse:ba778938d72f30c5' }"

input:
tuple val(meta), val(contrast_variable), val(reference), val(target), val(formula)
tuple val(meta), val(contrast_variable), val(reference), val(target), val(formula), val(comparison)
Copy link
Member

Choose a reason for hiding this comment

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

Convention in nf-core is for non-mandatory non-file things to go in via ext.args. Otherwise people end up having to supply '[]' or '' or other messy things.

Copy link
Member

Choose a reason for hiding this comment

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

Doing that would also mean you don't need to change the workflow logic, you can pass it from the meta when it's available.

Copy link
Member

Choose a reason for hiding this comment

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

Perspectively, wouldn't that also mean that contrast_variable, reference, and target should go to ext.args? Technically they are not needed when a formula and contrast string are provided. See also nf-core/differentialabundance#451

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I suppose that's true. But it might be simpler to leave those in place for now and resolve separately. I'm mostly concerned with not adding additional subworkflow complexity for this.

Copy link
Member

Choose a reason for hiding this comment

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

@atrigila @grst I chatted with the maintainers, and the consensus was that in a situation where e.g. A + B OR C + D were required, a sensible thing might be to have two separate input channels. But this is not the case here, since these can be somewhat overlapping (right)?

Let's keep your version for now, I hadn't considered this point of Gregor.

Copy link
Member

Choose a reason for hiding this comment

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

In a future version they'll be mutually exclusive. But sounds good to keep it as is for the current iteration.

Copy link
Member

@pinin4fjords pinin4fjords left a comment

Choose a reason for hiding this comment

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

I think we may end up adjusting this stuff to more cleanly handle the different ways of specifying contrasts. But I think it's OK to run with this for now and see how you go

@atrigila atrigila added this pull request to the merge queue Apr 16, 2025
Merged via the queue into nf-core:master with commit a74e1f9 Apr 16, 2025
61 checks passed
@atrigila atrigila deleted the makecontrast_dream branch April 16, 2025 12:37
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.

3 participants