theislab / destiny

R package for single cell and other data analysis using diffusion maps
https://theislab.github.io/destiny/
GNU General Public License v3.0
77 stars 11 forks source link

intermittent error with "get_KNN_cover" not resolved from the current namespace (FNN) #1

Closed davismcc closed 7 years ago

davismcc commented 7 years ago

Hi Folks

I've been refactoring scater to use the new SingleCellExperiment class from Bioconductor and have encountered a peculiar, intermittent error that seems to be coming from destiny (version 2.5.6; current devel on Bioconductor). I'm running this on R 3.4.1 on Mac OS X.

As I'm sure you know, in scater there is a plotDiffusionMap function that is a wrapper around destiny::DiffusionMap. This has worked completely as expected until this week.

Recently, I have been seeing this strange behaviour, where in a fresh R session, everything will work fine (e.g. scater tests all pass), but for subsequent calls to plotDiffusionMap in the same session there will be an error that looks like:

"get_KNN_cover" not resolved from current namespace (FNN)
1: expect_that(plotDiffusionMap(example_sce), is_a("ggplot")) at /Users/davis/Dropbox/Projects/scater/tests/testthat/test-plotting.R:76
2: condition(object)
3: expect_is(x, class)
4: klass(object)
5: paste(class(x), collapse = "/")
6: plotDiffusionMap(example_sce)
7: runDiffusionMap(object, ncomponents = ncomponents, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:968
8: destiny::DiffusionMap(vals, sigma = sigma, distance = distance, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:881
9: find_knn(imputed_data, dists, k, verbose)
10: verbose_timing(verbose, "finding knns", get.knn(imputed_data, k, algorithm = "cover_tree"))
11: get.knn(imputed_data, k, algorithm = "cover_tree")

I don't really understand what's happening here. If you have any ideas then please let me know. I'm very happy to help troubleshoot and get both destiny and scater working nicely together ahead of the upcoming release.

Full error messages, session info and output below.

Best Davis

```r Restarting R session... > library(scater) Attaching package: ‘scater’ The following object is masked from ‘package:S4Vectors’: rename The following object is masked from ‘package:stats’: filter > devtools::test() Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Testing scater test calculation of TPM and FPKM: ................ tests on inputs: . test manipulations: .... test feature pre-processing functions: Collapsing expression to 500 features..Collapsing expression to 500 features..Collapsing expression to 500 features....Collapsing expression to 500 features..Collapsing expression to 500 features.. test improper input usage: Kallisto log not provided - assuming all runs successful. test expected usage: ........... test plot, plotPCA, plotTSNE and plotDiffusionMap: ....1.. test plotExpression: ...................... test controls functionality: .......................... ....test expected usage: Collapsing expression to 500 features... test improper input usage: Kallisto log not provided - assuming all runs successful. ............. Failed ------------------------------------------------------------------------------------------------------------------------------------------- 1. Error: we can produce Diffusion Map plots with different expression values (@test-plotting.R#76) ---------------------------------------------- "get_KNN_cover" not resolved from current namespace (FNN) 1: expect_that(plotDiffusionMap(example_sce), is_a("ggplot")) at /Users/davis/Dropbox/Projects/scater/tests/testthat/test-plotting.R:76 2: condition(object) 3: expect_is(x, class) 4: klass(object) 5: paste(class(x), collapse = "/") 6: plotDiffusionMap(example_sce) 7: runDiffusionMap(object, ncomponents = ncomponents, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:968 8: destiny::DiffusionMap(vals, sigma = sigma, distance = distance, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:881 9: find_knn(imputed_data, dists, k, verbose) 10: verbose_timing(verbose, "finding knns", get.knn(imputed_data, k, algorithm = "cover_tree")) 11: get.knn(imputed_data, k, algorithm = "cover_tree") DONE ============================================================================================================================================= > devtools::test() Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Testing scater test calculation of TPM and FPKM: ................ tests on inputs: . test manipulations: .... test feature pre-processing functions: Collapsing expression to 500 features..Collapsing expression to 500 features..Collapsing expression to 500 features....Collapsing expression to 500 features..Collapsing expression to 500 features.. test improper input usage: Kallisto log not provided - assuming all runs successful. test expected usage: ........... test plot, plotPCA, plotTSNE and plotDiffusionMap: ........1.. test plotExpression: ...................... test controls functionality: .......................... ....test expected usage: Collapsing expression to 500 features... test improper input usage: Kallisto log not provided - assuming all runs successful. ............. Failed ------------------------------------------------------------------------------------------------------------------------------------------- 1. Error: we can produce Diffusion Map plots with different expression values (@test-plotting.R#76) ---------------------------------------------- "get_KNN_cover" not resolved from current namespace (FNN) 1: expect_that(plotDiffusionMap(example_sce), is_a("ggplot")) at /Users/davis/Dropbox/Projects/scater/tests/testthat/test-plotting.R:76 2: condition(object) 3: expect_is(x, class) 4: klass(object) 5: paste(class(x), collapse = "/") 6: plotDiffusionMap(example_sce) 7: runDiffusionMap(object, ncomponents = ncomponents, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:968 8: destiny::DiffusionMap(vals, sigma = sigma, distance = distance, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:881 9: find_knn(imputed_data, dists, k, verbose) 10: verbose_timing(verbose, "finding knns", get.knn(imputed_data, k, algorithm = "cover_tree")) 11: get.knn(imputed_data, k, algorithm = "cover_tree") DONE ============================================================================================================================================= > ?get_KNN_cover No documentation for ‘get_KNN_cover’ in specified packages and libraries: you could try ‘??get_KNN_cover’ > ?find_knn No documentation for ‘find_knn’ in specified packages and libraries: you could try ‘??find_knn’ > ?destiny::find_knn No documentation for ‘find_knn’ in specified packages and libraries: you could try ‘??find_knn’ > biocLite("destiny") Error in biocLite("destiny") : could not find function "biocLite" > source("https://bioconductor.org/biocLite.R") Bioconductor version 3.6 (BiocInstaller 1.27.3), ?biocLite for help > biocLite("destiny") BioC_mirror: https://bioconductor.org Using Bioconductor 3.6 (BiocInstaller 1.27.3), R 3.4.1 (2017-06-30). Installing package(s) ‘destiny’ trying URL 'https://bioconductor.org/packages/3.6/bioc/bin/macosx/el-capitan/contrib/3.4/destiny_2.5.6.tgz' Content type 'application/x-gzip' length 3380513 bytes (3.2 MB) ================================================== downloaded 3.2 MB The downloaded binary packages are in /var/folders/11/qp2jn0wx7t5bgjb74nkwbl3h0000gp/T//RtmpCEClTq/downloaded_packages Old packages: 'BiocStyle', 'RcppArmadillo', 'servr' Update all/some/none? [a/s/n]: a There are binary versions available but the source versions are later: binary source needs_compilation RcppArmadillo 0.7.900.2.0 0.7.960.1.0 TRUE servr 0.6 0.7 FALSE Do you want to install from sources the package which needs compilation? y/n: y trying URL 'https://bioconductor.org/packages/3.6/bioc/bin/macosx/el-capitan/contrib/3.4/BiocStyle_2.5.18.tgz' Content type 'application/x-gzip' length 1210239 bytes (1.2 MB) ================================================== downloaded 1.2 MB The downloaded binary packages are in /var/folders/11/qp2jn0wx7t5bgjb74nkwbl3h0000gp/T//RtmpCEClTq/downloaded_packages installing the source packages ‘RcppArmadillo’, ‘servr’ trying URL 'https://cran.rstudio.com/src/contrib/RcppArmadillo_0.7.960.1.0.tar.gz' Content type 'application/x-gzip' length 1115176 bytes (1.1 MB) ================================================== downloaded 1.1 MB trying URL 'https://cran.rstudio.com/src/contrib/servr_0.7.tar.gz' Content type 'application/x-gzip' length 21902 bytes (21 KB) ================================================== downloaded 21 KB * installing *source* package ‘RcppArmadillo’ ... ** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether clang++ -arch x86_64 -ftemplate-depth-256 accepts -g... yes checking how to run the C++ preprocessor... clang++ -arch x86_64 -ftemplate-depth-256 -E checking whether we are using the GNU C++ compiler... (cached) yes checking whether clang++ -arch x86_64 -ftemplate-depth-256 accepts -g... (cached) yes checking whether g++ version is sufficient... checking LAPACK_LIBS... fallback LAPACK from R 3.3.0 or later used configure: creating ./config.status config.status: creating inst/include/RcppArmadilloLapack.h ** libs clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I/usr/local/include -I../inst/include -fopenmp -fPIC -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -c RcppArmadillo.cpp -o RcppArmadillo.o clang: error: unsupported option '-fopenmp' make: *** [RcppArmadillo.o] Error 1 ERROR: compilation failed for package ‘RcppArmadillo’ * removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo’ * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo’ * installing *source* package ‘servr’ ... ** package ‘servr’ successfully unpacked and MD5 sums checked ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (servr) The downloaded source packages are in ‘/private/var/folders/11/qp2jn0wx7t5bgjb74nkwbl3h0000gp/T/RtmpCEClTq/downloaded_packages’ Warning message: In install.packages(update[instlib == l, "Package"], l, repos = repos, : installation of package ‘RcppArmadillo’ had non-zero exit status Restarting R session... > ls() character(0) > devtools::test() Loading scater Loading required package: testthat Loading required package: Biobase Loading required package: BiocGenerics Loading required package: parallel Attaching package: ‘BiocGenerics’ The following objects are masked from ‘package:parallel’: clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB The following objects are masked from ‘package:stats’: IQR, mad, sd, var, xtabs The following objects are masked from ‘package:base’: anyDuplicated, append, as.data.frame, cbind, colMeans, colnames, colSums, do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply, lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames, rowSums, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min Welcome to Bioconductor Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")', and for packages 'citation("pkgname")'. Loading required package: ggplot2 Loading required package: SingleCellExperiment Loading required package: SummarizedExperiment Loading required package: GenomicRanges Loading required package: stats4 Loading required package: S4Vectors Attaching package: ‘S4Vectors’ The following object is masked from ‘package:base’: expand.grid Loading required package: IRanges Loading required package: GenomeInfoDb Loading required package: DelayedArray Loading required package: matrixStats Attaching package: ‘matrixStats’ The following objects are masked from ‘package:Biobase’: anyMissing, rowMedians Attaching package: ‘DelayedArray’ The following objects are masked from ‘package:matrixStats’: colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges The following object is masked from ‘package:base’: apply Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Testing scater test calculation of TPM and FPKM: ................ tests on inputs: . test manipulations: .... test feature pre-processing functions: Collapsing expression to 500 features..Collapsing expression to 500 features..Collapsing expression to 500 features....Collapsing expression to 500 features..Collapsing expression to 500 features.. test improper input usage: Kallisto log not provided - assuming all runs successful. test expected usage: ........... test plot, plotPCA, plotTSNE and plotDiffusionMap: ........... test plotExpression: ...................... test controls functionality: .......................... ....test expected usage: Collapsing expression to 500 features... test improper input usage: Kallisto log not provided - assuming all runs successful. ............. DONE ============================================================================================================================================= > devtools::run_examples() Updating scater documentation Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Running 56 example files in scater -------------------------------------------------------------------------------------------------------------- Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Running examples in accessors.Rd ---------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > > exprs(example_sce) <- log2(calculateCPM(example_sce, use.size.factors = FALSE) + 1) > > example_sce <- SingleCellExperiment( + assays = list(norm_counts = sc_example_counts), colData = sc_example_cell_info) > > counts(example_sce) <- sc_example_counts > norm_exprs(example_sce) <- log2(calculateCPM(example_sce, use.size.factors = FALSE) + 1) > > stand_exprs(example_sce) <- log2(calculateCPM(example_sce, use.size.factors = FALSE) + 1) > > tpm(example_sce) <- calculateTPM(example_sce, effective_length = 5e4) > > cpm(example_sce) <- calculateCPM(example_sce, use.size.factors = FALSE) > > fpkm(example_sce) NULL Running examples in areSizeFactorsCentred.Rd ---------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > keep_gene <- rowSums(counts(example_sce)) > 0 > example_sce <- example_sce[keep_gene,] > > sizeFactors(example_sce) <- runif(ncol(example_sce)) > areSizeFactorsCentred(example_sce) [1] FALSE > example_sce <- normalize(example_sce, centre = TRUE) > areSizeFactorsCentred(example_sce) [1] TRUE > Running examples in arrange.Rd ------------------------------------------------------------------------------------------------------------------ > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), + colData = sc_example_cell_info) > example_sce <- arrange(example_sce, Cell_Cycle) > Running examples in bootstraps.Rd --------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > bootstraps(example_sce) List of length 0 names(0): > Running examples in calcAverage.Rd -------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > > ## calculate average counts > ave_counts <- calcAverage(example_sce) > Running examples in calcIsExprs.Rd -------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > assay(example_sce, "is_exprs") <- calcIsExprs(example_sce, + lowerDetectionLimit = 1, exprs_values = "counts") Running examples in calculateCPM.Rd ------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > cpm(example_sce) <- calculateCPM(example_sce, use.size.factors = FALSE) > Running examples in calculateFPKM.Rd ------------------------------------------------------------------------------------------------------------ > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > effective_length <- rep(1000, 2000) > fpkm(example_sce) <- calculateFPKM(example_sce, effective_length, + use.size.factors = FALSE) > Running examples in calculateQCMetrics.Rd ------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), + colData = sc_example_cell_info) > example_sce <- calculateQCMetrics(example_sce) > > ## with a set of feature controls defined > example_sce <- calculateQCMetrics(example_sce, + feature_controls = list(set1 = 1:40)) > > ## with a named set of feature controls defined > example_sce <- calculateQCMetrics(example_sce, + feature_controls = list(ERCC = 1:40)) > Running examples in calculateTPM.Rd ------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > tpm(example_sce) <- calculateTPM(example_sce, effective_length = 5e04, + calc_from = "counts") > > ## calculate from FPKM > fpkm(example_sce) <- calculateFPKM(example_sce, effective_length = 5e04, + use.size.factors = FALSE) > tpm(example_sce) <- calculateTPM(example_sce, effective_length = 5e04, + calc_from = "fpkm") Running examples in filter.Rd ------------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), + colData = sc_example_cell_info) > example_sce_treat1 <- filter(example_sce, Treatment == "treat1") > Running examples in findImportantPCs.Rd --------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > exprs(example_sce) <- log2( + calculateCPM(example_sce, use.size.factors = FALSE) + 1) > drop_genes <- apply(exprs(example_sce), 1, function(x) {var(x) == 0}) > example_sce <- example_sce[!drop_genes, ] > example_sce <- calculateQCMetrics(example_sce) > findImportantPCs(example_sce, variable="total_features") > Running examples in fromCellDataSet.Rd ---------------------------------------------------------------------------------------------------------- > > > # # DONTRUN > # "Deprecated" NA Running examples in getBMFeatureAnnos.Rd -------------------------------------------------------------------------------------------------------- > > > # # DONTRUN > # > # object <- getBMFeatureAnnos(object) > # > NA Running examples in isOutlier.Rd ---------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > example_sce <- calculateQCMetrics(example_sce) > > ## with a set of feature controls defined > example_sce <- calculateQCMetrics(example_sce, + feature_controls = list(set1 = 1:40)) > isOutlier(example_sce$total_counts, nmads = 3) [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE [24] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > Running examples in multiplot.Rd ---------------------------------------------------------------------------------------------------------------- > > library(ggplot2) > ## This example uses the ChickWeight dataset, which comes with ggplot2 > ## First plot > p1 <- ggplot(ChickWeight, aes(x = Time, y = weight, colour = Diet, group = Chick)) + + geom_line() + + ggtitle("Growth curve for individual chicks") > ## Second plot > p2 <- ggplot(ChickWeight, aes(x = Time, y = weight, colour = Diet)) + + geom_point(alpha = .3) + + geom_smooth(alpha = .2, size = 1) + + ggtitle("Fitted growth curve per diet") > ## Third plot > p3 <- ggplot(subset(ChickWeight, Time == 21), aes(x = weight, colour = Diet)) + + geom_density() + + ggtitle("Final weight, by diet") > ## Fourth plot > p4 <- ggplot(subset(ChickWeight, Time == 21), aes(x = weight, fill = Diet)) + + geom_histogram(colour = "black", binwidth = 50) + + facet_grid(Diet ~ .) + + ggtitle("Final weight, by diet") + + theme(legend.position = "none") # No legend (redundant in this graph) > ## Combine plots and display > multiplot(p1, p2, p3, p4, cols = 2) `geom_smooth()` using method = 'loess' > Running examples in mutate.Rd ------------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), + colData = sc_example_cell_info) > example_sce <- mutate(example_sce, is_quiescent = Cell_Cycle == "G0") Running examples in nexprs.Rd ------------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > nexprs(example_sce)[1:10] [1] 881 624 730 728 667 646 829 806 708 814 > nexprs(example_sce, byrow = TRUE)[1:10] [1] 17 27 13 21 13 16 15 9 13 26 > Running examples in normaliseExprs.Rd ----------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > keep_gene <- rowSums(counts(example_sce)) > 0 > example_sce <- example_sce[keep_gene,] > > ## Apply TMM normalisation taking into account all genes > example_sce <- normaliseExprs(example_sce, method = "TMM") > ## Scale counts relative to a set of control features (here the first 100 features) > example_sce <- normaliseExprs(example_sce, method = "none", + feature_set = 1:100) > Running examples in normalize.Rd ---------------------------------------------------------------------------------------------------------------- > > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > keep_gene <- rowSums(counts(example_sce)) > 0 > example_sce <- example_sce[keep_gene,] > > ## Apply TMM normalisation taking into account all genes > example_sce <- normaliseExprs(example_sce, method = "TMM") > ## Scale counts relative to a set of control features (here the first 100 features) > example_sce <- normaliseExprs(example_sce, method = "none", + feature_set = 1:100) > > ## normalize the object using the saved size factors > example_sce <- normalize(example_sce) > Running examples in plot.Rd --------------------------------------------------------------------------------------------------------------------- > > ## Set up an example SingleCellExperiment > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > > plot(example_sce) > plot(example_sce, exprs_values = "counts", colour_by = "Cell_Cycle") > plot(example_sce, block1 = "Treatment", colour_by = "Cell_Cycle") > > cpm(example_sce) <- calculateCPM(example_sce, use.size.factors = FALSE) > plot(example_sce, exprs_values = "cpm", block1 = "Treatment", + block2 = "Mutation_Status", colour_by = "Cell_Cycle") > # Error is thrown if chosen expression values are not available > Running examples in plotDiffusionMap.Rd --------------------------------------------------------------------------------------------------------- > > ## Set up an example SingleCellExperiment > data("sc_example_counts") > data("sc_example_cell_info") > example_sce <- SingleCellExperiment( + assays = list(counts = sc_example_counts), colData = sc_example_cell_info) > exprs(example_sce) <- log2( + calculateCPM(example_sce, use.size.factors = FALSE) + 1) > drop_genes <- apply(exprs(example_sce), 1, function(x) {var(x) == 0}) > example_sce <- example_sce[!drop_genes, ] > > ## Examples plotting diffusion maps > plotDiffusionMap(example_sce) Error in .C(Cname, t(data), as.integer(k), d, n, nn.index = integer(n * : "get_KNN_cover" not resolved from current namespace (FNN) In addition: Warning message: In setup_ns_exports(pkg, export_all) : Objects listed as exports, but not present in namespace: plot Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ > devtools::test() Loading scater Creating a new generic function for ‘mutate’ in package ‘scater’ Creating a new generic function for ‘filter’ in package ‘scater’ Testing scater test calculation of TPM and FPKM: ................ tests on inputs: . test manipulations: .... test feature pre-processing functions: Collapsing expression to 500 features..Collapsing expression to 500 features..Collapsing expression to 500 features....Collapsing expression to 500 features..Collapsing expression to 500 features.. test improper input usage: Kallisto log not provided - assuming all runs successful. test expected usage: ........... test plot, plotPCA, plotTSNE and plotDiffusionMap: ........1.. test plotExpression: ...................... test controls functionality: .......................... ....test expected usage: Collapsing expression to 500 features... test improper input usage: Kallisto log not provided - assuming all runs successful. ............. Failed ------------------------------------------------------------------------------------------------------------------------------------------- 1. Error: we can produce Diffusion Map plots with different expression values (@test-plotting.R#76) ---------------------------------------------- "get_KNN_cover" not resolved from current namespace (FNN) 1: expect_that(plotDiffusionMap(example_sce), is_a("ggplot")) at /Users/davis/Dropbox/Projects/scater/tests/testthat/test-plotting.R:76 2: condition(object) 3: expect_is(x, class) 4: klass(object) 5: paste(class(x), collapse = "/") 6: plotDiffusionMap(example_sce) 7: runDiffusionMap(object, ncomponents = ncomponents, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:968 8: destiny::DiffusionMap(vals, sigma = sigma, distance = distance, ...) at /Users/davis/Dropbox/Projects/scater/R/plotting.R:881 9: find_knn(imputed_data, dists, k, verbose) 10: verbose_timing(verbose, "finding knns", get.knn(imputed_data, k, algorithm = "cover_tree")) 11: get.knn(imputed_data, k, algorithm = "cover_tree") DONE ============================================================================================================================================= > sessionInfo() R version 3.4.1 (2017-06-30) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Sierra 10.12.6 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets methods base other attached packages: [1] scater_1.5.2 bindrcpp_0.2 SingleCellExperiment_0.99.1 SummarizedExperiment_1.7.5 DelayedArray_0.3.19 [6] matrixStats_0.52.2 GenomicRanges_1.29.12 GenomeInfoDb_1.13.4 IRanges_2.11.12 S4Vectors_0.15.5 [11] ggplot2_2.2.1 Biobase_2.37.2 BiocGenerics_0.23.0 testthat_1.0.2 loaded via a namespace (and not attached): [1] backports_1.1.0 Hmisc_4.0-3 RcppEigen_0.3.3.3.0 plyr_1.8.4 igraph_1.1.2 [6] lazyeval_0.2.0 sp_1.2-5 shinydashboard_0.6.1 splines_3.4.1 digest_0.6.12 [11] htmltools_0.3.6 viridis_0.4.0 magrittr_1.5 checkmate_1.8.3 memoise_1.1.0 [16] cluster_2.0.6 limma_3.33.7 xts_0.10-0 prettyunits_1.0.2 colorspace_1.3-2 [21] blob_1.1.0 dplyr_0.7.2 crayon_1.3.2 RCurl_1.95-4.8 tximport_1.5.0 [26] roxygen2_6.0.1 lme4_1.1-13 bindr_0.1 survival_2.41-3 zoo_1.8-0 [31] glue_1.1.1 gtable_0.2.0 zlibbioc_1.23.0 XVector_0.17.0 MatrixModels_0.4-1 [36] car_2.1-5 DEoptimR_1.0-8 SparseM_1.77 VIM_4.7.0 scales_0.4.1 [41] DBI_0.7 edgeR_3.19.3 Rcpp_0.12.12 viridisLite_0.2.0 xtable_1.8-2 [46] progress_1.1.2 laeken_0.4.6 htmlTable_1.9 foreign_0.8-69 bit_1.1-12 [51] proxy_0.4-17 Formula_1.2-2 vcd_1.4-3 htmlwidgets_0.9 FNN_1.1 [56] RColorBrewer_1.1-2 acepack_1.4.1 pkgconfig_2.0.1 XML_3.98-1.9 nnet_7.3-12 [61] locfit_1.5-9.1 labeling_0.3 rlang_0.1.2 reshape2_1.4.2 AnnotationDbi_1.39.2 [66] munsell_0.4.3 tools_3.4.1 RSQLite_2.0 devtools_1.13.3 evaluate_0.10.1 [71] stringr_1.2.0 knitr_1.17 bit64_0.9-7 robustbase_0.92-7 nlme_3.1-131 [76] mime_0.5 quantreg_5.33 xml2_1.1.1 biomaRt_2.33.4 compiler_3.4.1 [81] pbkrtest_0.4-7 beeswarm_0.2.3 curl_2.8.1 e1071_1.6-8 smoother_1.1 [86] tibble_1.3.3 stringi_1.1.5 desc_1.1.1 lattice_0.20-35 Matrix_1.2-11 [91] commonmark_1.2 nloptr_1.0.4 lmtest_0.9-35 data.table_1.10.4 cowplot_0.8.0 [96] bitops_1.0-6 httpuv_1.3.5 R6_2.2.2 latticeExtra_0.6-28 gridExtra_2.2.1 [101] vipor_0.4.5 boot_1.3-20 MASS_7.3-47 assertthat_0.2.0 destiny_2.5.6 [106] rhdf5_2.21.3 rprojroot_1.2 rjson_0.2.15 withr_2.0.0 GenomeInfoDbData_0.99.1 [111] mgcv_1.8-18 grid_3.4.1 rpart_4.1-11 class_7.3-14 minqa_1.2.4 [116] Rtsne_0.13 TTR_0.23-2 shiny_1.0.4 base64enc_0.1-3 ggbeeswarm_0.6.0 ```
flying-sheep commented 7 years ago

hi davis, nice to hear from you!

i’ll check if i can reproduce that. in the meantime:

this is probably where the error happens. as you can see, it’s normal that FNN::get_KNN_cover doesn’t exist as an R symbol, as it’s a C function called via .C.

a shot in the dark: recently Rcpp started creating code for registering native routines, since R 3.4 has now this. maybe the newest version of FNN does R_useDynamicSymbols(false) but doesn’t register that function?

could you please check the output of: getCallingDLLe(getNamespace('FNN'))?

but in any case, it’s a bug in FNN, and should probably be reported there.

flying-sheep commented 7 years ago

Hi Davis, I’ve removed FNN from destiny for unrelated reasons, but this should solve the problem 😉