如何获得满秩矩阵?

时间:2018-04-25 14:55:42

标签: r expression bioconductor

我有两组数据,4个样品,每批1个,重复1个,另外4个样品,2个重复2个样品。

我想从这些样本中删除批处理效果,并将不同的方法进行比较。 我已完成以下命令,但面临错误:

design

                                 method batch
L4_rep1                               L    b1
L4_rep2                               L    b1
L6_L8_rep1                            L    b1
L6_L8_rep2                            L    b1
Q5_Q7_rep1                            Q    b1
Q5_Q7_rep2                            Q    b1
Q3_rep1                               Q    b1
Q3_rep2                               Q    b1
co_40d_A                          co_40d    b2
co_40d_B                          co_40d    b2
co_60d_A                          co_60d    b2
co_60d_B                          co_60d    b2
EB_A                                 EB    b2
EB_B                                 EB    b2
H9_A                                 H9    b2
H9_B                                 H9    b2


design$method <- factor(design$method, levels = c("L", "Q", "co_40d","co_60d", "EB", "H9"))
design$batch <- factor(design$batch, levels = c("b1", "b2"))

design.matrix <- model.matrix(~0+batch+method,design)

design.matrix

            batchb1 batchb2 methodQ methodco_40d methodco_60d methodEB methodH9
L4_rep1          1       0       0            0            0        0        0
L4_rep2          1       0       0            0            0        0        0
L6_L8_rep1       1       0       0            0            0        0        0
L6_L8_rep2       1       0       0            0            0        0        0
Q5_Q7_rep1       1       0       1            0            0        0        0
Q5_Q7_rep2       1       0       1            0            0        0        0
Q3_rep1          1       0       1            0            0        0        0
Q3_rep2          1       0       1            0            0        0        0
co_40d_A         0       1       0            1            0        0        0
co_40d_B         0       1       0            1            0        0        0
co_60d_A         0       1       0            0            1        0        0
co_60d_B         0       1       0            0            1        0        0
EB_A             0       1       0            0            0        1        0
EB_B             0       1       0            0            0        1        0
H9_A             0       1       0            0            0        0        1
H9_B             0       1       0            0            0        0        1

library(edgeR)
data_filter<- count table
edgeR.dgelist = DGEList(data_filter)
edgeR.dgelist_normal = calcNormFactors(edgeR.dgelist)
CommonDisp <- estimateGLMCommonDisp(edgeR.dgelist_normal, design.matrix)
Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset,  : Design matrix not of full rank.  The following coefficients not estimable: methodH9

我想知道我的设计矩阵是否正确? 另外,我喜欢将Q方法与其他方法进行比较,请你帮我做对比吗?

1 个答案:

答案 0 :(得分:0)

无法根据此设计创建完整的排名矩阵。 如果您具有变量batch1的值和方法列之一,则可以轻松地知道其他虚拟变量的值。 不可能比较各批次的方法,例如,没有方法&#34; L&#34;从批次2到与batch1进行比较。