This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in design.matrix in edgeR?

My research question is to find difference of miRNA in Groups1 before and after treatment. Sub-groups "B", "C" are pre while "BF", and "CF" are post samples.

basefup<-factor(group$Groups1, levels = c("B", "BF", "C", "CF", "NC"))
treatment<-factor(group$Groups, levels = c("NC", "pre", "post"))
#Design matrix
design<-model.matrix(~0+basefup+treatment) 
colnames(design)
y <- estimateDisp(y, design, robust=TRUE)

Gives following error:

Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05,  : Design matrix not of full rank.  The following coefficients not estimable:  treatmentpre treatmentpost

any suggestions ?

My data structure is as shown below which are paired data and NC as control without paired data.

BF is after treatment sample of B, CF is after treatment sample of C. The B, C are two different clinical conditions.

Groups Patient Groups1

pre a B
pre b B
pre c B
post a BF
post b BF
post c BF
pre d B
pre e B
pre f B
post d BF
post e BF
post f BF
pre g C
pre h C
pre i C
post g CF
post h CF
post i CF
NC x NC
NC y NC
NC z NC

what I want to do is to compare DE miRNAs between

  1. B-NC , C-NC, BF-NC, CF-NC which means DE mirnas in each groups taking NC as reference
  2. combined (B+C)/2- NC and (BF+CF)/2- NC
  3. (BF+CF)/2- (B+C)/2
  4. BF-B, CF-C which are DE miRNAs after and before treatment
rna-seq edger mirnaseq r

You can edit your posts by clicking on the "edit" button. I lieu of that, I've copied your answer into your post.

2 answers

I assume what you actually want is something like this:

sample   subgroup   treatment
1        B          control
2        B          control
3        C          control
4        C          control
5        B          treatment
...

And so on. The model is then ~subgroup + treatment, since presumably you want the treatment effect while accounting for subgroups.

Given your update:

  1. model ~0 + group1 and use the contrasts you specified.
  2. Define "combined"
  3. model ~0 + group1 and use the contrasts you specified.
  4. model ~0 + group1 and use the contrasts you specified.

The data set you created is different that the real one. sorry for confusion. The dataset is provided again

I've updated my reply.

My data structure is as shown below which are paired data and NC as control without paired data.

BF is after treatment sample of B, CF is after treatment sample of C. The B, C are two different clinical conditions.

Groups Patient Groups1

pre a B
pre b B
pre c B
post a BF
post b BF
post c BF
pre d B
pre e B
pre f B
post d BF
post e BF
post f BF
pre g C
pre h C
pre i C
post g CF
post h CF
post i CF
NC x NC
NC y NC
NC z NC

what I want to do is to compare DE miRNAs between

  1. B-NC , C-NC, BF-NC, CF-NC which means DE mirnas in each groups taking NC as reference
  2. combined (B+C)/2- NC and (BF+CF)/2- NC
  3. (BF+CF)/2- (B+C)/2
  4. BF-B, CF-C which are DE miRNAs after and before treatment

Log in to answer this question.