using variable in design formula
1
0
Entering edit mode
igor ▴ 40
@igor
Last seen 10 months ago
United States

Many packages that do statistical analysis (such as DESeq2 or DEXSeq), use a design formula to specify the exact comparison. For example:

DESeqDataSet(se, design = ~ condition)

Where "condition" is the actual column name. I'd like to have the column name be adjustable. I tried using a variable in the formula:

design_col = "condition"
DESeqDataSet(se, design = ~ design_col)

As might be expected, that does not work ("all variables in design formula must be columns in colData"). I then tried:

design_col = "condition"
design_formula = paste("~", design_col)
DESeqDataSet(se, design = design_formula)

That also gives an error ("Error: $ operator is invalid for atomic vectors").

Is there a way to use variables in the design formula?

deseq2 r design matrix • 1.6k views
ADD COMMENT
2
Entering edit mode
@mikelove
Last seen 1 day ago
United States

If you want to change the design programmatically you can do something like:

DESeqDataSet(se, design = formula(paste("~",x)))
ADD COMMENT

Login before adding your answer.

Traffic: 943 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6