diff --git a/R/SCP-plot.R b/R/SCP-plot.R index e3d82e4d..b47b7007 100644 --- a/R/SCP-plot.R +++ b/R/SCP-plot.R @@ -2763,12 +2763,13 @@ FeatureDimPlot <- function(srt, features, reduction = NULL, dims = c(1, 2), spli #' Plotting cell points on a reduced 3D space and coloring according to the groups of the cells. #' #' @inheritParams CellDimPlot +#' @param dims Dimensions to plot, must be a three-length numeric vector specifying x-, y- and z-dimensions #' @param axis_labs A character vector of length 3 indicating the labels for the axes. #' @param span A numeric value specifying the span of the loess smoother for lineages line. #' @param shape.highlight Shape of the cell to highlight. See \href{https://plotly.com/r/reference/scattergl/#scattergl-marker-symbol}{scattergl-marker-symbol} #' @param width Width in pixels, defaults to automatic sizing. #' @param height Height in pixels, defaults to automatic sizing. -#' @param save The name of the file to save the plot to. Must end in .html. +#' @param save The name of the file to save the plot to. Must end in ".html". #' @seealso \code{\link{CellDimPlot}} \code{\link{FeatureDimPlot3D}} #' #' @examples @@ -2778,6 +2779,7 @@ FeatureDimPlot <- function(srt, features, reduction = NULL, dims = c(1, 2), spli #' #' pancreas_sub <- RunSlingshot(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D") #' CellDimPlot3D(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D", lineages = "Lineage1") +#' #' @importFrom Seurat Reductions Embeddings Key #' @importFrom utils askYesNo #' @importFrom plotly plot_ly add_trace layout as_widget @@ -2857,9 +2859,6 @@ CellDimPlot3D <- function(srt, group.by, reduction = NULL, dims = c(1, 2, 3), ax dat_lineages <- srt@meta.data[, unique(lineages), drop = FALSE] dat_use <- cbind(dat_use, dat_lineages[row.names(dat_use), , drop = FALSE]) } - if (!is.factor(dat_use[[group.by]])) { - dat_use[[group.by]] <- factor(dat_use[[group.by]], levels = unique(dat_use[[group.by]])) - } dat_use[["group.by"]] <- dat_use[[group.by]] if (any(is.na(dat_use[[group.by]]))) { n <- as.character(dat_use[[group.by]]) diff --git a/R/SCP-workflow.R b/R/SCP-workflow.R index c90761f9..38ed6087 100644 --- a/R/SCP-workflow.R +++ b/R/SCP-workflow.R @@ -838,7 +838,8 @@ RunDimReduction <- function(srt, prefix = "", features = NULL, assay = NULL, slo srt@misc[["Default_reduction"]] <- paste0(prefix, linear_reduction) return(srt) } else { - message("assay.used is ", srt[[linear_reduction]]@assay.used, ", which is not the same as the ", assay, " specified. Recalculate the linear reduction") + message("assay.used is ", srt[[linear_reduction]]@assay.used, ", which is not the same as the ", assay, " specified. Recalculate the linear reduction(pca)") + linear_reduction <- "pca" } } } @@ -933,7 +934,8 @@ RunDimReduction <- function(srt, prefix = "", features = NULL, assay = NULL, slo srt@misc[["Default_reduction"]] <- paste0(prefix, nonlinear_reduction) return(srt) } else { - message("assay.used is ", srt[[nonlinear_reduction]]@assay.used, ", which is not the same as the ", assay, " specified. Recalculate the linear reduction") + message("assay.used is ", srt[[nonlinear_reduction]]@assay.used, ", which is not the same as the ", assay, " specified. Recalculate the nonlinear reduction(umap)") + nonlinear_reduction <- "umap" } } } @@ -1031,7 +1033,7 @@ DefaultReduction <- function(srt, pattern = NULL, min_dim = 2, max_distance = 0. if (length(srt@reductions) == 0) { stop("Unable to find any reductions.") } - pattern_default <- c("umap", "tsne", "dm", "phate", "pacmap", "trimap", "largevis", "pca", "svd", "ica", "nmf", "mds", "glmpca") + pattern_default <- c("umap", "tsne", "dm", "phate", "pacmap", "trimap", "largevis", "fr", "pca", "svd", "ica", "nmf", "mds", "glmpca") pattern_dim <- c("2D", "3D") reduc_all <- names(srt@reductions) reduc_all <- reduc_all[unlist(lapply(reduc_all, function(x) { @@ -3204,11 +3206,11 @@ Conos_integrate <- function(srtMerge = NULL, batch = NULL, append = TRUE, srtLis } cat(paste0("[", Sys.time(), "]", " Perform linear dimension reduction (", linear_reduction, ") on the data ", i, " ...\n")) srt <- RunDimReduction( - srt = srt, prefix = "", features = HVF, assay = DefaultAssay(srt), + srt = srt, prefix = "Conos", features = HVF, assay = DefaultAssay(srt), linear_reduction = linear_reduction, linear_reduction_dims = linear_reduction_dims, linear_reduction_params = linear_reduction_params, force_linear_reduction = force_linear_reduction, verbose = FALSE, seed = seed ) - srt[["pca"]] <- srt[[linear_reduction]] + srt[["pca"]] <- srt[[paste0("Conos", linear_reduction)]] srtList[[i]] <- srt } if (is.null(names(srtList))) { @@ -3216,13 +3218,13 @@ Conos_integrate <- function(srtMerge = NULL, batch = NULL, append = TRUE, srtLis } if (is.null(linear_reduction_dims_use)) { - maxdims <- max(unlist(sapply(srtList, function(srt) max(srt@reductions[[paste0("", linear_reduction)]]@misc[["dims_estimate"]])))) + maxdims <- max(unlist(sapply(srtList, function(srt) max(srt@reductions[[paste0("Conos", linear_reduction)]]@misc[["dims_estimate"]])))) } else { maxdims <- max(linear_reduction_dims_use) } cat(paste0("[", Sys.time(), "]", " Perform integration(Conos) on the data...\n")) - message("Conos using ", linear_reduction, "(dims_max:", maxdims, ") as input") + message("Conos integration using Reduction(", linear_reduction, ", dims_max:", maxdims, ") as input") srtList_con <- conos::Conos$new(srtList, n.cores = num_threads) params <- list( ncomps = maxdims, @@ -3739,14 +3741,18 @@ Standard_SCP <- function(srt, prefix = "Standard", assay = NULL, #' for (method in integration_methods) { #' panc8_sub <- Integration_SCP( #' srtMerge = panc8_sub, batch = "tech", -#' integration_method = method, linear_reduction_dims_use = 1:50, nonlinear_reduction = "umap" +#' integration_method = method, +#' linear_reduction_dims_use = 1:50, +#' nonlinear_reduction = "umap" #' ) #' print(CellDimPlot(panc8_sub, group.by = c("tech", "celltype"), reduction = paste0(method, "UMAP2D"), theme_use = "theme_blank")) #' } #' #' nonlinear_reductions <- c("umap", "tsne", "dm", "phate", "pacmap", "trimap", "largevis", "fr") #' panc8_sub <- Integration_SCP( -#' srtMerge = panc8_sub, batch = "tech", integration_method = "Seurat", +#' srtMerge = panc8_sub, batch = "tech", +#' integration_method = "Seurat", +#' linear_reduction_dims_use = 1:50, #' nonlinear_reduction = nonlinear_reductions #' ) #' for (nr in nonlinear_reductions) { diff --git a/R/Seurat-function.R b/R/Seurat-function.R index 0b03fd57..4ea2a9de 100644 --- a/R/Seurat-function.R +++ b/R/Seurat-function.R @@ -117,7 +117,7 @@ RunNMF.default <- function(object, assay = NULL, slot = "data", nbes = 50, } nbes <- min(nbes, nrow(x = object) - 1) if (nmf.method == "RcppML") { - check_R("zdebruine/RcppML@0.5.6") + check_R("zdebruine/RcppML") options("RcppML.verbose" = FALSE) options("RcppML.threads" = 0) nmf.results <- RcppML::nmf( @@ -1602,7 +1602,7 @@ RunLargeVis.Seurat <- function(object, reduction = "pca", dims = NULL, features search_k = search_k, n_threads = n_threads, n_sgd_threads = n_sgd_threads, grain_size = grain_size, kernel = kernel, pca = pca, pca_center = pca_center, pcg_rand = pcg_rand, fast_sgd = fast_sgd, batch = batch, opt_args = opt_args, epoch_callback = epoch_callback, pca_method = pca_method, - reduction.key = reduction.key, verbose = verbose, seed.use = seed.use, ... + reduction.key = reduction.key, verbose = verbose, seed.use = seed.use ) object <- LogSeuratCommand(object = object) return(object) diff --git a/R/utils.R b/R/utils.R index e51f8408..bf559893 100644 --- a/R/utils.R +++ b/R/utils.R @@ -9,7 +9,6 @@ #' If a conda environment with the specified name already exists and \code{force} is set to \code{FALSE}, the function will use the existing environment. If \code{force} set to \code{TRUE}, the existing environment will be recreated. Note that recreating the environment will remove any existing data in the environment. #' The function also checks if the package versions in the environment meet the requirements specified by the \code{version} parameter. The default is \code{3.8-1}. #' -#' #' @export PrepareEnv <- function(conda = "auto", miniconda_repo = "https://repo.anaconda.com/miniconda", envname = NULL, version = "3.8-1", force = FALSE, ...) { @@ -142,8 +141,8 @@ PrepareEnv <- function(conda = "auto", miniconda_repo = "https://repo.anaconda.c #' Env_requirements("3.8-1") #' #' @export -Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3.11-1")) { - version <- match.arg(version) +Env_requirements <- function(version = "3.8-1") { + version <- match.arg(version, choices = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3.11-1")) requirements <- switch(version, "3.8-1" = list( python = "3.8", @@ -159,7 +158,10 @@ Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3 "scikit-learn" = "scikit-learn==1.1.2", "scipy" = "scipy==1.10.1", "scvelo" = "scvelo==0.2.5", - "wot" = "wot==1.0.8.post2" + "wot" = "wot==1.0.8.post2", + "trimap" = "trimap==1.1.4", + "pacmap" = "pacmap==0.7.0", + "phate" = "phate==1.0.11" # "tables" = "git+https://github.com/PyTables/PyTables", # Fixed: PyTables install fails on macOS M1 ) ), @@ -168,7 +170,7 @@ Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3 packages = c( "leidenalg" = "leidenalg==0.10.1", "matplotlib" = "matplotlib==3.7.3", - "numba" = "numba==0.58.0", + "numba" = "numba==0.58.1", "numpy" = "numpy==1.24.4", "palantir" = "palantir==1.3.0", "pandas" = "pandas==1.5.3", @@ -185,7 +187,7 @@ Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3 packages = c( "leidenalg" = "leidenalg==0.10.1", "matplotlib" = "matplotlib==3.8.0", - "numba" = "numba==0.58.0", + "numba" = "numba==0.58.1", "numpy" = "numpy==1.25.2", "palantir" = "palantir==1.3.0", "pandas" = "pandas==1.5.3", @@ -202,7 +204,7 @@ Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3 packages = c( "leidenalg" = "leidenalg==0.10.1", "matplotlib" = "matplotlib==3.8.0", - "numba" = "numba==0.58.0", + "numba" = "numba==0.58.1", "numpy" = "numpy==1.25.2", "palantir" = "palantir==1.3.0", "pandas" = "pandas==1.5.3", @@ -219,7 +221,7 @@ Env_requirements <- function(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3 packages = c( "leidenalg" = "leidenalg==0.10.1", "matplotlib" = "matplotlib==3.8.0", - "numba" = "numba==0.58.0", + "numba" = "numba==0.58.1", "numpy" = "numpy==1.25.2", "palantir" = "palantir==1.3.0", "pandas" = "pandas==1.5.3", @@ -519,8 +521,7 @@ check_Python <- function(packages, envname = NULL, conda = "auto", force = FALSE #' Check and install R packages #' -#' @param packages Package to be installed. Package source can be CRAN, Bioconductor or Github, e.g. scmap, davidsjoberg/ggsankey. -#' @param package_names The name of the package that corresponds to the \code{packages} parameter, used to check if the package is already installed. +#' @param packages Package to be installed. Package source can be CRAN, Bioconductor or Github, e.g. scmap, quadbiolab/simspec. #' By default, the package name is extracted according to the \code{packages} parameter. #' @param install_methods Functions used to install R packages. #' @param lib The location of the library directories where to install the packages. @@ -528,31 +529,11 @@ check_Python <- function(packages, envname = NULL, conda = "auto", force = FALSE #' #' @importFrom utils packageVersion #' @export -check_R <- function(packages, package_names = NULL, install_methods = c("BiocManager::install", "install.packages", "devtools::install_github"), lib = .libPaths()[1], force = FALSE) { - if (length(package_names) != 0 && length(package_names) != length(packages)) { - stop("package_names must be NULL or a vector of the same length with packages") - } +check_R <- function(packages, install_methods = c("BiocManager::install", "install.packages", "devtools::install_github"), lib = .libPaths()[1], force = FALSE) { status_list <- list() - for (n in seq_along(packages)) { - pkg <- packages[n] - pkg_info <- pkg - if (!grepl("/", pkg_info)) { - pkg_info <- paste0("/", pkg_info) - } - if (!grepl("@", pkg_info)) { - pkg_info <- paste0(pkg_info, "@") - } - git <- grep("/", sub(pattern = "(.*/)(.*)(@.*)", replacement = "\\1", x = pkg_info), value = TRUE) - git <- gsub("/", "", git) - pkg_name <- package_names[n] %||% sub(pattern = "(.*/)(.*)(@.*)", replacement = "\\2", x = pkg_info) - version <- grep("@", sub(pattern = "(.*/)(.*)(@.*)", replacement = "\\3", x = pkg_info), value = TRUE) - version <- gsub("@", "", version) - if (version != "") { - force_update <- isTRUE(packageVersion(pkg_name) < package_version(version)) || isTRUE(force) - } else { - force_update <- isTRUE(force) - } - if (!suppressPackageStartupMessages(requireNamespace(pkg_name, quietly = TRUE)) || isTRUE(force_update)) { + for (pkg in packages) { + pkg_name <- sub(pattern = "(.*)/(.*)", replacement = "\\2", x = pkg) + if (!suppressPackageStartupMessages(requireNamespace(pkg_name, quietly = TRUE)) || isTRUE(force)) { message("Install package: \"", pkg_name, "\" ...") status_list[[pkg]] <- FALSE i <- 1 @@ -577,15 +558,7 @@ check_R <- function(packages, package_names = NULL, install_methods = c("BiocMan }, error = function(e) { status_list[[pkg]] <- FALSE }) - if (version == "") { - status_list[[pkg]] <- requireNamespace(pkg_name, quietly = TRUE) - } else { - if (requireNamespace(pkg_name, quietly = TRUE)) { - status_list[[pkg]] <- packageVersion(pkg_name) >= package_version(version) - } else { - status_list[[pkg]] <- FALSE - } - } + status_list[[pkg]] <- requireNamespace(pkg_name, quietly = TRUE) i <- i + 1 if (i > length(install_methods)) { break diff --git a/README.Rmd b/README.Rmd index 6abe7b58..8221f50f 100644 --- a/README.Rmd +++ b/README.Rmd @@ -11,7 +11,7 @@ knitr::opts_chunk$set( results = "hide", message = FALSE, warning = FALSE, - fig.path = "README/README-", + fig.path = "man/figures/", fig.height = 5, fig.width = 10, fig.align = "center", @@ -57,7 +57,7 @@ if (!require("devtools", quietly = TRUE)) { devtools::install_github("zhanghao-njmu/SCP") ``` -#### Create SCP python environment +#### Create a python environment for SCP To run functions such as `RunPAGA` or `RunSCVELO`, SCP requires [conda](https://docs.conda.io/en/latest/miniconda.html) to create a separate python environment. The default environment name is `"SCP_env"`. You can specify the environment name for SCP by setting `options(SCP_env_name="new_name")` @@ -282,13 +282,13 @@ CellDimPlot( CellDimPlot3D(srt = pancreas_sub, group.by = "SubCellType") ``` -![CellDimPlot3D](README/README-CellDimPlot3D-1.png) +![CellDimPlot3D](man/figures/CellDimPlot3D-1.png) ```{r FeatureDimPlot3D,eval=FALSE} FeatureDimPlot3D(srt = pancreas_sub, features = c("Sox9", "Neurog3", "Fev", "Rbp4")) ``` -![FeatureDimPlot3D](README/README-FeatureDimPlot3D-1.png) +![FeatureDimPlot3D](man/figures/FeatureDimPlot3D-1.png) ### Integration pipeline @@ -330,7 +330,7 @@ grob <- gtable_add_grob(grob, legend, t = 1, l = min(grob$layout[grepl(pattern = panel_fix(grob, height = 2) ``` -![Integration-all](README/README-Integration-all.png) +![Integration-all](man/figures/Integration-all.png) ### Cell projection between single-cell datasets @@ -540,10 +540,10 @@ if (interactive()) { } ``` -![SCExplorer1](README/README-SCExplorer-1.png) ![SCExplorer2](README/README-SCExplorer-2.png) +![SCExplorer1](man/figures/SCExplorer-1.png) ![SCExplorer2](man/figures/SCExplorer-2.png) ### Other visualization examples -[**CellDimPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellDimPlot.html)![Example1](README/README-Example-1.jpg) [**CellStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellStatPlot.html)![Example2](README/README-Example-2.jpg) [**FeatureStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/FeatureStatPlot.html)![Example3](README/README-Example-3.jpg) [**GroupHeatmap**](https://zhanghao-njmu.github.io/SCP/reference/GroupHeatmap.html)![Example3](README/README-Example-4.jpg) +[**CellDimPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellDimPlot.html)![Example1](man/figures/Example-1.jpg) [**CellStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellStatPlot.html)![Example2](man/figures/Example-2.jpg) [**FeatureStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/FeatureStatPlot.html)![Example3](man/figures/Example-3.jpg) [**GroupHeatmap**](https://zhanghao-njmu.github.io/SCP/reference/GroupHeatmap.html)![Example3](man/figures/Example-4.jpg) You can also find more examples in the documentation of the function: [Integration_SCP](https://zhanghao-njmu.github.io/SCP/reference/Integration_SCP.html), [RunKNNMap](https://zhanghao-njmu.github.io/SCP/reference/RunKNNMap.html), [RunMonocle3](https://zhanghao-njmu.github.io/SCP/reference/RunMonocle3.html), [RunPalantir](https://zhanghao-njmu.github.io/SCP/reference/RunPalantir.html), etc. diff --git a/README.md b/README.md index fe1e9dd2..e4b1694c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ if (!require("devtools", quietly = TRUE)) { devtools::install_github("zhanghao-njmu/SCP") ``` -#### Create SCP python environment +#### Create a python environment for SCP To run functions such as `RunPAGA` or `RunSCVELO`, SCP requires [conda](https://docs.conda.io/en/latest/miniconda.html) to create a @@ -253,7 +253,7 @@ CellDimPlot( ) ``` - + ``` r CellDimPlot( @@ -262,7 +262,7 @@ CellDimPlot( ) ``` - + ``` r FeatureDimPlot( @@ -271,7 +271,7 @@ FeatureDimPlot( ) ``` - + ``` r FeatureDimPlot( @@ -281,7 +281,7 @@ FeatureDimPlot( ) ``` - + ``` r ht <- GroupHeatmap( @@ -303,7 +303,7 @@ ht <- GroupHeatmap( print(ht$plot) ``` - + ### CellQC @@ -312,13 +312,13 @@ pancreas_sub <- RunCellQC(srt = pancreas_sub) CellDimPlot(srt = pancreas_sub, group.by = "CellQC", reduction = "UMAP") ``` - + ``` r CellStatPlot(srt = pancreas_sub, stat.by = "CellQC", group.by = "CellType", label = TRUE) ``` - + ``` r CellStatPlot( @@ -331,7 +331,7 @@ CellStatPlot( ) ``` - + ### Standard pipeline @@ -343,19 +343,19 @@ CellDimPlot( ) ``` - + ``` r CellDimPlot3D(srt = pancreas_sub, group.by = "SubCellType") ``` -![CellDimPlot3D](README/README-CellDimPlot3D-1.png) +![CellDimPlot3D](man/figures/CellDimPlot3D-1.png) ``` r FeatureDimPlot3D(srt = pancreas_sub, features = c("Sox9", "Neurog3", "Fev", "Rbp4")) ``` -![FeatureDimPlot3D](README/README-FeatureDimPlot3D-1.png) +![FeatureDimPlot3D](man/figures/FeatureDimPlot3D-1.png) ### Integration pipeline @@ -371,11 +371,11 @@ CellDimPlot( ) ``` - + UMAP embeddings based on different integration methods in SCP: -![Integration-all](README/README-Integration-all.png) +![Integration-all](man/figures/Integration-all.png) ### Cell projection between single-cell datasets @@ -392,7 +392,7 @@ ProjectionPlot( ) ``` - + ### Cell annotation using bulk RNA-seq datasets @@ -402,7 +402,7 @@ pancreas_sub <- RunKNNPredict(srt_query = pancreas_sub, bulk_ref = ref_scMCA, fi CellDimPlot(srt = pancreas_sub, group.by = "KNNPredict_classification", reduction = "UMAP", label = TRUE) ``` - + ### Cell annotation using single-cell datasets @@ -414,7 +414,7 @@ pancreas_sub <- RunKNNPredict( CellDimPlot(srt = pancreas_sub, group.by = "KNNPredict_classification", reduction = "UMAP", label = TRUE) ``` - + ``` r @@ -426,7 +426,7 @@ pancreas_sub <- RunKNNPredict( CellDimPlot(srt = pancreas_sub, group.by = "KNNPredict_classification", reduction = "UMAP", label = TRUE) ``` - + ``` r @@ -439,7 +439,7 @@ ht <- CellCorHeatmap( print(ht$plot) ``` - + ### PAGA analysis @@ -451,7 +451,7 @@ pancreas_sub <- RunPAGA( PAGAPlot(srt = pancreas_sub, reduction = "UMAP", label = TRUE, label_insitu = TRUE, label_repel = TRUE) ``` - + ### Velocity analysis @@ -470,13 +470,13 @@ pancreas_sub <- RunSCVELO( VelocityPlot(srt = pancreas_sub, reduction = "UMAP", group_by = "SubCellType") ``` - + ``` r VelocityPlot(srt = pancreas_sub, reduction = "UMAP", plot_type = "stream") ``` - + ### Differential expression analysis @@ -485,7 +485,7 @@ pancreas_sub <- RunDEtest(srt = pancreas_sub, group_by = "CellType", fc.threshol VolcanoPlot(srt = pancreas_sub, group_by = "CellType") ``` - + ``` r DEGs <- pancreas_sub@tools$DEtest_CellType$AllMarkers_wilcox @@ -501,7 +501,7 @@ ht <- FeatureHeatmap( print(ht$plot) ``` - + ### Enrichment analysis(over-representation) @@ -516,7 +516,7 @@ EnrichmentPlot( ) ``` - + ``` r EnrichmentPlot( @@ -525,7 +525,7 @@ EnrichmentPlot( ) ``` - + ``` r EnrichmentPlot( @@ -534,7 +534,7 @@ EnrichmentPlot( ) ``` - + ``` r EnrichmentPlot( @@ -543,7 +543,7 @@ EnrichmentPlot( ) ``` - + > To ensure that labels are visible, you can adjust the size of the > viewer panel on Rstudio IDE. @@ -555,13 +555,13 @@ EnrichmentPlot( ) ``` - + ``` r EnrichmentPlot(srt = pancreas_sub, group_by = "CellType", plot_type = "comparison") ``` - + ### Enrichment analysis(GSEA) @@ -573,7 +573,7 @@ pancreas_sub <- RunGSEA( GSEAPlot(srt = pancreas_sub, group_by = "CellType", group_use = "Endocrine", id_use = "GO:0007186") ``` - + ``` r GSEAPlot( @@ -582,13 +582,13 @@ GSEAPlot( ) ``` - + ``` r GSEAPlot(srt = pancreas_sub, group_by = "CellType", plot_type = "comparison") ``` - + ### Trajectory inference @@ -596,19 +596,19 @@ GSEAPlot(srt = pancreas_sub, group_by = "CellType", plot_type = "comparison") pancreas_sub <- RunSlingshot(srt = pancreas_sub, group.by = "SubCellType", reduction = "UMAP") ``` - + ``` r FeatureDimPlot(pancreas_sub, features = paste0("Lineage", 1:3), reduction = "UMAP", theme_use = "theme_blank") ``` - + ``` r CellDimPlot(pancreas_sub, group.by = "SubCellType", reduction = "UMAP", lineages = paste0("Lineage", 1:3), lineages_span = 0.1) ``` - + ### Dynamic features @@ -627,7 +627,7 @@ ht <- DynamicHeatmap( print(ht$plot) ``` - + ``` r DynamicPlot( @@ -637,7 +637,7 @@ DynamicPlot( ) ``` - + ``` r FeatureStatPlot( @@ -651,7 +651,7 @@ FeatureStatPlot( ) ``` - + ### Interactive data visualization with SCExplorer @@ -665,15 +665,15 @@ if (interactive()) { } ``` -![SCExplorer1](README/README-SCExplorer-1.png) -![SCExplorer2](README/README-SCExplorer-2.png) +![SCExplorer1](man/figures/SCExplorer-1.png) +![SCExplorer2](man/figures/SCExplorer-2.png) ### Other visualization examples -[**CellDimPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellDimPlot.html)![Example1](README/README-Example-1.jpg) -[**CellStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellStatPlot.html)![Example2](README/README-Example-2.jpg) -[**FeatureStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/FeatureStatPlot.html)![Example3](README/README-Example-3.jpg) -[**GroupHeatmap**](https://zhanghao-njmu.github.io/SCP/reference/GroupHeatmap.html)![Example3](README/README-Example-4.jpg) +[**CellDimPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellDimPlot.html)![Example1](man/figures/Example-1.jpg) +[**CellStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/CellStatPlot.html)![Example2](man/figures/Example-2.jpg) +[**FeatureStatPlot**](https://zhanghao-njmu.github.io/SCP/reference/FeatureStatPlot.html)![Example3](man/figures/Example-3.jpg) +[**GroupHeatmap**](https://zhanghao-njmu.github.io/SCP/reference/GroupHeatmap.html)![Example3](man/figures/Example-4.jpg) You can also find more examples in the documentation of the function: [Integration_SCP](https://zhanghao-njmu.github.io/SCP/reference/Integration_SCP.html), diff --git a/inst/python/__pycache__/SCP_analysis.cpython-38.pyc b/inst/python/__pycache__/SCP_analysis.cpython-38.pyc index bd20026c..c569e89c 100644 Binary files a/inst/python/__pycache__/SCP_analysis.cpython-38.pyc and b/inst/python/__pycache__/SCP_analysis.cpython-38.pyc differ diff --git a/man/CellDimPlot3D.Rd b/man/CellDimPlot3D.Rd index ec567841..ea32abe3 100644 --- a/man/CellDimPlot3D.Rd +++ b/man/CellDimPlot3D.Rd @@ -34,7 +34,7 @@ CellDimPlot3D( \item{reduction}{Which dimensionality reduction to use. If not specified, will use the reduction returned by \code{\link{DefaultReduction}}.} -\item{dims}{Dimensions to plot, must be a two-length numeric vector specifying x- and y-dimensions} +\item{dims}{Dimensions to plot, must be a three-length numeric vector specifying x-, y- and z-dimensions} \item{axis_labs}{A character vector of length 3 indicating the labels for the axes.} @@ -64,7 +64,7 @@ CellDimPlot3D( \item{height}{Height in pixels, defaults to automatic sizing.} -\item{save}{The name of the file to save the plot to. Must end in .html.} +\item{save}{The name of the file to save the plot to. Must end in ".html".} \item{force}{Whether to force drawing regardless of maximum levels in any cell group is greater than 100.} } @@ -78,6 +78,7 @@ CellDimPlot3D(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUM pancreas_sub <- RunSlingshot(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D") CellDimPlot3D(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D", lineages = "Lineage1") + } \seealso{ \code{\link{CellDimPlot}} \code{\link{FeatureDimPlot3D}} diff --git a/man/Env_requirements.Rd b/man/Env_requirements.Rd index 5b90e9e0..eb4d7b2f 100644 --- a/man/Env_requirements.Rd +++ b/man/Env_requirements.Rd @@ -4,7 +4,7 @@ \alias{Env_requirements} \title{Env_requirements function} \usage{ -Env_requirements(version = c("3.8-1", "3.8-2", "3.9-1", "3.10-1", "3.11-1")) +Env_requirements(version = "3.8-1") } \arguments{ \item{version}{A character vector specifying the version of the environment (default is "3.8-1").} diff --git a/man/FeatureDimPlot3D.Rd b/man/FeatureDimPlot3D.Rd index 829e4cad..eb934425 100644 --- a/man/FeatureDimPlot3D.Rd +++ b/man/FeatureDimPlot3D.Rd @@ -58,7 +58,7 @@ FeatureDimPlot3D( \item{height}{Height in pixels, defaults to automatic sizing.} -\item{save}{The name of the file to save the plot to. Must end in .html.} +\item{save}{The name of the file to save the plot to. Must end in ".html".} \item{force}{Whether to force drawing regardless of the number of features greater than 100.} } diff --git a/man/Integration_SCP.Rd b/man/Integration_SCP.Rd index adb53f82..3663c338 100644 --- a/man/Integration_SCP.Rd +++ b/man/Integration_SCP.Rd @@ -129,14 +129,18 @@ integration_methods <- c("Uncorrected", "Seurat", "scVI", "MNN", "fastMNN", "Har for (method in integration_methods) { panc8_sub <- Integration_SCP( srtMerge = panc8_sub, batch = "tech", - integration_method = method, linear_reduction_dims_use = 1:50, nonlinear_reduction = "umap" + integration_method = method, + linear_reduction_dims_use = 1:50, + nonlinear_reduction = "umap" ) print(CellDimPlot(panc8_sub, group.by = c("tech", "celltype"), reduction = paste0(method, "UMAP2D"), theme_use = "theme_blank")) } nonlinear_reductions <- c("umap", "tsne", "dm", "phate", "pacmap", "trimap", "largevis", "fr") panc8_sub <- Integration_SCP( - srtMerge = panc8_sub, batch = "tech", integration_method = "Seurat", + srtMerge = panc8_sub, batch = "tech", + integration_method = "Seurat", + linear_reduction_dims_use = 1:50, nonlinear_reduction = nonlinear_reductions ) for (nr in nonlinear_reductions) { diff --git a/man/check_R.Rd b/man/check_R.Rd index cb942463..789f94f9 100644 --- a/man/check_R.Rd +++ b/man/check_R.Rd @@ -6,7 +6,6 @@ \usage{ check_R( packages, - package_names = NULL, install_methods = c("BiocManager::install", "install.packages", "devtools::install_github"), lib = .libPaths()[1], @@ -14,9 +13,7 @@ check_R( ) } \arguments{ -\item{packages}{Package to be installed. Package source can be CRAN, Bioconductor or Github, e.g. scmap, davidsjoberg/ggsankey.} - -\item{package_names}{The name of the package that corresponds to the \code{packages} parameter, used to check if the package is already installed. +\item{packages}{Package to be installed. Package source can be CRAN, Bioconductor or Github, e.g. scmap, quadbiolab/simspec. By default, the package name is extracted according to the \code{packages} parameter.} \item{install_methods}{Functions used to install R packages.} diff --git a/README/README-CellDimPlot3D-1.png b/man/figures/CellDimPlot3D-1.png similarity index 100% rename from README/README-CellDimPlot3D-1.png rename to man/figures/CellDimPlot3D-1.png diff --git a/README/README-DynamicHeatmap-1.png b/man/figures/DynamicHeatmap-1.png similarity index 100% rename from README/README-DynamicHeatmap-1.png rename to man/figures/DynamicHeatmap-1.png diff --git a/README/README-DynamicPlot-1.png b/man/figures/DynamicPlot-1.png similarity index 100% rename from README/README-DynamicPlot-1.png rename to man/figures/DynamicPlot-1.png diff --git a/README/README-EDA-1.png b/man/figures/EDA-1.png similarity index 100% rename from README/README-EDA-1.png rename to man/figures/EDA-1.png diff --git a/README/README-EDA-2.png b/man/figures/EDA-2.png similarity index 100% rename from README/README-EDA-2.png rename to man/figures/EDA-2.png diff --git a/README/README-EDA-3.png b/man/figures/EDA-3.png similarity index 100% rename from README/README-EDA-3.png rename to man/figures/EDA-3.png diff --git a/README/README-EDA-4.png b/man/figures/EDA-4.png similarity index 100% rename from README/README-EDA-4.png rename to man/figures/EDA-4.png diff --git a/README/README-EDA-5.png b/man/figures/EDA-5.png similarity index 100% rename from README/README-EDA-5.png rename to man/figures/EDA-5.png diff --git a/README/README-Enrichment_comparison-1.png b/man/figures/Enrichment_comparison-1.png similarity index 100% rename from README/README-Enrichment_comparison-1.png rename to man/figures/Enrichment_comparison-1.png diff --git a/README/README-Enrichment_enrichmap-1.png b/man/figures/Enrichment_enrichmap-1.png similarity index 100% rename from README/README-Enrichment_enrichmap-1.png rename to man/figures/Enrichment_enrichmap-1.png diff --git a/README/README-Example-1.jpg b/man/figures/Example-1.jpg similarity index 100% rename from README/README-Example-1.jpg rename to man/figures/Example-1.jpg diff --git a/README/README-Example-2.jpg b/man/figures/Example-2.jpg similarity index 100% rename from README/README-Example-2.jpg rename to man/figures/Example-2.jpg diff --git a/README/README-Example-3.jpg b/man/figures/Example-3.jpg similarity index 100% rename from README/README-Example-3.jpg rename to man/figures/Example-3.jpg diff --git a/README/README-Example-4.jpg b/man/figures/Example-4.jpg similarity index 100% rename from README/README-Example-4.jpg rename to man/figures/Example-4.jpg diff --git a/README/README-FeatureDimPlot3D-1.png b/man/figures/FeatureDimPlot3D-1.png similarity index 100% rename from README/README-FeatureDimPlot3D-1.png rename to man/figures/FeatureDimPlot3D-1.png diff --git a/README/README-FeatureHeatmap-1.png b/man/figures/FeatureHeatmap-1.png similarity index 100% rename from README/README-FeatureHeatmap-1.png rename to man/figures/FeatureHeatmap-1.png diff --git a/README/README-FeatureStatPlot-1.png b/man/figures/FeatureStatPlot-1.png similarity index 100% rename from README/README-FeatureStatPlot-1.png rename to man/figures/FeatureStatPlot-1.png diff --git a/README/README-GSEA_bar-1.png b/man/figures/GSEA_bar-1.png similarity index 100% rename from README/README-GSEA_bar-1.png rename to man/figures/GSEA_bar-1.png diff --git a/README/README-GSEA_comparison-1.png b/man/figures/GSEA_comparison-1.png similarity index 100% rename from README/README-GSEA_comparison-1.png rename to man/figures/GSEA_comparison-1.png diff --git a/README/README-Integration-all.png b/man/figures/Integration-all.png similarity index 100% rename from README/README-Integration-all.png rename to man/figures/Integration-all.png diff --git a/README/README-Integration_SCP-1.png b/man/figures/Integration_SCP-1.png similarity index 100% rename from README/README-Integration_SCP-1.png rename to man/figures/Integration_SCP-1.png diff --git a/README/README-RunCellQC-1.png b/man/figures/RunCellQC-1.png similarity index 100% rename from README/README-RunCellQC-1.png rename to man/figures/RunCellQC-1.png diff --git a/README/README-RunCellQC-2.png b/man/figures/RunCellQC-2.png similarity index 100% rename from README/README-RunCellQC-2.png rename to man/figures/RunCellQC-2.png diff --git a/README/README-RunCellQC-3.png b/man/figures/RunCellQC-3.png similarity index 100% rename from README/README-RunCellQC-3.png rename to man/figures/RunCellQC-3.png diff --git a/README/README-RunDEtest-1.png b/man/figures/RunDEtest-1.png similarity index 100% rename from README/README-RunDEtest-1.png rename to man/figures/RunDEtest-1.png diff --git a/README/README-RunEnrichment-1.png b/man/figures/RunEnrichment-1.png similarity index 100% rename from README/README-RunEnrichment-1.png rename to man/figures/RunEnrichment-1.png diff --git a/README/README-RunEnrichment-2.png b/man/figures/RunEnrichment-2.png similarity index 100% rename from README/README-RunEnrichment-2.png rename to man/figures/RunEnrichment-2.png diff --git a/README/README-RunEnrichment-3.png b/man/figures/RunEnrichment-3.png similarity index 100% rename from README/README-RunEnrichment-3.png rename to man/figures/RunEnrichment-3.png diff --git a/README/README-RunEnrichment-4.png b/man/figures/RunEnrichment-4.png similarity index 100% rename from README/README-RunEnrichment-4.png rename to man/figures/RunEnrichment-4.png diff --git a/README/README-RunGSEA-1.png b/man/figures/RunGSEA-1.png similarity index 100% rename from README/README-RunGSEA-1.png rename to man/figures/RunGSEA-1.png diff --git a/README/README-RunKNNMap-1.png b/man/figures/RunKNNMap-1.png similarity index 100% rename from README/README-RunKNNMap-1.png rename to man/figures/RunKNNMap-1.png diff --git a/README/README-RunKNNPredict-bulk-1.png b/man/figures/RunKNNPredict-bulk-1.png similarity index 100% rename from README/README-RunKNNPredict-bulk-1.png rename to man/figures/RunKNNPredict-bulk-1.png diff --git a/README/README-RunKNNPredict-scrna-1.png b/man/figures/RunKNNPredict-scrna-1.png similarity index 100% rename from README/README-RunKNNPredict-scrna-1.png rename to man/figures/RunKNNPredict-scrna-1.png diff --git a/README/README-RunKNNPredict-scrna-2.png b/man/figures/RunKNNPredict-scrna-2.png similarity index 100% rename from README/README-RunKNNPredict-scrna-2.png rename to man/figures/RunKNNPredict-scrna-2.png diff --git a/README/README-RunKNNPredict-scrna-3.png b/man/figures/RunKNNPredict-scrna-3.png similarity index 100% rename from README/README-RunKNNPredict-scrna-3.png rename to man/figures/RunKNNPredict-scrna-3.png diff --git a/README/README-RunPAGA-1.png b/man/figures/RunPAGA-1.png similarity index 100% rename from README/README-RunPAGA-1.png rename to man/figures/RunPAGA-1.png diff --git a/README/README-RunSCVELO-1.png b/man/figures/RunSCVELO-1.png similarity index 100% rename from README/README-RunSCVELO-1.png rename to man/figures/RunSCVELO-1.png diff --git a/README/README-RunSCVELO-2.png b/man/figures/RunSCVELO-2.png similarity index 100% rename from README/README-RunSCVELO-2.png rename to man/figures/RunSCVELO-2.png diff --git a/README/README-RunSlingshot-1.png b/man/figures/RunSlingshot-1.png similarity index 100% rename from README/README-RunSlingshot-1.png rename to man/figures/RunSlingshot-1.png diff --git a/README/README-RunSlingshot-2.png b/man/figures/RunSlingshot-2.png similarity index 100% rename from README/README-RunSlingshot-2.png rename to man/figures/RunSlingshot-2.png diff --git a/README/README-RunSlingshot-3.png b/man/figures/RunSlingshot-3.png similarity index 100% rename from README/README-RunSlingshot-3.png rename to man/figures/RunSlingshot-3.png diff --git a/README/README-SCExplorer-1.png b/man/figures/SCExplorer-1.png similarity index 100% rename from README/README-SCExplorer-1.png rename to man/figures/SCExplorer-1.png diff --git a/README/README-SCExplorer-2.png b/man/figures/SCExplorer-2.png similarity index 100% rename from README/README-SCExplorer-2.png rename to man/figures/SCExplorer-2.png diff --git a/README/README-Standard_SCP-1.png b/man/figures/Standard_SCP-1.png similarity index 100% rename from README/README-Standard_SCP-1.png rename to man/figures/Standard_SCP-1.png