Question: problem with create design in edgR
0
gravatar for weiyanjia2008
24 days ago by
USA/Madison/UW-Madison
weiyanjia200820 wrote:

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 • 102 views
ADD COMMENTlink modified 24 days ago by Friederike3.3k • written 24 days ago by weiyanjia200820
1
gravatar for Friederike
24 days ago by
Friederike3.3k
United States
Friederike3.3k wrote:

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 COMMENTlink written 24 days ago by Friederike3.3k

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

Best,

Weiyan

ADD REPLYlink written 24 days ago by weiyanjia200820
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1220 users visited in the last hour