Create the design matrix
1
0
Entering edit mode
Mohammad • 0
@faf1c3a8
Last seen 15 months ago
United States

Hello,

I'm trying to design matrix so I can create combinations and extract the DEGs. I've been looking all over the web and I know how to create this matrix, however, when I create group as below

Group <- factor(c("Advshoot", "Cone",  "Gland", "Leaf", "Root", "Shoottip"))
Group <- relevel(Group, ref="Root")
design <- model.matrix(~0+Group)
colnames(design) <- levels(Group)

it has 6 tissues as I need it, while my y, library levels counts one of the tissues, Cone, as two

Levels: Advshoot Cone Cone  Gland Leaf Root Shoottip

so it sums up as 7 tissue types instead of 6 and running this

v <- voom(y,design,plot = TRUE)

gives this error

Error in lmFit(y, design, block = block, correlation = correlation, weights = weights) : 
  row dimension of design doesn't match column dimension of data object

Appreciate your help.

Thanks,

DEGseq edgeR RNASeq • 1.1k views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 16 minutes ago
WEHI, Melbourne, Australia

The Group factor needs to have an entry for each sample, not just an entry for each distinct tissue type. Please see the examples in the limma or edgeR documentation.

How many colums (i.e., samples) does your data have? Please show the output from:

class(y)
head(as.matrix(y))
ADD COMMENT
0
Entering edit mode

Yes, I checked, it has 12 columns as for 12 samples, 2 for each tissue type:

Leaf.Rep1, Leaf.Rep2, Root.Rep1, Root.Rep2, Adv.shoot.Rep1, Adv.shoot.Rep2,

Cone.Rep1, Cone.Rep2, Gland.Rep1, Gland.Rep2, Shoot.tip.Rep1, Shoot.tip.Rep2.

But yet I don't understand why in the group does not match y and shows Cone as two?

ADD REPLY
0
Entering edit mode

It seems the difference between the two replicates for the tissue type, Cone, is so significant that it considers them two different tissues, since with dropping these two reps everything back to normal. I don't know this is actual reason or not but it worked.

ADD REPLY
2
Entering edit mode

No, that's not the reason. The problem was that you included an extra space after one of the "Cone" samples so that R treated "Cone" and "Cone " (with a space) as different tissues.

ADD REPLY
0
Entering edit mode

Gordon, thank you. Yes, that was the reason, check them all, everything is fine now.

ADD REPLY

Login before adding your answer.

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