Question: How do I extract read counts from DESeq2
0
gravatar for hechtp
3.6 years ago by
hechtp0
hechtp0 wrote:

Hello,

I have a RNA-seq dataset in which I am adjusting for subject age (design=~age+condition).

I am wondering if DESeq2 generates a table of normalized reads after adjusting for the covariate, "age".  If so, how can I extract it?

I ask because I would like to extract the normalized reads (adjusted for the covariate) that I can use to create a gene co-expression network.
 

deseq2 counts covariates • 3.1k views
ADD COMMENTlink modified 3.6 years ago by Michael Love25k • written 3.6 years ago by hechtp0
vsd <- varianceStabilizingTransformation(dds)

You can save them:

write.table(assay(vsd), file="varianceStabilizingTransformation.txt", sep="\t")
ADD REPLYlink written 3.6 years ago by g.atla0
Answer: How do I extract read counts from DESeq2
1
gravatar for Michael Love
3.6 years ago by
Michael Love25k
United States
Michael Love25k wrote:

Similar to g.atla's answer, you can perform one of DESeq2's transformations (see vignette) and then, to adjust for a covariate, you can use limma's removeBatchEffect() function on the transformed values. Note that the transformed values will be on the log2 scale.

# you can use VST, rlog, or normTransform() function in DESeq2
# to create a DESeqTransform object. then:
mat <- assay(vsd) 
library(limma)
mat2 <- removeBatchEffect(mat, vsd$age.binned)

What's this age.binned I use in the last line? Read the DESeq2 FAQ about using age as a continuous covariate. In short, I do not recommend adjusting for age as a continuous covariate, and offer an alternative by creating a new variable which bins age into, say, 5 groups using the cut() function.

vsd$age.binned <- cut(vsd$age, 5)
ADD COMMENTlink modified 3.6 years ago • written 3.6 years ago by Michael Love25k

That is perfect. Thank you both for your time!

ADD REPLYlink written 3.6 years ago by hechtp0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 326 users visited in the last hour