【发布时间】:2015-04-20 07:06:26
【问题描述】:
我有基因表达数据作为每个探针的计数,如下所示:
library(data.table)
mydata <- fread(
"molclass,mol.id,sample1,sample2,sample3
negative, negat1, 0, 1, 2
negative, negat2, 2, 1, 1
negative, negat3, 1, 2, 0
endogen, gene1, 30, 15, 10
endogen, gene2, 60, 30, 20
")
我的问题是 - 执行背景减法的最佳方法是什么,即对于每个 sampleN 列我需要计算背景(假设它将是来自 negative 类的所有值的平均值)然后从该列的每个值中减去该背景。目前我正在使用以下解决方案:
for (nm in names(mydata)[-c(1:2)]) {
bg <- mydata[molclass=='negative', nm, with=F];
bg <- mean(unlist(bg));
mydata[[nm]] <- (mydata[[nm]] - bg);
}
但我觉得必须有一些“更好”的方式。
附:我知道有一些软件包可以做这些事情,但我的数据对应于计数的数量,而不是信号的强度——所以我不能使用limma 或为微阵列设计的类似工具。也许一些 seq-data 包会有所帮助,但我不确定,因为我的数据也不是来自测序。
【问题讨论】:
标签: r data.table bioconductor