SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
DESeq2 design matrix help Chandu RNA Sequencing 2 02-09-2016 07:24 AM
DESEQ2 design matrix help adrian Bioinformatics 1 01-27-2016 11:21 AM
Design matrix for edgeR help ea11 Bioinformatics 0 01-04-2016 03:21 AM
model matrix design for multiple siRNAs targeting same gene Brandi Bioinformatics 2 02-27-2014 05:18 AM
EdgeR design-matrix design extended.wobble RNA Sequencing 3 07-11-2011 07:58 AM

Reply
 
Thread Tools
Old 10-17-2016, 04:45 PM   #1
Lugalbanda
Junior Member
 
Location: Canada

Join Date: Oct 2016
Posts: 3
Question Limma multifactor experiment design matrix

Hi, so I am very confused as to how I can make a multifactor design for limma RNA differential expression. I've read other posts in different forums and none of the answers are very explicit (to me) as to how to build a multifactor design

For examples, say I have p1N, p1T, p2N, and p2T, where p# is patient number and N/T is normal tumor.

I can build a single factor design matrix like this:

------Normal------Tumor
1 ------ 1 --------- 0
2 ------ 0 --------- 1
3 ------ 1 --------- 0
4 ------ 0 --------- 1

I am completely lost as to how I can build a numeric matrix with multiple factors, which in this case, the factors would be patient number and N/T.
Lugalbanda is offline   Reply With Quote
Old 10-18-2016, 12:33 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,476
Default

Code:
d = data.frame(patient=factor(c("p1", "p1", "p2", "p2", ...)),
               condition=factor(c("N", "T", "N", "T", ...)))
design = model.matrix(~patient + condition, d)
N.B., I've likely made a typo somewhere, but that's the gist.
dpryan is offline   Reply With Quote
Old 10-18-2016, 10:21 AM   #3
Lugalbanda
Junior Member
 
Location: Canada

Join Date: Oct 2016
Posts: 3
Default

Oh, I thought I had to manually build a numeric matrix for the design matrix. Thanks. I have a followup question. I understand that the intercept column that is resulted is used for pair wise comparison. My question is when to use:

design = model.matrix(~0+patient + condition, d)
as opposed to this
design = model.matrix(~patient + condition, d)

Ok I found this from another post:

EDIT:
"This [design = model.matrix(~0+patient + condition, d)] (a cell means model) simply computes the mean expression for each group, and then you have to make all contrasts explicitly. The [design = model.matrix(~patient + condition, d)] has an implicit contrast (everything is a comparison to control), so you have to make contrasts for some comparisons, but not for others."

from https://support.bioconductor.org/p/57268/


So is it safe to say this only matters if I am doing a contrast matrix comparison?

Last edited by Lugalbanda; 10-18-2016 at 10:35 AM.
Lugalbanda is offline   Reply With Quote
Old 10-19-2016, 01:12 AM   #4
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,476
Default

Correct, the "0+" is only needed if you want to specify contrasts, which aren't needed to answer your question.
dpryan is offline   Reply With Quote
Reply

Tags
differential expression, limma voom

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 04:52 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO