Add configurable DESeq2 design formula - #20
Open
rmillikin wants to merge 1 commit into
Open
Conversation
DESeq2 was hard-coded to `~ condition`, so within-subject (paired) designs and batch-corrected designs weren't expressible. The design formula is now set in the config YAML via `design_formula` and defaults to `~ condition`, so existing configs are unaffected. Validation happens twice: the Snakefile checks the formula against the design CSV header when the workflow is parsed, so a formula naming a column that doesn't exist (e.g. `~ subject + condition` with no `subject` column) fails before any step runs rather than hours later; deseq2.R repeats the check so the script is safe to run standalone. The formula must also include `condition`, since contrasts are tested on its coefficients. Every variable in the formula is coerced to a factor, so a numeric subject or batch ID is read as a group label rather than a continuous covariate, and a blank value or a single-level variable is reported by name instead of surfacing as a rank-deficient model matrix. The formula is a restricted character set (variable names and R formula operators only), which also keeps it safe to interpolate into the rules' shell commands. Also threads the formula into the generated methods paragraph, which previously claimed a `~condition` design unconditionally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VcESmVRNhqwhuw8psAzvkr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESeq2 was hard-coded to
~ condition. The design formula is now set in the config YAML viadesign_formulaand defaults to~ condition.