Hello,
I am currently having an error when I am using the estimateDisp function on edgeR, my pheno table and design matrix looks like this:
GROUP AGE GENDER
1 no_woman 26.00000 woman
2 no_man 22.18962 man
2 yes_woman 27.86650 woman
3 no_woman 21.55446 woman
4 no_woman 24.60362 woman
5 no_woman 26.47429 woman
6 no_woman 24.00000 woman
7 no_woman 29.08834 woman
8 no_woman 20.85291 woman
9 yes_man 26.28884 man
10 no_man 30.54005 man
11 no_man 25.92953 man
[...]
And that is my matrix:
Group <- y_transcripts$samples$group
Age <- y_transcripts$samples$AGE
Gender <- y_transcripts$samples$GENDER
design <- model.matrix(~0+Group+Gender+Age)
Contrasts <- makeContrasts((Groupyes_woman-Groupno_woman)-(Groupyes_man-Groupno_man),levels=colnames(design))
design
Groupno_man Groupno_woman Groupyes_man Groupyes_woman Genderwoman Age
1 0 1 0 0 1 26.00000
2 1 0 0 0 0 22.18962
3 0 0 0 1 1 27.86650
4 0 1 0 0 1 21.55446
5 0 1 0 0 1 24.60362
6 0 1 0 0 1 26.47429
7 0 1 0 0 1 24.00000
8 0 1 0 0 1 29.08834
9 0 1 0 0 1 20.85291
10 0 0 1 0 0 26.28884
11 1 0 0 0 0 30.54005
[....]
attr(,"assign")
[1] 1 1 1 1 2 3
attr(,"contrasts")
attr(,"contrasts")$Group
[1] "contr.treatment"
attr(,"contrasts")$Gender
[1] "contr.treatment"
Afterwards I filtered by minimum expression using defaults and normalized the library size
keep <- filterByExpr(y_transcripts, group=Group)
y_transcripts <- y_transcripts[keep, , keep.lib.sizes=FALSE]
y_transcripts <- calcNormFactors(y_transcripts)
I got an error when using estimateDisp
y_transcripts <- estimateDisp(y_transcripts, design, robust=TRUE)
> Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05, :
> Design matrix not of full rank. The following coefficients not estimable:
> Genderwoman
When I exclude Gender from the design matrix it works, I don’t know what is my mistake.
Read more here: Source link