problem with create design in edgR
1
0
Entering edit mode
5.2 years ago

Hello, I have two groups WT and KO, each has 3 replicates. I followed this paper: http://master.bioconductor.org/packages/release/workflows/vignettes/RNAseq123/inst/doc/limmaWorkflow.html everything is going well until I did the design step: The code is

design <- model.matrix(~0+group)
colnames(design) <- levels(group)
design

The output is

  KO WT
 1  0  1
 2  1  0
attr(,"assign")
[1] 1 1
attr(,"contrasts")
attr(,"contrasts")$group
[1] "contr.treatment"

Since I have 6 samples in total, I should see 6 rows right? I am wondering why I only see two rows? I can't continue the tutorial.

dim(x)
dim(design)

[1] 20502     6
[1] 2 2

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

the ouput

Error in lmFit(y, design, ...) : row dimension of design doesn't match column dimension of data object

Thanks,

Weiyan

RNA-Seq • 1.8k views
ADD COMMENT
1
Entering edit mode
5.2 years ago

As the error message states, you need to have as many factors in your design matrix as you have samples in your matrix of expression values.

In the example that you linked you can see that some factors are present more than once:

group <- as.factor(c("LP", "ML", "Basal", "Basal", "ML", "LP",   "Basal", "ML", "LP"))

In your case, you should have 3x WT and 3x KO, the precise order will depend on the order of the samples within your data matrix. To make sure everything's set up right, you could add the colnames of your matrix as rownames to the design matrix, which will allow you to double check that you've assigned everything right.

design <- model.matrix(~0+group+lane)
colnames(design) <- gsub("group", "", colnames(design))
rownames(design) <- colnames(expression_matrix)

```

ADD COMMENT
0
Entering edit mode

Hi Friederike, Thank you very much. As you suggested, there is something wrong with my group setting.

Best,

Weiyan

ADD REPLY

Login before adding your answer.

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