From 86d155e4a296dcfc4df9598f6f9a71c06acf98b8 Mon Sep 17 00:00:00 2001 From: nfancy Date: Wed, 21 Feb 2024 12:16:53 +0000 Subject: [PATCH] updated plot_expr_by_numeric_var function --- R/plot_expr_by_numeric_var.r | 3 ++- vignettes/scFlow.Rmd | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/plot_expr_by_numeric_var.r b/R/plot_expr_by_numeric_var.r index 7b52c7e..cb45aa9 100644 --- a/R/plot_expr_by_numeric_var.r +++ b/R/plot_expr_by_numeric_var.r @@ -153,7 +153,8 @@ plot_expr_by_numeric_var <- function(sce, dplyr::tally() %>% tidyr::pivot_wider(names_from = c("is_zero"), values_from = "n") %>% dplyr::mutate(pc_zero = zero/(zero + non_zero), - pc_expressive = non_zero/(zero + non_zero)) + pc_expressive = non_zero/(zero + non_zero)) %>% + dplyr::filter(!is.na(pc_expressive)) pred <- predict(lm(pc_expressive ~ numeric_var, dt), se.fit = TRUE, interval = "confidence") diff --git a/vignettes/scFlow.Rmd b/vignettes/scFlow.Rmd index 2ba1dbc..bdccdeb 100644 --- a/vignettes/scFlow.Rmd +++ b/vignettes/scFlow.Rmd @@ -363,11 +363,11 @@ plot_reduced_dim(sce, feature_dim = "diagnosis", reduced_dim = "UMAP_Liger", alpha = 1, size = 1) ``` -The next step is to cluster all the cells using `cluster_sce` command. +The next step is to cluster all the cells using `cluster_sce` command. Setting both k and resolution parameter will choose `leiden` clustering, setting resolution= NULL will run clustering based of `louvain` clustering. ```{r eval=TRUE, message=FALSE, results='hide'} sce <- cluster_sce(sce, reduction_method = "UMAP_Liger", pca_dims = 5, k = 50, - resolution = NULL) + resolution = 0.0001) ``` We can then plot the clusters:-