Simplify dream contrast handling#11584
Conversation
|
@delfiterradas et al. could you please take that over and make sure the change trickles down into differentialabundance? |
|
pre-commit failure is unrelated (API rate limit) |
Co-authored-by: Delfina Terradas <155591053+delfiterradas@users.noreply.github.com>
pinin4fjords
left a comment
There was a problem hiding this comment.
Backing the direction here from the differentialabundance side: it matches the upstream dream-method.Rd example and removes the double-eBayes flaw. I pulled the branch, applied a tightened version of @delfiterradas's single-coef branch suggestion, and ran the full module nf-test suite under docker against the latest variancePartition container - all 9 tests pass. Inline suggestion below rewrites the contrast block.
The seeded test's dream.results.tsv md5 in tests/main.nf.test.snap shifts under the new single-eBayes flow (numerics still match the existing value assertions in the no-seed tests, so the change is just precision-level reordering). Two occurrences to bump (snapshot file isn't in this PR's diff so I can't suggest it inline):
90a06e6b4945c706025582a4c9fddf2c→865d9c5da7d3749e371231bd2e3727b3
Non-blocking: makeContrastsDream() would be the strictest-correct path but would reject the existing 2 * treatmenthND6 - treatmentmCherry test (weights don't sum to ±1) - worth its own discussion separate from this PR.
Co-authored-by: Jonathan Manning <pininforthefjords@gmail.com>
I was running into an error in the repeated call of eBayes after fit.contrasts.
It turns out that according to the dream vignette the recommended way of setting contrasts it to directly pass it to the
dream()call viaL=.Using
nobars() + design()before calling dream, we can construct the contrast vector beforehand also avoiding the manipulation of matrix dimnames after the dream call.In summary, I think this version is cleaner, more computationally efficient, and solves the specific error I had.
PR checklist
Closes #XXX
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