Supplying a designmatrix to DESeq()
1
0
Entering edit mode
kieran.mace ▴ 40
@kieranmace-11647
Last seen 6.9 years ago

I have missing samples in my interaction design, so I followed the tutorial to get rid of missing samples:

m1 = model.matrix(~Strain + Condition + Strain:Condition, meta)
all.zero <- apply(m1, 2, function(x) all(x==0))
idx <- which(all.zero)
m1 <- m1[,-idx]

But now I'm not sure how to supply this to create a DESeq object? Ive tried suppliying it to the design argument but get an error

dds <- DESeqDataSetFromMatrix(countData = raw_counts,
                              colData = meta, 
                              design = m1)

I can create the object using a different design, but then how do i replace the design with the correct model matrix? I might be confusing design and model.matrix, if so can somebody clarify?

deseq2 • 1.2k views
ADD COMMENT
0
Entering edit mode

I notice that DESeq() accepts a `modelMatrixType` argument, but not `modelMatrix` argument?

 

ADD REPLY
1
Entering edit mode
kieran.mace ▴ 40
@kieranmace-11647
Last seen 6.9 years ago

my current solution is to use a ~1 design, and then supply the model.matrix to the full argument (even thought I am using the Wald test)

library("DESeq2")
dds <- DESeqDataSetFromMatrix(countData = raw_counts,
                              colData = meta, 
                              design = ~1)

m1 = model.matrix(~Strain + Condition + Strain:Condition, colData(dds))

all.zero <- apply(m1, 2, function(x) all(x==0))
all.zero
idx <- which(all.zero)
m1 <- m1[,-idx]


dds <- DESeq(dds, test = "Wald", betaPrior = FALSE, full = m1, parallel = TRUE)
ADD COMMENT
0
Entering edit mode

This is the correct way. In the development branch, I’ve allowed a matrix to the design slot, but what you’re doing is the right way for past and future versions.

ADD REPLY

Login before adding your answer.

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