Search
Question: [sva] Error in density.default(x, adjust = adj) : 'x' contains missing values
1
gravatar for anton.kratz
5 weeks ago by
anton.kratz30
Japan
anton.kratz30 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:

library(sva)

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)

n.sv = num.sv(df,mod,method="leek")
n.sv

# estimate the surrogate variables
svobj = sva(df,mod,mod0,n.sv=n.sv)

n.sv for this data set is 14. When I run the last command, I get the following error message:

> svobj = sva(df,mod,mod0,n.sv=n.sv)
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 n.sv until it works, removing genes with low counts until it works).

[1] https://www.biostars.org/p/198820/

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

[3] https://stackoverflow.com/questions/43101585/error-when-generating-the-sva-object-using-package-sva-in-r

sva
ADD COMMENTlink written 5 weeks ago by anton.kratz30
Please log in to add an answer.

Help
Access

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