Dear team,
I am working on RNASeq data with batches and later on I have to more covariates to design. I had tried automating R script but it's not working. How can I automate design part of DESeq2 workflow?
My coldata file looks like below
condition | batch |
ctrl | 1 |
ctrl | 1 |
ctrl | 2 |
ctrl | 2 |
treat | 1 |
treat | 1 |
treat | 2 |
treat | 2 |
covariate=paste(colnames(coldata),collapse="+")
covariate=as.factor(covariate)
> covariate
[1] condition+batch
Levels: condition+batch
dds <- DESeqDataSetFromMatrix(countData = cts1,colData = coldata,design = ~ covariate)
I am getting below error. It is not taking column names from covariate object. Am I doing wrongly.
Error in DESeqDataSet(se, design = design, ignoreRank) :
all variables in design formula must be columns in colData
Is there any way I can automate if have more than two columns (eg . age) , instead of specifying each covariate separately to design matrix like below
dds <- DESeqDataSetFromMatrix(countData = cts1,colData = coldata,design = ~ condition + batch + age
Could you please help me to resolve this issue.
Thanks In Advance
Fazulur Rehaman
Dear Michael,
Thanks a lot for your quick response and suggestions on multiple covariates.
And I have checked the vignette , and will put condition at the end of formula like below.
dds <- DESeqDataSetFromMatrix(countData = cts1,colData = coldata,design = ~ batch + age + condition)
Thanks & Regards
Fazulur Rehaman