DESEQ2 design with multiple conditions
1
0
Entering edit mode
vrehaman • 0
@vrehaman-14957
Last seen 4.6 years ago

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

 

 

 

deseq2 design matrix • 8.4k views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 12 hours ago
United States

Because the design is such an important part of the data analysis process, we specifically didn't help this step be automated. The great majority of the DESeq2 posts here are analysts who are thinking about exactly how to model their data, what assumptions to make, which coefficients to include, whether to transform or add interaction terms between variables etc. I wouldn't recommend to just put all the covariates as simple addition into the design. Sometimes this is what users want to do, but not nearly all the time.

Note that we recommend to put the variable of interest, e.g. "condition" at the end of the design formula, in case a user calls results(dds) without specifying any specific coefficient, as this will give back the coefficient associated with the last variable in the design. See the vignette.

ADD COMMENT
0
Entering edit mode

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

 

ADD REPLY

Login before adding your answer.

Traffic: 599 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