Entering edit mode
2.5 years ago
rubic
▴
270
Hi,
I'm trying to use limma
's voom
for RNA-seq data, where my design matrix contains NA
values. Can voom
handle these NA
s or is the only solution to toss out the samples with these NA
s?
Here's my example data:
set.seed(1)
counts.mat <- matrix(as.integer(runif(1000*10, 10,1000)),nrow = 1000, ncol = 10, dimnames = list(paste0("g",1:1000),paste0("s",1:10)))
design.df <- data.frame(id = paste0("s",1:10),
sex = sample(c("female","male"), 10, replace = T),
age = sample(c(5, 7, 10), 10, replace = T))
#adding NAs
design.df$sex[3] <- NA
design.df$age[5] <- NA
design.mat <- model.matrix(~ id + age + sex, model.frame(~ ., design.df, na.action = na.pass))
dge <- edgeR::DGEList(counts = counts.mat)
dge <- edgeR::calcNormFactors(dge)
voom.obj <- limma::voom(dge, design.mat, plot=TRUE)
The last last gives this error message:
Error in qr.default(x) : NA/NaN/Inf in foreign function call (arg 1)