Question: [sva] Error in density.default(x, adjust = adj) : 'x' contains missing values
gravatar for anton.kratz
12 months ago by
United States, San Diego, UCSD
anton.kratz40 wrote:

When running the sva function, I get an error "Error in density.default(x, adjust = adj) : 'x' contains missing values".

I have a data frame with raw RNA-seq counts with sample names in columns and gene names in rows, and another data frame describing the condition of each sample. There is only one condition column and it has 8 possible states (I cannot post the actual dataset). Here is my code:


mycoldata <- read.delim("contrast.txt", header = TRUE, sep = "\t")

mycountdata <- read.delim("expr_table.tsv", header = TRUE, sep = "\t")
mycountdata$checksum <- NULL
mycountdata$score <- NULL
df <- data.matrix(mycountdata)

# build the FULL model matrix
mod = model.matrix(~as.factor(condition), data=mycoldata)

# build the NULL model matrix
mod0 = model.matrix(~1,data=mycoldata) =,mod,method="leek")

# estimate the surrogate variables
svobj = sva(df,mod,mod0, for this data set is 14. When I run the last command, I get the following error message:

> svobj = sva(df,mod,mod0,
Number of significant surrogate variables is:  14 
Iteration (out of 5 ):Error in density.default(x, adjust = adj) : 'x' contains missing values
In addition: Warning message:
In pf(fstats, df1 = (df1 - df0), df2 = (n - df1)) : NaNs produced

I found some posts describing what looks to be the same error [1][2][3], however none of these seem to have led to an accepted explanation of this error or a way to resolve this (approaches described were: just reducing the number of until it works, removing genes with low counts until it works).


[2] What does this error mean? - issue implementing SVA


ADD COMMENTlink written 12 months ago by anton.kratz40
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 379 users visited in the last hour