经过一天的搜寻后,我决定最好在这里提出这个问题。
所以实验是,我有3位患者的大量RNA序列数据:A,B,C。并获得其RNA seq数据用于预处理,治疗周期1,治疗周期2,治疗周期3。
因此,我总共有12个批量RNA序列样本:
A.PreTreat-> A.Cycle1-> A.Cycle2-> A.Cycle3
B.PreTreat-> B.Cycle1-> B.Cycle2-> B.Cycle3
C.PreTreat-> C.Cycle1-> C.Cycle2-> C.Cycle3
我想使用model.matrix(), lmFit(), makeContrasts(), contrasts.fit(), eBayes()
获取不同周期之间的差异基因列表(即,从第3个周期到预处理,从第3个周期到第2个周期,所有这些都在limma软件包中。
这是我的最小工作示例。
library(limma)
# Already normalized expression set: rows are genes, columns are the 12 samples
normalized_expression <- matrix(data=sample(1:100), nrow=10, ncol=12)
colnames(normalized_expression) <- c("A.PreTreat", "A.Cycle1", "A.Cycle2", "A.Cycle3", "B.PreTreat", "B.Cycle1", "B.Cycle2", "B.Cycle3", "C.PreTreat", "C.Cycle1", "C.Cycle2", "C.Cycle3")
patient_and_treatment <- factor(colnames(normalized_expression), levels = colnames(normalized_expression))
design.matrix <- model.matrix(~0 + patient_and_treatment)
colnames(design.matrix) <- patient_and_treatment
fit <- lmFit(normalized_expression, design.matrix)
# I want to get a contrast matrix to get differential genes between cycle 3 treatment and pre-treatment in all patients
contrast.matrix <- makeContrasts("A.Cycle3+B.Cycle3+C.Cycle3-A.PreTreat-B.PreTreat-C.PreTreat",
levels = levels(patient_and_treatment))
# Outputs Error of no residual degree of freedom
fit2 <- eBayes( contrasts.fit( fit, contrast.matrix ) )
# Want to run but cannot
summary(decideTests(fit2))
到目前为止,我没有任何残留的自由度错误。
我什至不确定这是否在统计学上正确地解决了我在所有患者中从第3周期治疗到预处理之间获得差异基因清单的问题。
任何帮助将不胜感激。
谢谢!
每个组不能有1个观测值,这会使回归变得毫无意义,因为您要使每个数据点都适合自己。