This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Handling NA values in limma's voom design matrix

Hi, I'm trying to use limma's voom for RNA-seq data, where my design matrix contains NA values. Can voom handle these NAs or is the only solution to toss out the samples with these NAs?

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)
rna-seq voom design.matrix limma na

1 answer

Cross-posted and answered by the limma developer: https://support.bioconductor.org/p/9144237/

Log in to answer this question.