Hi Friederike, Thank you very much. As you suggested, there is something wrong with my group setting.
Best,
Weiyan
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
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)
```
Hi Friederike, Thank you very much. As you suggested, there is something wrong with my group setting.
Best,
Weiyan
Log in to answer this question.