diff --git a/R/scvelo.R b/R/scvelo.R index 7213378..85387f8 100644 --- a/R/scvelo.R +++ b/R/scvelo.R @@ -108,7 +108,7 @@ #' containing the velocity vectors for each cell. #' } #' The output will always have number of columns equal to the number of cells supplied in \code{x}, -#' though the number of rows will depend on whether any subsetting (if \code{subset.row} is supplied) +#' though the number of rows will depend on whether any subsetting (if \code{subset.row} is supplied) #' or feature selection (if \code{use.theirs=TRUE}) was performed. #' #' @examples @@ -123,8 +123,8 @@ #' out <- scvelo(list(X=spliced, spliced=spliced, unspliced=unspliced)) #' #' # make scvelo use 10 rather than the default 30 neighbors to compute moments for velocity estimation: -#' out <- scvelo(list(X=spliced, spliced=spliced, unspliced=unspliced), -#' scvelo.params=list(moments=list(n_neighbors=10L))) +#' out <- scvelo(list(X=spliced, spliced=spliced, unspliced=unspliced), +#' scvelo.params=list(moments=list(n_neighbors=10L))) #' #' @references #' Bergen, V., Lange, M., Peidli, S. et al. Generalizing RNA velocity to transient cell states through dynamical modeling. Nat Biotechnol 38, 1408–1414 (2020). \url{https://doi.org/10.1038/s41587-020-0591-3} @@ -175,28 +175,25 @@ NULL X=X, spliced=spliced, unspliced=unspliced, use.theirs=use.theirs, mode=mode, scvelo.params=scvelo.params, - dimred=dimred) + dimred=dimred, testload = c("scvelo", "anndata")) output } -#' @importFrom reticulate import -#' @importFrom DelayedArray is_sparse t -#' @importFrom zellkonverter AnnData2SCE .run_scvelo <- function(X, spliced, unspliced, use.theirs=FALSE, mode='dynamical', scvelo.params=list(), dimred=NULL) { - X <- t(.make_np_friendly(X)) - spliced <- t(.make_np_friendly(spliced)) - unspliced <- t(.make_np_friendly(unspliced)) + X <- t(velociraptor:::.make_np_friendly(X)) + spliced <- t(velociraptor:::.make_np_friendly(spliced)) + unspliced <- t(velociraptor:::.make_np_friendly(unspliced)) - and <- import("anndata") - scv <- import("scvelo") + and <- reticulate::import("anndata") + scv <- reticulate::import("scvelo") adata <- and$AnnData(X, layers=list(spliced=spliced, unspliced=unspliced)) adata$obs_names <- rownames(spliced) adata$var_names <- colnames(spliced) ## A supplied dimred will be used even if use.theirs=TRUE if (!is.null(dimred)) { - dimred <- .make_np_friendly(dimred) + dimred <- velociraptor:::.make_np_friendly(dimred) adata$obsm <- list(X_pca = dimred) } @@ -223,7 +220,7 @@ NULL do.call(scv$tl$velocity_confidence, c(list(data=adata), scvelo.params$velocity_confidence)) - AnnData2SCE(adata) + zellkonverter::AnnData2SCE(adata) } #' @export