Responder Vs Non-Responders Paired Comparison DESeq2
1
0
Entering edit mode
penny.lane • 0
@pennylane-21859
Last seen 10 months ago
United States

There was an earlier post that nicely explained how to build a design matrix for a paired responder vs non-repsonder analysis: https://support.bioconductor.org/p/95143/#124666

In that example, the assumption was that there were two conditions, "screen" and "treatment", representing before and after treatment. What if instead there are several conditions, say "before", "during" and "after", how would you specify that you want "before" to be the base case for your comparison to "during" or "after"? It seems like it might be defaulting to alphabetical order, leaving me without the "groupY.conditionAfter" and "groupN.conditionAfter" variables to contrast.

I also commented in that other post if anyone prefers to respond there. Thanks!

deseq2 • 553 views
ADD COMMENT
0
Entering edit mode

No one really wants to hold your hand through how to use the software. You will get better answers if you read through some DESeq tutorials, write some code using the examples you see, and ask about specific lines that you think might not be doing what you want them to.

ADD REPLY
0
Entering edit mode

As far as I can tell this is not explained in the tutorials (I have read them). I'd be happy to be wrong about that though, so please point me to where you see it explained and I'll be out of your hair. It does not seem to be a very basic form of analysis and one that could easily be done wrong because of the wonky way in which the design matrix is generated. This is why I was seeking an expert opinion. Not everyone is an expert. Not everyone is a nice person either I guess.

ADD REPLY
1
0
Entering edit mode

I had actually tried to implement the relevel approach outlined in the vignette, but it didn't fix mt problem, so I wasn't sure it was actually what I needed to do. However, since you sent me back there I tried modifying my original code. I think the code in the vignette assumes a dds object exists to modify before actually calling DESeqDataSetFromTximport or whatever method is used to construct the dds, no? So, my original/failed code was this:

dds = DESeqDataSetFromTximport(txi, colData=sampleTable, ~1)
dds$VisitGroup = relevel(dds$VisitGroup, ref = "BeforeTx")
model = model.matrix( ~Responder + Responder:PtId + Responder:VisitGroup, sampleTable)
model = model[, -which(apply(model, 2, function(x) all(x==0)))]
dds = DESeq(dds, full=model, betaPrior=FALSE)
res = results(dds, contrast=list("ResponderY.VisitGroupDuringTx", "ResponderN.VisitGroupDuringTx"))

If I instead relevel the sampleTable before passing it to DESeqDataSetFromTximport, this seems to fix my problem:

sampleTable$VisitGroup = relevel(dds$VisitGroup, ref = "BeforeTx")
dds = DESeqDataSetFromTximport(txi, colData=sampleTable, ~1)
model = model.matrix( ~Responder + Responder:PtId + Responder:VisitGroup, sampleTable)
model = model[, -which(apply(model, 2, function(x) all(x==0)))]
dds = DESeq(dds, full=model, betaPrior=FALSE)
res = results(dds, contrast=list("ResponderY.VisitGroupDuringTx", "ResponderN.VisitGroupDuringTx"))

Does that look right to you Michael?

ADD REPLY
0
Entering edit mode

The top code doesn't work because you create model from sampleTable which has the wrong coding.

ADD REPLY
0
Entering edit mode

Ah, I see, but do you agree that in the context of this code it's simpler just to relevel the sampleTable from the outset rather than to have to do it twice? Just want to make sure I'm not still misunderstanding something.

ADD REPLY
0
Entering edit mode

Either way is fine. When you relevel the column of the DESeqDataSet, you haven’t modified the sampleTable obviously. R doesn’t back propagate your changes to objects used to construct dds.

ADD REPLY
0
Entering edit mode

OK, thanks again Michael.

ADD REPLY

Login before adding your answer.

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