Reputation: 41
I am trying to apply the surrogate variable analysis (sva) package to my data, but I haven't been able to even pass beyond the model construction. I'm running into an error I can't seem to fix.
My code follows the vignette (though with my own data):
pheno <- pheno.groups
edata <- counts_all.norm.log #a normalized counts table, with log2(count+1) applied
mod <- model.matrix(~group, data=pheno.groups)
mod0 <- model.matrix(~1,data=pheno)
n.sv <- 1
svobj <- sva(edata,mod=mod,mod0=mod0,n.sv=n.sv)
The latter gives an error:
Error in density.default(x, adjust = adj) : 'x' contains missing values
The traceback is as follows:
7. stop("'x' contains missing values")
6. density.default(x, adjust = adj)
5. density(x, adjust = adj)
4. density(x, adjust = adj)
3. edge.lfdr(ptmp)
2. irwsva.build(dat = dat, mod = mod, mod0 = mod0, n.sv = n.sv, B = B)
1. sva(edata, mod = mod, mod0 = mod0, n.sv = n.sv)
Here's my session info:
Session info -------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.3.1 (2016-06-21)
system x86_64, darwin13.4.0
ui RStudio (1.0.136)
language (EN)
collate en_US.UTF-8
tz America/Indiana/Indianapolis
date 2017-03-29
Packages -----------------------------------------------------------------------------------------------------------------------------------------------
package * version date source
acepack 1.4.1 2016-10-29 CRAN (R 3.3.0)
annotate 1.50.1 2016-10-09 Bioconductor
AnnotationDbi 1.34.4 2016-07-08 Bioconductor
assertthat 0.1 2013-12-06 CRAN (R 3.3.0)
backports 1.0.5 2017-01-18 CRAN (R 3.3.2)
base64enc 0.1-3 2015-07-28 CRAN (R 3.3.0)
Biobase * 2.32.0 2016-05-04 Bioconductor
BiocGenerics * 0.18.0 2016-05-04 Bioconductor
BiocInstaller * 1.22.3 2016-06-26 Bioconductor
BiocParallel 1.6.6 2016-08-15 Bioconductor
bitops 1.0-6 2013-08-17 CRAN (R 3.3.0)
bladderbatch * 1.10.0 2017-03-29 Bioconductor
checkmate 1.8.2 2016-11-02 CRAN (R 3.3.0)
cluster * 2.0.6 2017-03-16 CRAN (R 3.3.2)
colorspace 1.3-2 2016-12-14 CRAN (R 3.3.2)
data.table 1.10.4 2017-02-01 CRAN (R 3.3.1)
DBI 0.6 2017-03-09 CRAN (R 3.3.2)
DESeq2 * 1.12.4 2016-08-08 Bioconductor
devtools 1.12.0 2016-06-24 CRAN (R 3.3.0)
digest 0.6.12 2017-01-27 CRAN (R 3.3.2)
foreign 0.8-67 2016-09-13 CRAN (R 3.3.0)
Formula 1.2-1 2015-04-07 CRAN (R 3.3.0)
genefilter * 1.54.2 2016-05-16 Bioconductor
geneplotter 1.50.0 2016-05-04 Bioconductor
GenomeInfoDb * 1.8.7 2016-09-02 Bioconductor
GenomicRanges * 1.24.3 2016-09-11 Bioconductor
ggplot2 2.2.1 2016-12-30 CRAN (R 3.3.2)
gridExtra 2.2.1 2016-02-29 CRAN (R 3.3.0)
gtable 0.2.0 2016-02-26 CRAN (R 3.3.0)
Hmisc 4.0-2 2016-12-31 CRAN (R 3.3.2)
htmlTable 1.9 2017-01-26 CRAN (R 3.3.2)
htmltools 0.3.5 2016-03-21 CRAN (R 3.3.0)
htmlwidgets 0.8 2016-11-09 CRAN (R 3.3.2)
IRanges * 2.6.1 2016-06-19 Bioconductor
knitr 1.15.1 2016-11-22 CRAN (R 3.3.2)
lattice 0.20-35 2017-03-25 CRAN (R 3.3.2)
latticeExtra 0.6-28 2016-02-09 CRAN (R 3.3.0)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.3.0)
limma * 3.28.21 2016-09-05 Bioconductor
locfit 1.5-9.1 2013-04-20 CRAN (R 3.3.0)
magrittr 1.5 2014-11-22 CRAN (R 3.3.0)
Matrix 1.2-8 2017-01-20 CRAN (R 3.3.2)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.0)
mgcv * 1.8-17 2017-02-08 CRAN (R 3.3.2)
munsell 0.4.3 2016-02-13 CRAN (R 3.3.0)
nlme * 3.1-131 2017-02-06 CRAN (R 3.3.2)
nnet 7.3-12 2016-02-02 CRAN (R 3.3.1)
pamr * 1.55 2014-08-27 CRAN (R 3.3.0)
pheatmap * 1.0.8 2015-12-11 CRAN (R 3.3.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.3.0)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.3.0)
Rcpp 0.12.10 2017-03-19 CRAN (R 3.3.2)
RCurl 1.95-4.8 2016-03-01 CRAN (R 3.3.0)
rpart 4.1-10 2015-06-29 CRAN (R 3.3.1)
RSQLite 1.1-2 2017-01-08 CRAN (R 3.3.2)
rstudioapi 0.6 2016-06-27 CRAN (R 3.3.0)
S4Vectors * 0.10.3 2016-08-16 Bioconductor
scales 0.4.1 2016-11-09 CRAN (R 3.3.2)
stringi 1.1.3 2017-03-21 CRAN (R 3.3.1)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.2)
SummarizedExperiment * 1.2.3 2016-06-10 Bioconductor
survival * 2.41-2 2017-03-16 CRAN (R 3.3.2)
sva * 3.20.0 2016-05-04 Bioconductor
tibble 1.2 2016-08-26 CRAN (R 3.3.0)
withr 1.0.2 2016-06-20 CRAN (R 3.3.0)
XML 3.98-1.5 2016-11-10 CRAN (R 3.3.2)
xtable 1.8-2 2016-02-05 CRAN (R 3.3.0)
XVector 0.12.1 2016-07-22 Bioconductor
zlibbioc 1.18.0 2016-05-04 Bioconductor
Any help, or even hints on where to go from here, would be greatly appreciated!
Upvotes: 3
Views: 2191
Reputation: 11
I had a similar problem. I found that my factor variables read in as characters (which doesn't matter for some packages but it does for this one). Once I changed all my variables labeled as characters to factors the function worked.
Upvotes: 1
Reputation: 41
I have meanwhile figured out the problem: while my test dataset did not contain NAs or +/- infinite numbers, there were several genes with very low read counts in there. Once these were removed, the package worked!
Upvotes: 1