在用limma包求差异基因时,出现这样的报错:
Warning messages: 1: In rowsum.default(x, ID, reorder = FALSE, na.rm = TRUE) : missing values for 'group' 2: In rowsum.default(1L - is.na(x), ID, reorder = FALSE) : missing values for 'group'
以及接下来的topTable
函数:
Error in data.frame(logFC = M[top]) : row names contain missing values
发生这样情况的原因其实是矩阵(matrix)的rownames中有NA的存在,只要把这些值去掉就可以。类似:
set.seed(0)
g <- gl(2, 5)
y <- matrix(rnorm(100*length(g)), ncol=length(g))
rownames(y) <- c(NA, 2:nrow(y)) # missing values here!
library(limma)
design <- model.matrix(~g)
fit <- lmFit(y, design)
fit <- eBayes(fit)
topTable(fit, n=Inf)
... yields the error:
Error in data.frame(logFC = M[top]) : row names contain missing values
网友评论