Giter Club home page Giter Club logo

scpubr's Introduction

CRAN status R-CMD-check Code Coverage CodeFactor metacran downloads License: GPL v3

SCpubr

This package aims to provide a streamlined way of generating publication ready plots for known Single-Cell visualizations in a "publication ready" format (SCpubr). This is, the aim is to automatically generate plots with the highest quality possible, that can be used right away or with minimal modifications for a research article.

For installation and tutorials consult the reference manual.

Installation

SCpubr can be installed via:

# From CRAN - Official release:
install.packages("SCpubr")

# From GitHub - Latest stable development version:
if(!requireNamespace("devtools", quietly = TRUE)){
  install.packages("devtools") # If not installed.
}

devtools::install_github("enblacar/SCpubr", ref = "v2.0.0-dev-stable")

Updates

SCpubr is an active package currently aiming to improve and add new functionalities.

Keep track of our new updates in the NEWS page!

Citation

To cite SCpubr in your publications, please use:

Blanco-Carmona, E. Generating publication ready visualizations 
for Single Cell transcriptomics using SCpubr. bioRxiv (2022) 
doi:10.1101/2022.02.28.482303.

Contact

[email protected]

scpubr's People

Contributors

enblacar avatar mojaveazure avatar safwat08 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

scpubr's Issues

BUG | FUNCTION NAME | BRIEF DESCRIPTION

Bug:

# Your description of the bug goes here.

Reproducible example:

# Your reproducible example goes here.
# How to make a good one: https://www.r-bloggers.com/2020/10/how-to-make-a-reprex/

Error log:

# Paste the full error log here

SCpubr version:

# Put the version of SCpubr that you are using here.
# Can be checked by: utils::packageVersion("SCpubr")

Session info:

# Include the output of sessionInfo() here.

Chord plots error

Hello, when running through the chord plots in the tutorial, I get an error:

library(tidyverse)
library(magrittr)
library(liana)
library(SCpubr)

liana_path = system.file(package="liana")
testdata = readRDS(file.path(liana_path , "testdata", "input", "testdata.rds"))
liana_test = liana_wrap(testdata)

# Chord diagram of the total significant interactions from each cluster and all the rest.
out = do_LigandReceptorPlot(liana_output=liana_test, top_interactions=25, 
                            compute_ChordDiagrams=TRUE)
out$chord_total_interactions

Returns:

Error in if (link.sort[1]) { : argument is not interpretable as logical
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.3.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] SCpubr_1.1.2.9000 liana_0.1.10      magrittr_2.0.3    forcats_0.5.1
 [5] stringr_1.4.0     dplyr_1.0.9       purrr_0.3.4       readr_2.0.1
 [9] tidyr_1.2.0       tibble_3.1.7      ggplot2_3.3.6     tidyverse_1.3.1

SCpubr suugests rgdal, but rgdal will be archived, as announced months ago, on 16 October

Please pay attention to https://r-spatial.github.io/evolution/ and necessary startup messages issued by sp.

@enblacar You need to determine whether the evolution process for R-spatial packages is connected to the large number of regular CRAN check failures already present https://cran.r-project.org/web/checks/check_results_SCpubr.html. I attach a check log without retiring packages on the library path, with different errors, but errors none the less.
SCpubr_00check.log

Prepare for upcoming Seurat v5 release

I am opening this issue as a notification because SCpubr is listed here as a package that relies (depends/imports/suggests) on Seurat. As you may know, we recently released Seurat v5 as a beta in March of this year, with new updates for spatial, multimodal, and massively scalable analysis. For more information on updates and improvements, check out our website https://satijalab.org/seurat/.
We are now preparing to release Seurat v5 to CRAN, and plan to submit it on October 23rd. While we have tried our best to keep things backward-compatible, it is possible that updates to Seurat and SeuratObject might break your existing functionality or tests. We wanted to reach out before the new version is on CRAN, so that there's time to report issues/incompatibilities and prepare you for any changes in your code base that might be necessary.

We apologize for any disruption or inconvenience, but hope that the improvements to Seurat v5 will benefit your users going forward.
To test the upcoming release, you can install Seurat from the seurat5 branch using the instructions available on this page: https://satijalab.org/seurat/articles/install.

Thank you!
Seurat v5 team

REQUEST | do_DimPlot | using "split.by" I do not want to see a "combined" plot

Hello,

first of, thanks SCpubr team, this tool is great, use it a lot!

Since I upgraded to version 2, when I do a dimplot with the split.by option, I have an extra plot on my file --> "combined"
is there an option to not add this plot? sorry if it's already been discussed, I cannot find my answer anywhere. 

Thanks!

Elodie

eg

SCpubr::do_DimPlot(Seurat_Final,label=FALSE, reduction = "umap", split.by = "Tissue", group.by="Cluster", pt.size=1,legend.icon.size=6, font.size=30, ncol=3)

SCpubr version:

2.0.1

BUG | `.GetAssayData` | Incorrect assumptions about SeuratObject versions

Code for .GetAssayData() assumes that SeuratObject v4.1.3 is the last version of SeuratObject for the v4 cycle https://github.com/enblacar/SCpubr/blob/main/R/utils.R#L3283-L3290
This assumption is incorrect; we are trying to submit v4.1.4 to handle the upcoming removal of rgeos from CRAN, and this assumption in SCpubr will cause failures in our upcoming submission

For reference, SeuratObject::GetAssayData() will continue to work in SeuratObject v5 and will work for both v3 and v5 assays. Once v5 is released, we will eventually start throwing warnings about the usage of GetAssayData() and move users and downstream packages to LayerData(), but that will not happen until SeuratObject v5.1 at the earliest (and may be later). But as SeuratObject v5 is not on CRAN, v5 assumptions should not be made in packages that are also on CRAN

Feature Request: Multiple Features for do_RidgePlot

Hi,
I would love to compare the expression of two markers in the same cell type by ridge plots. It would be cool to have two colors for the two markers and directly compare them next to each other.
Thank you very much!

Marking Frequency % inside Barplot stacks

Hi @enblacar,

I am enjoying using SCpubr, thank you for this amazing package.

Feature request:

# Adding frequency percentage in barplots

Example:

I was thinking if we can mark the frequency percentages for each clusters inside each stack of barplot, it will give more insights to the visualization.

Implementation:

Trying with this code.
p4 <- SCpubr::[do_BarPlot](https://rdrr.io/pkg/SCpubr/man/do_BarPlot.html)(sample, 
                         group.by = "seurat_clusters",
                         split.by = "modified_orig.ident",
                         plot.title = "With split.by - position = fill",
                         position = "fill",
                         flip = FALSE)

SCpubr version:

'1.1.2.9000'

Thank you,,
Athul

Replacing LIANA's plots with SCpubr

Hi @enblacar,

I was thinking, perhaps I should completely replace LIANA's plots with the Ligand-Receptor ones from SCpubr in the next few updates.

In the end, they are very much with liana's, with yours being of higher quality.

Perhaps, one thing that I'm missing currently in LIANA is a ligand-receptor dotplot across samples.
Would you be open to having one in SCpubr? I can do a PR with the basis for the function (likely not as in-depth and as cutomizable as your standard). I can also keep that one to LIANA alone.

Let me know what your thoughts are on this!

Best,
Daniel

check_suggests does not print missing package names | check_suggests

Bug:

When running any package, the check_suggests function of SCpubr does not print out the correct packages which are missing. This is due to what I believe an error with:

missing_pkgs <- names(pkgs[base::isFALSE(pkgs)])

Possible solutions are:
missing_pkgs <- names(pkgs[pkgs == FALSE]) 
missing_pkgs <- names(which(!pkgs))

Error log:

Error: 
x Packages  must be installed to use do_DimPlot.
Traceback:

1. SCpubr:::check_suggests(function_name = "do_DimPlot")
2. stop(paste0(add_cross(), crayon_body("Packages "), paste(vapply(missing_pkgs, 
 .     crayon_key, FUN.VALUE = character(1)), collapse = crayon_body(", ")), 
 .     crayon_body(" must be installed to use "), crayon_key(function_name), 
 .     crayon_body(".")), call. = FALSE)

SCpubr version: 2.0.1

Session info:

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS


locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] SCpubr_2.0.1       SeuratObject_4.1.3 Seurat_4.3.0.1

BUG | do_LigandReceptorPlot() |"arrange_interactions_by = both" implementation

First, I would like to say that I am so very happy to see a standardized scRNAseq visualization package such as this, which has made my work so much easier. I noticed when using the do_LigandReceptorPlot() function, the arrange_interactions_by = "both" argument has undesired output when arranging the ligand-receptor pairs. It appears that when "both" is selected (Uses both sca.LRscore and natmi.edge_specificity columns to arrange the interactions by their specificity and magnitude altogether), the function arranges the ligand-receptor pairs by natmi.edge_specificity then sca.LRscore. Meaning one column is arranged first, then the second (more weight on the first column). Consequently, the top_interactions argument will be skewed toward the natmi.edge_specificity. I suggest changing the source code to arrange((desc(natmi.edge_specificity) + desc(sca.LRscore)) / 2) or something similar so that there are equal weights on the scoring methods, and the top interactions displayed on the plot will be more accurate.

SCpubr version:

1.1.2.9000

colors.use not working with split.by in do_DimPlot

Hi @enblacar,

Thanks so much for developing this package! I'm loving it.
Unfortunately, I just stumbled upon something: When I use do_Dimplot with the split.by option, I cannot set all the colors for my identities to the same color (which I'm trying to do with a vector of the color "black" repeated as many times as Idents I have).

Here's my code:

library (Seurat)
library (tidyverse)
library (reshape2)
library (sctransform)
library (MetBrewer)
library (viridis)
library (ggthemes)
library (presto)
library (simspec)
library (SCpubr)
library (janitor)
library (gplots)
library (Matrix)
cols_black_22 <- rep ("black", times = 22)
names (cols_black_22) <- levels (seurat$Idents)
SCpubr::do_DimPlot (seurat, split.by = "Idents",  legend.position = "none", font.size = 24, colors.use = cols_black_22)

And the error I get is the following: Error in colors.use[[iteration]] : subscript out of bounds
I have checked that the number of elements in my named vector cols_black_all is the same as the number of Idents in my Seurat object. Also, if I exchange split.by for group.by I get no errors. Why is it then failing to iterate through the vector of colors? Am I missing something here is this a bug?

BUG | do_DimPlot | Multiple legends are visualised when "Group by a variable but split by another"

Bug:

I want to split the umap by sample, while colouring the inside of each umap by the clusters.
I managed to do that using the combination of group.by="cluster" and split.by="SampleID",
but I get multiple legends; one per split (sample).

uMAP_res1 2_by_SampleID_split

The code I used is:

tmp_plot <- do_DimPlot(exp_tumour, split.by ="SampleID ",  group.by = "integrated_snn_res.1.2" , ncol = 4,
                          label = FALSE,
                          pt.size = 0.8, repel = TRUE, plot.axes = TRUE,
                          legend.position = "bottom", legend.nrow = 3) 
ggsave(tmp_plot, filename = paste0(figDIR,"/uMAP_",outname,"_by_",colonna,"_split.png"),width = 14,height = 18) 

In seurat I usually do:

Idents(exp_tumour) <- "integrated_snn_res.1.2"
DimPlot(exp_tumour, label = TRUE, pt.size = 0.8, split.by = "SampleID", repel = TRUE, ncol = 4) 

DimPlot_legend

SCpubr version:
1.1.2

Session info:

R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/libf77blas.so.3.10.3 
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=fr_FR.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Paris
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] SCpubr_1.1.2                scR_0.9                     UCell_2.4.0                 viridis_0.6.4               viridisLite_0.4.2           dplyr_1.1.2                
 [7] pheatmap_1.0.12             scCustomize_1.1.3           plotly_4.10.2               dittoSeq_1.12.0             ggpubr_0.6.0                garnett_0.2.20             
[13] monocle3_1.3.1              SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2 GenomicRanges_1.52.0        GenomeInfoDb_1.36.1         IRanges_2.34.1             
[19] S4Vectors_0.38.1            MatrixGenerics_1.12.3       matrixStats_1.0.0           Biobase_2.60.0              BiocGenerics_0.46.0         wesanderson_0.3.6          
[25] patchwork_1.1.2             data.table_1.14.8           ggplot2_3.4.2               sctransform_0.3.5           SeuratObject_4.1.3          Seurat_4.3.0.1             

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21        splines_4.3.1           later_1.3.1             ggplotify_0.1.1         bitops_1.0-7            tibble_3.2.1            polyclip_1.10-4        
  [8] janitor_2.2.0           lifecycle_1.0.3         rstatix_0.7.2           globals_0.16.2          lattice_0.21-8          MASS_7.3-60             backports_1.4.1        
 [15] magrittr_2.0.3          httpuv_1.6.11           sp_2.0-0                spatstat.sparse_3.0-2   reticulate_1.30         cowplot_1.1.1           pbapply_1.7-2          
 [22] minqa_1.2.5             RColorBrewer_1.1-3      lubridate_1.9.2         abind_1.4-5             zlibbioc_1.46.0         Rtsne_0.16              purrr_1.0.1            
 [29] RCurl_1.98-1.12         yulab.utils_0.0.6       circlize_0.4.15         GenomeInfoDbData_1.2.10 ggrepel_0.9.3           irlba_2.3.5.1           listenv_0.9.0          
 [36] spatstat.utils_3.0-3    terra_1.7-39            goftest_1.2-3           spatstat.random_3.1-5   fitdistrplus_1.1-11     parallelly_1.36.0       leiden_0.4.3           
 [43] codetools_0.2-19        DelayedArray_0.26.7     tidyselect_1.2.0        shape_1.4.6             farver_2.1.1            lme4_1.1-34             spatstat.explore_3.2-1 
 [50] jsonlite_1.8.7          BiocNeighbors_1.18.0    ellipsis_0.3.2          progressr_0.13.0        ggridges_0.5.4          survival_3.5-5          systemfonts_1.0.4      
 [57] tools_4.3.1             ragg_1.2.5              ica_1.0-3               Rcpp_1.0.11             glue_1.6.2              gridExtra_2.3           withr_2.5.0            
 [64] fastmap_1.1.1           boot_1.3-28.1           fansi_1.0.4             digest_0.6.33           gridGraphics_0.5-1      timechange_0.2.0        R6_2.5.1               
 [71] mime_0.12               textshaping_0.3.6       ggprism_1.0.4           colorspace_2.1-0        scattermore_1.2         tensor_1.5              spatstat.data_3.0-1    
 [78] utf8_1.2.3              tidyr_1.3.0             generics_0.1.3          httr_1.4.6              htmlwidgets_1.6.2       S4Arrays_1.0.5          uwot_0.1.16            
 [85] pkgconfig_2.0.3         gtable_0.3.3            lmtest_0.9-40           XVector_0.40.0          htmltools_0.5.5         carData_3.0-5           scales_1.2.1           
 [92] png_0.1-8               snakecase_0.11.0        rstudioapi_0.15.0       reshape2_1.4.4          nlme_3.1-162            nloptr_2.0.3            zoo_1.8-12             
 [99] GlobalOptions_0.1.2     stringr_1.5.0           KernSmooth_2.23-22      parallel_4.3.1          miniUI_0.1.1.1          vipor_0.4.5             ggrastr_1.0.2          
[106] pillar_1.9.0            grid_4.3.1              vctrs_0.6.3             RANN_2.6.1              promises_1.2.0.1        car_3.1-2               xtable_1.8-4           
[113] cluster_2.1.4           paletteer_1.5.0         beeswarm_0.4.0          cli_3.6.1               compiler_4.3.1          rlang_1.1.1             crayon_1.5.2           
[120] future.apply_1.11.0     ggsignif_0.6.4          labeling_0.4.2          rematch2_2.1.2          plyr_1.8.8              forcats_1.0.0           ggbeeswarm_0.7.2       
[127] stringi_1.7.12          BiocParallel_1.34.2     deldir_1.0-9            assertthat_0.2.1        munsell_0.5.0           lazyeval_0.2.2          spatstat.geom_3.2-4    
[134] Matrix_1.6-0            future_1.33.0           shiny_1.7.4.1           ROCR_1.0-11             igraph_1.5.0.1          broom_1.0.5  ```

UCell support instead of AddModuleScore?

Hello,

This is a great package! I just was wondering if it was possible to support UCell scoring functionality then AddModuleScore?
It's a bit more scalable and has different scoring heuristics so it would be great to have that as an option.

Thanks,
Chang

REQUEST | do_ViolinPlot | I want order to be added

Hi enblacar team!

Great package. I'm using it a lot, but I was wandering if you could add one more thing to the do_ViolinPlot() function.
Is it possible to add order in the do_ViolinPlot() function as it is the case for do_BarPlot() and do_BoxPlot() functions?
I am using "sort" in the VlnPlot() quite often, and I am missing it in do_ViolinPlot().

Feature request:

# do_ViolinPlot( order = TRUE) 

**SCpubr version: **

# 2.0.2

Thanks a lot!

Christine

"Undefined columns selected" | do_FunctionalAnnotationPlot | Function doesn't run

Hello,

Thanks for making a nice, and generally easy to use package. I'm unable to get the do_FunctionalAnnotationPlot() to work, however. See details below - thanks in advance!

e.g. using Ifnup which contains a list of 162 character elements:

>   str(Ifnup)
#  chr [1:162] "AARS" "ADAR" "APOB" "APOL1" "APOL2" "APOL3" "APOL6" "ARL4D" "ASS1" "ATF4" "B2M" "BATF2" ...

Error log:

>   out = SCpubr::do_FunctionalAnnotationPlot(genes = Ifnup,
+                                             org.db = org.Hs.eg.db)
#Error in `[.data.frame`(p.build$data[[7]], c("label", "node")) : 
#  undefined columns selected
#In addition: Warning message:
#The "label" has(have) been found in tree data. You might need to rename the variable(s) in the data of
#"geom_cladelab" to avoid this warning! 

SCpubr version:

> utils::packageVersion("SCpubr")
[1] ‘1.1.2

Session info:

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] SCpubr_1.1.2 scCustomize_1.1.1 purrr_1.0.1 stringr_1.5.0 ggplot2_3.4.2
[6] SeuratObject_4.1.3 Seurat_4.3.0 dplyr_1.1.2

loaded via a namespace (and not attached):
[1] circlize_0.4.15 uuid_1.0-3 systemfonts_1.0.4 plyr_1.8.6
[5] igraph_1.2.11 lazyeval_0.2.2 sp_1.6-1 splines_4.1.1
[9] listenv_0.8.0 scattermore_0.8 digest_0.6.29 htmltools_0.5.2
[13] fansi_0.5.0 magrittr_2.0.1 paletteer_1.5.0 tensor_1.5
[17] cluster_2.1.2 ROCR_1.0-11 globals_0.14.0 matrixStats_0.61.0
[21] officer_0.6.2 askpass_1.1 spatstat.sparse_3.0-1 gfonts_0.2.0
[25] colorspace_2.0-2 ggrepel_0.9.3 textshaping_0.3.6 xfun_0.29
[29] crayon_1.5.0 jsonlite_1.8.0 progressr_0.10.0 spatstat.data_3.0-1
[33] survival_3.2-11 zoo_1.8-9 glue_1.6.2 polyclip_1.10-0
[37] gtable_0.3.0 leiden_0.3.9 clipr_0.7.1 shape_1.4.6
[41] future.apply_1.8.1 abind_1.4-5 scales_1.2.0 fontquiver_0.2.1
[45] futile.options_1.0.1 spatstat.random_3.1-5 miniUI_0.1.1.1 Rcpp_1.0.7
[49] viridisLite_0.4.0 xtable_1.8-4 reticulate_1.24 fontLiberation_0.1.0
[53] htmlwidgets_1.5.4 httr_1.4.2 RColorBrewer_1.1-2 ellipsis_0.3.2
[57] ica_1.0-2 pkgconfig_2.0.3 uwot_0.1.14 deldir_1.0-6
[61] janitor_2.2.0 utf8_1.2.2 crul_1.4.0 tidyselect_1.2.0
[65] rlang_1.1.1 reshape2_1.4.4 later_1.3.0 munsell_0.5.0
[69] tools_4.1.1 ggprism_1.0.4 cli_3.6.0 generics_0.1.2
[73] ggridges_0.5.3 evaluate_0.15 fastmap_1.1.0 ragg_1.2.2
[77] goftest_1.2-3 rematch2_2.1.2 knitr_1.37 fitdistrplus_1.1-6
[81] zip_2.2.0 RANN_2.6.1 pbapply_1.5-0 future_1.24.0
[85] nlme_3.1-152 mime_0.12 formatR_1.11 ggrastr_1.0.2
[89] ggvenn_0.1.9 xml2_1.3.3 compiler_4.1.1 rstudioapi_0.13
[93] beeswarm_0.4.0 plotly_4.10.0 curl_4.3.2 png_0.1-7
[97] spatstat.utils_3.0-3 tibble_3.2.1 stringi_1.7.6 futile.logger_1.4.3
[101] forcats_0.5.1 gdtools_0.3.3 lattice_0.20-44 Matrix_1.5-4.1
[105] fontBitstreamVera_0.1.1 vctrs_0.6.2 pillar_1.9.0 lifecycle_1.0.3
[109] GlobalOptions_0.1.2 spatstat.geom_3.2-1 lmtest_0.9-39 RcppAnnoy_0.0.19
[113] data.table_1.14.2 cowplot_1.1.1 irlba_2.3.5 flextable_0.9.2
[117] httpuv_1.6.5 patchwork_1.1.1 R6_2.5.1 promises_1.2.0.1
[121] KernSmooth_2.23-20 gridExtra_2.3 vipor_0.4.5 parallelly_1.30.0
[125] codetools_0.2-18 lambda.r_1.2.4 MASS_7.3-54 openssl_1.4.6
[129] withr_2.5.0 httpcode_0.3.0 sctransform_0.3.5 parallel_4.1.1
[133] VennDiagram_1.7.3 grid_4.1.1 tidyr_1.3.0 snakecase_0.11.0
[137] rmarkdown_2.11 Rtsne_0.15 spatstat.explore_3.2-1 lubridate_1.8.0
[141] shiny_1.7.1 ggbeeswarm_0.6.0

[do_DimPlot] add an option to hide the "combined" view

Having the combined view when splitting is useful and convenient, but sometimes it is not necessary to show it.
It would be ideal to add an option to hide it, maybe with a dedicated flag (e.g. show_combined = FALSE).
Setting it to FALSE will allow do_DimPlot to behave like default seurat while TRUE will turn on the typical SCpubr behaviour.

I currently set the combined elements to NULL, and re-arrange the other elements manually

u1 <- do_DimPlot(exp_Integrated, split.by = "SampleID")
(u1[[2]] | u1[[3]]) / (u1[[4]] | u1[[5]])

This works but it can be painful when several elements are involved.

label.size parameter missing

Hi Enrique!

I have started to play with your package and I'm enjoying it a lot, thanks!

I was trying some dimplots, and it seems that the parameter "label.size" from SCpubr::do_DimPlot() is missing. In your book manual (Basic plots > 1 Dim plots > 1.4 label the clusters) there's an example where you are modifying the size of the labels with the parameter label.size. I am using SCpubr 1.0.4 (the same as indicated in the book), but that parameter is missing in my version (I can't neither find it in the source code of the function linked in the manual book). Am I doing something wrong?

Thanks a lot!

Feature request: add min/max cutoff do_FeaturePlot

Hello @enblacar,

Really enjoy the many possibilities your package offers for data visualization. I just started using it, and the first thing I wanted to do was to plot a feature plot and limit the color scale to a range of values but could not find an option as in FeaturePlot (min.cutoff-max.cutoff). It would be nice if it could be added to the do_FeaturePlot function. :)

Thanks for this excellent package!

Feature request: group.by + split.by functionality to do_ViolinPlot.

Hi, Just found this very useful package. Especially do_ViolinPlot !! (it is a disaster to use the seurat's VlnPlot if my obj has more than 100K cells). But it seems that it lacks the parameters that Seurat has, such as split.by. Would be wonderful if you may have time to add them in the future. Great thanks!

BUG | do_EnrichmentHeatmap | features.order not working?

Hi there, I'm rather new to single cell analyses so I'm sorry if this question is due to my inexperience. I am trying to run a Heatmap using UCell scores from a Seurat object. My input_gene_list looks something like this


genes <- as.dataframe(read_csv("genes.csv")) #dataframe with different rows of marker genes
genesets <- list(Macrophages = as.vector(genes$macros), 
                 Microglia = as.vector(genes$microglia), 
                 Phagocytes = as.vector(genes$phagocytes))
seurat.object <- AddModuleScore_UCell(seurat.object, genesets, BPPARAM = BPPARAM, name = NULL)

where genesets is a named list and each list contains character gene symbols, and seurat.object is a seurat object.
I manually changed the names of the list items in genesets as I am unsure if I am allowed to share the specific information (the actual object has around 10 items)

My code for the heatmap is

do_EnrichmentHeatmap(seurat.object, genesets, flavor = "UCell", group.by = "group", features.order = c(names(genesets)))

Which generates a proper heatmap without features.order with the gene set groups out of order (e.g., "Microglia", "Phagocytes", "Macrophages").

When adding features.order it doesn't throw an error but does generates an incorrect plot:
Screenshot 2023-09-28 at 2 43 53 PM

I'm not sure if there's something I'm doing wrong? The class of names(genesets) is character. I have tried manually ordering them as a vector in the function as well but it gets the same result. Does anyone know if there is a different way to implemen this or if this is due to a bug? Thank you for your time and help!

Error while running do_GroupwiseDEPlot()

Hi @enblacar,

Thank you much for developing this package, we are definitely going to use it all our publications. We really love all the customization options and the detailed step wise instructions.

I am running into an error when I am running the do_GroupwiseDEPlot() function (error pasted below):

SCpubr::do_GroupwiseDEPlot(sample = baseline,de_genes = de_genes)
Error: There are no positive values in the matrix.

I double checked the first few rows of the de_genes tibble and there are positive log FC values for the top DE genes. Could you please help me figure out what is triggering the error above ?

Thanks

"n_genes" didnt label correct number of genes in both side in "do_VolcanoPlot"

first, thank you for this easy to use package. i really enjoy using it in my daily scRNAseq analysis.
i just encountered a little issue with the volcanoplot function.

"n_genes" works well when "order_tags_by" set to "logfc"
however, it fails to label the same number of genes in both side when "order_tags_by" was set to "both" or "p_value"
there is also a double labeling issue at certain condition

SCpubr::do_VolcanoPlot(
sample = daglut,
de_genes = markers,
n_genes = 5,
pval_cutoff = 1e-50,
FC_cutoff = 0.4,
order_tags_by= "logfc"
)

d5ce40df-a3a4-4ca1-9d57-6d4064dac840

SCpubr::do_VolcanoPlot(
sample = daglut,
de_genes = markers,
n_genes = 5,
pval_cutoff = 1e-50,
FC_cutoff = 0.4,
order_tags_by= "both"
)

443c0185-2c92-4dc4-8594-6a337f7e3f8b

R version 4.1.3 (2022-03-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] SCpubr_1.0.1.9000 qs_0.25.4 sp_1.5-0 SeuratObject_4.1.2
[5] Seurat_4.2.0 dplyr_1.0.10

loaded via a namespace (and not attached):
[1] Rtsne_0.16 colorspace_2.0-3 deldir_1.0-6
[4] ellipsis_0.3.2 ggridges_0.5.4 IRdisplay_1.1
[7] base64enc_0.1-3 spatstat.data_2.2-0 farver_2.1.1
[10] leiden_0.4.3 listenv_0.8.0 ggrepel_0.9.1
[13] fansi_1.0.3 codetools_0.2-18 splines_4.1.3
[16] polyclip_1.10-0 IRkernel_1.3 jsonlite_1.8.2
[19] Cairo_1.6-0 ica_1.0-3 cluster_2.1.4
[22] png_0.1-7 rgeos_0.5-9 uwot_0.1.14
[25] shiny_1.7.2 sctransform_0.3.5 spatstat.sparse_2.1-1
[28] compiler_4.1.3 httr_1.4.4 assertthat_0.2.1
[31] Matrix_1.5-1 fastmap_1.1.0 lazyeval_0.2.2
[34] limma_3.50.3 cli_3.4.1 later_1.2.0
[37] htmltools_0.5.3 tools_4.1.3 igraph_1.3.5
[40] gtable_0.3.1 glue_1.6.2 RANN_2.6.1
[43] reshape2_1.4.4 Rcpp_1.0.8 scattermore_0.8
[46] vctrs_0.4.2 nlme_3.1-159 progressr_0.11.0
[49] lmtest_0.9-40 spatstat.random_2.2-0 stringr_1.4.1
[52] globals_0.16.1 mime_0.12 miniUI_0.1.1.1
[55] lifecycle_1.0.3 irlba_2.3.5.1 goftest_1.2-3
[58] future_1.28.0 MASS_7.3-58.1 zoo_1.8-11
[61] scales_1.2.1 spatstat.core_2.4-4 promises_1.2.0.1
[64] spatstat.utils_2.3-1 parallel_4.1.3 RColorBrewer_1.1-3
[67] reticulate_1.26 pbapply_1.5-0 gridExtra_2.3
[70] ggplot2_3.3.6 rpart_4.1.16 stringi_1.7.8
[73] repr_1.1.4 rlang_1.0.6 pkgconfig_2.0.3
[76] matrixStats_0.62.0 evaluate_0.17 lattice_0.20-45
[79] ROCR_1.0-11 purrr_0.3.5 tensor_1.5
[82] labeling_0.4.2 patchwork_1.1.2 htmlwidgets_1.5.4
[85] cowplot_1.1.1 tidyselect_1.1.2 parallelly_1.32.1
[88] RcppAnnoy_0.0.19 plyr_1.8.7 magrittr_2.0.3
[91] R6_2.5.1 generics_0.1.3 pbdZMQ_0.3-7
[94] DBI_1.1.3 mgcv_1.8-40 pillar_1.8.1
[97] fitdistrplus_1.1-8 survival_3.4-0 abind_1.4-5
[100] tibble_3.1.8 future.apply_1.9.1 crayon_1.5.2
[103] uuid_1.1-0 KernSmooth_2.23-20 utf8_1.2.2
[106] RApiSerialize_0.1.2 spatstat.geom_2.4-0 plotly_4.10.0
[109] viridis_0.6.2 grid_4.1.3 data.table_1.14.2
[112] digest_0.6.29 xtable_1.8-4 tidyr_1.2.1
[115] httpuv_1.6.6 RcppParallel_5.1.5 stringfish_0.15.7
[118] munsell_0.5.0 viridisLite_0.4.1

Question about Ridge plots

Hi @enblacar,

Is it possible to make a ridge plot showing the expression of a certain gene ? If I change the features to a gene name I get the following error:

Error: 'SCT' is not an assay

As per your suggestion in my previous issue, I am explicitly specifying assay="RNA". The code from the vignette plotting nFeature_RNA works but once I change it to a gene name I am getting this error.

split.by variable independent from colour variable

The package is amazing, but I can't find a way to split plots by a desired categorical variable different than the categorical variable that is used to colour the plot in do_DimPlot, do_RidgePlot and do_ViolinPlot. I also am unable to split the do_NebulosaPlot plot by a categorical variable.

For do_DimPlot, I am trying to colour cells by cluster and separate the plot in two by sample. For example, in base seurat the resulting plot from

DimPlot(seurat.object,
           group.by = 'seurat_clusters',
           split.by = 'orig.ident')

image

When trying to do the same with do_DimPlot

do_DimPlot(seurat.object,
           group.by = 'seurat_clusters',
           split.by = 'orig.ident')

returns
Error: Either group.by or split.by has to be NULL.

do_FeaturePlot, instead, allows the colouring variable to be different from the splitting variable, although the colouring variable can't be categorical.

In a similar fashion, for ridge and violin plots, I'd like to include two categorical variables. For a basic seurat violin plot, this can be achieved with

VlnPlot(object = seurat.object,
        features = 'feature',
        split.by = 'orig.ident',
        group.by = 'seurat_clusters')

image
but I am unable to find a wat to do it with SCPubr

Hopefully there is a way to do this because I am in love with this package aesthetics

Error: 'do_ExpressionHeatmap' is not an exported object from 'namespace:SCpubr'

Hi,
Thanks for this pretty nice package.
I'm having a little issue with do_ExpressionHeatmap :

SCpubr::do_ExpressionHeatmap(sample = sample ,
                                  features  = paste0(names(top50_signature),"_UCell_sig"),
                                  viridis_direction = -1)
Error: 'do_ExpressionHeatmap' is not an exported object from 'namespace:SCpubr'

I can not use do_EnrichmentHeatmap with UCell as my R version is 4.1

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] SCpubr_1.0.4.9000      scCustomize_0.7.0.9918 UCell_1.3.1            SeuratWrappers_0.3.0   dplyr_1.0.99.9000     
 [6] sp_1.5-0               SeuratObject_4.1.1     Seurat_4.1.1           presto_1.0.0           Rcpp_1.0.9            
[11] simspec_0.0.0.9000     knitr_1.40             rlang_1.0.5            data.table_1.14.2      Matrix_1.5-1          
[16] ggplot2_3.3.6          patchwork_1.1.2.9000   circlize_0.4.15        purrr_0.3.4            Scillus_0.5.0         
[21] ComplexHeatmap_2.13.4  tibble_3.1.8           RColorBrewer_1.1-3    

loaded via a namespace (and not attached):
  [1] ggprism_1.0.3.9000          scattermore_0.8             R.methodsS3_1.8.1           tidyr_1.2.1                
  [5] irlba_2.3.5                 DelayedArray_0.18.0         R.utils_2.10.1              wesanderson_0.3.6.9000     
  [9] rpart_4.1-15                RCurl_1.98-1.5              doParallel_1.0.16           generics_0.1.3             
 [13] BiocGenerics_0.38.0         callr_3.7.2                 cowplot_1.1.1               usethis_2.0.1              
 [17] RANN_2.6.1                  future_1.28.0               spatstat.data_2.2-0         xml2_1.3.2                 
 [21] lubridate_1.8.0             httpuv_1.6.6                SummarizedExperiment_1.22.0 assertthat_0.2.1           
 [25] viridis_0.6.2               xfun_0.33                   evaluate_0.16               promises_1.2.0.9000        
 [29] fansi_1.0.3                 flipPlots_1.3.5             igraph_1.3.4                DBI_1.1.1                  
 [33] htmlwidgets_1.5.4           spatstat.geom_2.4-0         stats4_4.1.1                paletteer_1.4.0            
 [37] ellipsis_0.3.2              ggpubr_0.4.0                backports_1.4.1             prismatic_1.1.0            
 [41] deldir_1.0-6                MatrixGenerics_1.4.3        vctrs_0.4.1.9000            SingleCellExperiment_1.14.1
 [45] Biobase_2.52.0              remotes_2.4.1               ROCR_1.0-11                 abind_1.4-5                
 [49] cachem_1.0.6                withr_2.5.0                 progressr_0.11.0            sctransform_0.3.4          
 [53] prettyunits_1.1.1           dittoSeq_1.7.0              goftest_1.2-3               cluster_2.1.2              
 [57] lazyeval_0.2.2              crayon_1.5.1                pkgconfig_2.0.3             labeling_0.4.2             
 [61] GenomeInfoDb_1.28.4         nlme_3.1-152                vipor_0.4.5                 pkgload_1.3.0              
 [65] flipTime_2.9.4              devtools_2.4.2              globals_0.16.1              lifecycle_1.0.2            
 [69] flipTransformations_1.10.0  miniUI_0.1.1.1              rsvd_1.0.5                  rprojroot_2.0.3            
 [73] ggrastr_1.0.1               polyclip_1.10-0             matrixStats_0.62.0          lmtest_0.9-40              
 [77] carData_3.0-5               zoo_1.8-11                  formattable_0.2.1           beeswarm_0.4.0             
 [81] ggridges_0.5.3              GlobalOptions_0.1.2         processx_3.7.0              pheatmap_1.0.12            
 [85] png_0.1-7                   viridisLite_0.4.1           rjson_0.2.20                sparkline_2.0              
 [89] bitops_1.0-7                R.oo_1.24.0                 KernSmooth_2.23-20          shape_1.4.6                
 [93] stringr_1.4.1               parallelly_1.32.1           spatstat.random_2.2-0       rstatix_0.7.0              
 [97] S4Vectors_0.30.2            ggsignif_0.6.3              scales_1.2.1                memoise_2.0.1              
[101] magrittr_2.0.3              plyr_1.8.7                  ica_1.0-3                   verbs_0.10.2               
[105] zlibbioc_1.38.0             compiler_4.1.1              clue_0.3-59                 fitdistrplus_1.1-8         
[109] snakecase_0.11.0            cli_3.4.0                   XVector_0.32.0              flipFormat_1.10.3          
[113] listenv_0.8.0               pbapply_1.5-0               ps_1.7.1                    MASS_7.3-54                
[117] mgcv_1.8-36                 tidyselect_1.1.2.9000       stringi_1.7.8               forcats_0.5.1              
[121] highr_0.9                   ggrepel_0.9.1               tools_4.1.1                 future.apply_1.9.1         
[125] parallel_4.1.1              rstudioapi_0.14             foreach_1.5.1               janitor_2.1.0              
[129] gridExtra_2.3               farver_2.1.1                Rtsne_0.16                  digest_0.6.29              
[133] BiocManager_1.30.16         rgeos_0.5-9                 shiny_1.7.2                 networkD3_0.4              
[137] GenomicRanges_1.44.0        car_3.1-0                   broom_1.0.1                 later_1.3.0.9000           
[141] RcppAnnoy_0.0.19            httr_1.4.4                  colorspace_2.0-3            fs_1.5.2                   
[145] flipU_1.5.0                 tensor_1.5                  reticulate_1.26-9000        IRanges_2.26.0             
[149] splines_4.1.1               uwot_0.1.14                 rematch2_2.1.2              rhtmlMetro_1.0.2           
[153] spatstat.utils_2.3-1        plotly_4.10.0               sessioninfo_1.1.1           xtable_1.8-4               
[157] jsonlite_1.8.0              R6_2.5.1                    pillar_1.8.1                htmltools_0.5.3            
[161] mime_0.12                   glue_1.6.2                  fastmap_1.1.0               DT_0.18                    
[165] BiocParallel_1.26.1         codetools_0.2-18            pkgbuild_1.2.0              utf8_1.2.2                 
[169] lattice_0.20-44             spatstat.sparse_2.1-1       curl_4.3.2                  ggbeeswarm_0.6.0           
[173] leiden_0.4.3                colorway_0.2.0              survival_3.2-13             striprtf_0.5.2             
[177] rmarkdown_2.15              munsell_0.5.0               GetoptLong_1.0.5            GenomeInfoDbData_1.2.6     
[181] iterators_1.0.13            reshape2_1.4.4              gtable_0.3.1                spatstat.core_2.4-4        

'do_SankeyPlot' is not an exported object from 'namespace:SCpubr'

Hi enblacar,
Thank you for developing such an excellent package. I encountered an error when I tried the do_SankeyPlot, in which 'cm' is my preprocessed Seurat object.
library(SCpubr)
library(Seurat)
library(dplyr)
p1<-SCpubr::do_SankeyPlot(sample = cm,
first_group = "RNA_snn_res.0.1",
last_group = "seurat_clusters",
type = "sankey")
Error: 'do_SankeyPlot' is not an exported object from 'namespace:SCpubr'.
Do you know what problem cause this error?

Share SCpubr book for version 1.1.2

Hello @enblacar!

I just saw you are planning a major update of your excellent package! That's great. However, I would like to know whether it is still possible to share the previous reference manual you had at enblacar.github.io/SCpubr-book/. It would be helpful to have access to it until the next version is fully released.

Many thanks for considering my request!

Error: 'save_Plot' is not an exported object from 'namespace:SCpubr'

Hi,

Thank you for this amazing package!

I am receiving this strange error when using 'SCpubr::save_Plot'

Error: 'save_Plot' is not an exported object from 'namespace:SCpubr'

I installed the cran version first, but later installed the dev version and reloaded the library.

Plotting works, but saving the plot have the above issue. Do you have any suggestions.

Regards,
Athul

do_DotPlot Sequential palette, diverging, white on extreme low end

I am running the following code:

do_DotPlot(alldata,features = c("P2RY12","CX3CR1","TMEM119","CSF1R","CD3E","TNF","TNFSF10","IFNG","GZMA","PRF1","FASLG","NKG7","CD163","TGFB1","IL10","HAVCR2","TIGIT","LAG3","PDCD1","CD274","LAIR1","STAT3","ITGAX","HLA-DRA","B2M","TAPBP","HSPA5","CALR","CIITA","CD14","MRC1","FCGR3A","FCGR1A","ITGAV"),sequential.palette = "RdGy",dot_border = TRUE,scale = TRUE,scale.by = "size")+ theme(axis.text.x = element_text(angle = 90,face = "plain",hjust=1,vjust = 0.5),axis.text.y = element_text(face = "plain"),panel.border = element_rect(colour = "black", fill=NA, size=1),legend.text = element_text(face = "plain"))

and the -2 value is showing as white instead of dark red, this is occur with all the diverging color palettes.

Feature plot that also has cluster annotation as colored dots/boxes with legend rather than labels on clusters

Dear developers,

Thank you very much for the great tool which significantly improves single-cell plots.
I'm wondering if there's a way to label feature plots clusters using colours without putting text labels on the clusters. This can be helpful when making several feature plots for different genes and using one legend to orient the users on the positions of clusters. Below is an example to illustrate the idea that I have put together in powerpoint.

image

Here is an example from a paper by Wu et al 2021 which shows a Dimplot. It would be nice to be able to implement it in featureplot

image

do_GroupwiseDEPlot with output of FindConservedMarkers

Hi Enrique

I’m using your SCpubr package which is awesome – thanks for sharing it.

Feature request:

Create a GroupwiseDEPlot for conserved markers across an integrated dataset

So far I've created a tibble with the output of FindConservedMarkers for each cluster. The main problems I'm running into are:

  1. the output of FindConservedMarkers does not necessarily give unique genes per cluster, so there's some duplication. Fixable by forcing unique gene names, but for the final plot output would ideally have a per-gene column.
  2. When I've forced unique gene names, I get the following error:
Error in .subscript.2ary(x, i, , drop = TRUE) : subscript out of bounds

This is my code chunk so far:

cluster_names <- unique(pbmc$manual_annotation)
iteratively_find_conserved <- function(so, cluster){
  out <- FindConservedMarkers(so, ident.1 = cluster, grouping.var = "patient", only.pos = TRUE, log2fc.threshold = 0.25)
  out <- out %>% mutate(cluster = cluster)
  out['gene'] <- rownames(out)
  return(out)
}
Idents(pbmc) <- "manual_annotation"
pbmc_conserved_markers <- lapply(cluster_names, iteratively_find_conserved, so = pbmc)
pbmc_conserved_markers <- list_rbind(pbmc_conserved_markers)
deplot_tibble <- pbmc_conserved_markers %>% mutate(p_val = ((patient1_p_val + patient2_p_val + patient3_p_val + patient4_p_val)/4),
                                                   avg_log2FC = ((patient1_avg_log2FC + patient2_avg_log2FC + patient3_avg_log2FC + patient4_avg_log2FC)/4),
                                                   pct.1 = ((patient1_pct.1 + patient2_pct.1 + patient3_pct.1 + patient4_pct.1)/4),
                                                   pct.2 = ((patient1_pct.2 + patient2_pct.2 + patient3_pct.2 + patient4_pct.2)/4),
                                                   p_val_adj = ((patient1_p_val_adj + patient2_p_val_adj + patient3_p_val_adj + patient4_p_val_adj)/4)
                                                   )
deplot_tibble <- deplot_tibble %>% select(p_val, avg_log2FC, pct.1, pct.2, p_val_adj, cluster, gene)
rownames(deplot_tibble) <- NULL
deplot_tibble <- as_tibble(deplot_tibble)
deplot_tibble['gene'] <- make.names(deplot_tibble$gene, unique=TRUE)
 
 
p_out <- SCpubr::do_GroupwiseDEPlot(sample = pbmc, de_genes = deplot_tibble, min.cutoff = 1)

SCpubr version:

2.0.2

Thanks again for the package, really enjoying using it!

label clusters in do_FeaturePlot

Hi,

what would be the SCpubr version of:

FeaturePlot(scData, features="nCount_RNA", label = TRUE)

I want to add the labels of the clusters to the feature plot.
do_FeaturePlot doesn't support label parameter.

Thank you in advance!

Best,

Changing colors

Hello @enblacar ,

Thank you for such a great package!
I am just having an issue with changing the colors in a Dimplot for the three identities of my object.
The analogous Seurat command works fine.
I am sure I am missing something obvious...

SCpubr::do_DimPlot(sample = FiltID, colors.use = c("#00A9FF","#F8766D","#0CB702"))
Error: The names of provided colors does not match the number of unique values in the selected grouping variable (levels(object), group.by or split.by).

Error while trying out the TF Activity inference analysis section from the tutorial

Hi again @enblacar,

I am getting an error while trying to get prior network information while following the TF activity inference vignette. The error is pasted below:

> network <- decoupleR::get_dorothea(organism = "human",levels = c("A", "B", "C")) Error: 'import_dorothea_interactions' is not an exported object from 'namespace:OmnipathR'

I am using SCpubr_1.0.1 and I manually downloaded all the required dependencies. Any thoughts on how to fix this ?

Thanks.

Error with Sankey Plot

Hello, I am trying to do a Sankey Plot but I receive this error and no plot is done.

Error: 'do_SankeyPlot' is not an exported object from 'namespace:SCpubr'

How can I solve it?

Thanks

pseudotime Analysis

Thanks again for creating such a useful tool for scRNA-Seq analysis!

I was wondering if one can use Dyno instead of Monocle (since it's unavailable at this time) to create the pseudotime partitions for for the analysis? If not, do you have plans to update this function in the near future?

BUG | do_EnrichmentHeatmap | Undefined columns selected when providing named lists with dashes on the names.

Hi,

I encountered n issue when running "SCpubr::do_EnrichmentHeatmap".

Here is the code :

Macro_Subtypes = list(
  "IFN-TAMs" = c("CCL2", "CCL8", "CXCL9", "CXCL10", "CXCL11", "IFITM1", "ISG15"),
  "Infla-TAMs" = c("CCL3", "CCL4", "CCL20", "CCL3L1", "CCL4L2", "CXCL1", "CXCL2", "CXCL3", "CXCL5", "CXCL8", "GOS2"))

SCpubr::do_EnrichmentHeatmap(AllMacroClean, input_gene_list = Macro_Subtypes, use_viridis = T, viridis.palette = "C", legend.position = "right", flip = F)
AllMacroClean being a Seurat Object
![image](https://github.com/enblacar/SCpubr/assets/141238205/22268def-9e30-43bb-82d2-9085102fd7cd)

I have the following error :
Error in [.data.frame([email protected], , col_name) :
undefined columns selected
In addition: Warning message:
! Found dashes (-) in the name of the gene sets provided. Replacing them with dots (.) to avoid conflicts when generating the Seurat assay.

It worked before, but not anymore, and I don't understand what I have to change. Does anyone could help me ?

Alexis

do_DimPlot: sizes.highlight not working when raster = TRUE

Hey there!

I was doing some plots trying to highlight specific cells when I found that, if raster = TRUE when using do_DimPlot, the sizes.highlight argument is ignored. I can change the point size of all cells using pt.size, but I can't using sizes.highlight. Here a small code to reproduce the problem:

library(Seurat)
library(tidyverse)
data("pbmc_small")

cells_to_highlight <- sample(Cells(pbmc_small), 10)

# Raster + highlight
SCpubr::do_DimPlot(
  sample = pbmc_small, 
  cells.highlight = cells_to_highlight,
  sizes.highlight = 16,
  pt.size = 8,
  raster = TRUE
) & coord_fixed()

# NO raster + highlight
SCpubr::do_DimPlot(
  sample = pbmc_small, 
  cells.highlight = cells_to_highlight,
  sizes.highlight = 4,
  pt.size = 1,
  raster = FALSE
) & coord_fixed()

Thanks a lot!!

Daniel

background of label in DimPlot

Hi,

I would like to force the background of the box around the labels of my DimPlot to be white, instead of a contrasted color.
I can find this option in the documentation. Do you have an idea how I could do that?

Thanks

do_AzimuthAnalysisPlot is not an exported object from 'namespace:SCpubr'

Thank you for a great package.
When I was trying to generate an Azimuth report
out <- SCpubr::do_AzimuthAnalysisPlot(sample = harmony.Azimuth, annotation.labels = "predicted.celltype.l1", annotation.scoring = "predicted.celltype.l1.score", font.size = 18)
I got this error

Error: 'do_AzimuthAnalysisPlot' is not an exported object from 'namespace:SCpubr'

sessionInfo()

R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8    LC_MONETARY=English_Australia.utf8
[4] LC_NUMERIC=C                       LC_TIME=English_Australia.utf8    

time zone: Australia/Sydney
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SCpubr_2.0.2       dplyr_1.1.4        pheatmap_1.0.12    ggplot2_3.4.4      patchwork_1.2.0    SeuratObject_4.1.4
[7] Seurat_4.4.0      

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21              splines_4.3.2                 later_1.3.2                  
  [4] bitops_1.0-7                  filelock_1.0.3                tibble_3.2.1                 
  [7] polyclip_1.10-6               lifecycle_1.0.4               globals_0.16.2               
 [10] lattice_0.22-5                MASS_7.3-60                   magrittr_2.0.3               
 [13] plotly_4.10.3                 rmarkdown_2.25                yaml_2.3.8                   
 [16] httpuv_1.6.13                 sctransform_0.4.1             spam_2.10-0                  
 [19] sp_2.1-2                      spatstat.sparse_3.0-3         reticulate_1.34.0            
 [22] cowplot_1.1.2                 pbapply_1.7-2                 DBI_1.2.0                    
 [25] RColorBrewer_1.1-3            abind_1.4-5                   zlibbioc_1.48.0              
 [28] Rtsne_0.17                    GenomicRanges_1.54.1          purrr_1.0.2                  
 [31] BiocGenerics_0.48.1           RCurl_1.98-1.14               rappdirs_0.3.3               
 [34] GenomeInfoDbData_1.2.11       IRanges_2.36.0                S4Vectors_0.40.2             
 [37] ggrepel_0.9.4                 irlba_2.3.5.1                 listenv_0.9.0                
 [40] spatstat.utils_3.0-4          goftest_1.2-3                 spatstat.random_3.2-2        
 [43] fitdistrplus_1.1-11           parallelly_1.36.0             DelayedMatrixStats_1.24.0    
 [46] leiden_0.4.3.1                codetools_0.2-19              DelayedArray_0.28.0          
 [49] tidyselect_1.2.0              matrixStats_1.2.0             stats4_4.3.2                 
 [52] BiocFileCache_2.10.1          spatstat.explore_3.2-5        jsonlite_1.8.8               
 [55] ellipsis_0.3.2                progressr_0.14.0              ggridges_0.5.5               
 [58] survival_3.5-7                tools_4.3.2                   ica_1.0-3                    
 [61] Rcpp_1.0.12                   glue_1.7.0                    gridExtra_2.3                
 [64] SparseArray_1.2.3             xfun_0.41                     MatrixGenerics_1.14.0        
 [67] GenomeInfoDb_1.38.5           withr_2.5.2                   BiocManager_1.30.22          
 [70] fastmap_1.1.1                 fansi_1.0.6                   digest_0.6.34                
 [73] R6_2.5.1                      mime_0.12                     colorspace_2.1-0             
 [76] scattermore_1.2               tensor_1.5                    spatstat.data_3.0-3          
 [79] RSQLite_2.3.4                 celldex_1.12.0                utf8_1.2.4                   
 [82] tidyr_1.3.0                   generics_0.1.3                data.table_1.14.10           
 [85] httr_1.4.7                    htmlwidgets_1.6.4             S4Arrays_1.2.0               
 [88] uwot_0.1.16                   pkgconfig_2.0.3               gtable_0.3.4                 
 [91] blob_1.2.4                    lmtest_0.9-40                 XVector_0.42.0               
 [94] htmltools_0.5.7               dotCall64_1.1-1               scales_1.3.0                 
 [97] Biobase_2.62.0                png_0.1-8                     knitr_1.45                   
[100] rstudioapi_0.15.0             reshape2_1.4.4                nlme_3.1-164                 
[103] curl_5.2.0                    cachem_1.0.8                  zoo_1.8-12                   
[106] stringr_1.5.1                 BiocVersion_3.18.1            KernSmooth_2.23-22           
[109] parallel_4.3.2                miniUI_0.1.1.1                AnnotationDbi_1.64.1         
[112] pillar_1.9.0                  grid_4.3.2                    vctrs_0.6.5                  
[115] RANN_2.6.1                    promises_1.2.1                dbplyr_2.4.0                 
[118] xtable_1.8-4                  cluster_2.1.6                 evaluate_0.23                
[121] cli_3.6.2                     compiler_4.3.2                rlang_1.1.3                  
[124] crayon_1.5.2                  future.apply_1.11.1           plyr_1.8.9                   
[127] stringi_1.8.3                 viridisLite_0.4.2             deldir_2.0-2                 
[130] munsell_0.5.0                 Biostrings_2.70.1             lazyeval_0.2.2               
[133] spatstat.geom_3.2-7           Matrix_1.6-4                  ExperimentHub_2.10.0         
[136] sparseMatrixStats_1.14.0      bit64_4.0.5                   future_1.33.1                
[139] KEGGREST_1.42.0               shiny_1.8.0                   SummarizedExperiment_1.32.0  
[142] interactiveDisplayBase_1.40.0 AnnotationHub_3.10.0          ROCR_1.0-11                  
[145] igraph_1.6.0                  memoise_2.0.1                 bit_4.0.5

do_LigandReceptorPlot Source/Target order

Hi there,

Is there any way to set a custom order for the sources/targets in a do_LigandReceptorPlot?

For example, by default, the plot gives me X Z Y as my sources - I would like to rearrange that into X Y Z (I'm also using keep_source).

I tried setting the order via a fixed factor level in the table for each method e.g. factor(liana$natmi$source, levels = c("X", "Y", "Z")) but unfortunately I believe the order is lost when the function runs liana_aggregate() independently. Any ideas on how to force the order?

Perhaps in the future it may be possible to run do_LigandReceptorPlot() on the aggregated data, which will be done on the user's end.

Error using do_DimPlot when using split.by

Hello @enblacar,

I have an issue using do_DimPlot when using the argument split.by. When I use group.by it generates the plot, but once I change it to split.by using the same column in the metadata, I get the error below:

Error in `[.data.frame`(data, , group): undefined columns selected
Traceback:

1. SCpubr::do_DimPlot(obj, raster = TRUE, reduction = "umap", 
 .     split.by = "type", ncol = 3, legend.position = "none", 
 .     font.size = 16)
2. Seurat::DimPlot(sample.use, reduction = reduction, group.by = if (is.null(group.by)) {
 .     split.by
 . } else {
 .     group.by
 . }, label = label, dims = dims, repel = repel, label.box = label.box, 
 .     label.color = label.color, label.size = label.size, na.value = na.value, 
 .     shuffle = shuffle, order = order, pt.size = pt.size, cols = colors.use, 
 .     raster = raster, raster.dpi = c(raster.dpi, raster.dpi))
3. is.factor(x = data[, group])
4. data[, group]
5. `[.data.frame`(data, , group)
6. stop("undefined columns selected")

What do you think the problem is?

Change font size in do_PathwayActivityPlot

Hello!

Thanks for this package!
I am trying to increase the font size of this heatmap
HeatPath

This is the code to get the heatmap:

Use SCpubr and decoupleR for pathway activity inference
# Retrieve prior knowledge network.
network <- decoupleR::get_progeny(organism = "human")

# Run weighted means algorithm.
activities <- decoupleR::run_wmean(mat = as.matrix(CD8@assays[["RNA"]]@data),
                                   network = network,
                                   .source = "source",
                                   .targe = "target",
                                   .mor = "weight",
                                   times = 100,
                                   minsize = 5)

# General heatmap.
out <- SCpubr::do_PathwayActivityPlot(sample = CD8,
                                      activities = activities,
                                      split.by = "group_id", cluster_rows = FALSE)
p.patHeat <- out$heatmaps$average_scores

Using the font.size argument (I have tried font.size 10,20,40) does not work.

Can you help?

Thanks
Francesco

Error using do_GroupwiseDEPlot

Hello @enblacar!

I am having a great time using your package. Unfortunately, I am facing an issue using do_GroupwiseDEPlot. The error is:

Error in grid.Call.graphics(C_downvppath, name$path, name$name, strict): Viewport '-log10(Adjusted P-value)_heatmap_body_1_1' was not found
Traceback:

1. SCpubr::do_GroupwiseDEPlot(sample = dmg, de_genes = de_genes, 
 .     min.cutoff = 1)
2. ComplexHeatmap::draw(ht_list, heatmap_legend_list = list_legends, 
 .     heatmap_legend_side = if (legend.position %in% c("top", "bottom")) {
 .         "bottom"
 .     } else {
 .         "right"
 .     }, padding = ggplot2::unit(c(5, 5, 5, 5), "mm"), ht_gap = ggplot2::unit(heatmap_gap, 
 .         "cm"))
3. ComplexHeatmap::draw(ht_list, heatmap_legend_list = list_legends, 
 .     heatmap_legend_side = if (legend.position %in% c("top", "bottom")) {
 .         "bottom"
 .     } else {
 .         "right"
 .     }, padding = ggplot2::unit(c(5, 5, 5, 5), "mm"), ht_gap = ggplot2::unit(heatmap_gap, 
 .         "cm"))
4. .local(object, ...)
5. grid.draw(p)
6. grid.draw.gTree(p)
7. recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
8. drawGTree(x)
9. grid.draw(x$children[[i]], recording = FALSE)
10. grid.draw.grob(x$children[[i]], recording = FALSE)
11. recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
12. drawGrob(x)
13. preDraw(x)
14. preDraw.grob(x)
15. pushvpgp(x)
16. pushgrobvp(x$vp)
17. pushgrobvp.vpPath(x$vp)
18. downViewport(vp, strict = TRUE, recording = FALSE)
19. downViewport.vpPath(vp, strict = TRUE, recording = FALSE)
20. grid.Call.graphics(C_downvppath, name$path, name$name, strict)

Any thoughts on what could it be?

Thanks in advance!

How to manually edit the complexHeatmap parameters after generating the heatmap?

Hi,
I made a heatmap with do_ExpressionHeatmap as following

p1= SCpubr::do_ExpressionHeatmap(sample = subset(object, idents=levels(object)[8:12]),
                                  features = markers,
                                  viridis_direction = -1,group.by="annotation", slot="data",enforce_symmetry =F,viridis_color_map = "B",flip = TRUE,legend.position = "right",heatmap.legend.width = 3,heatmap.legend.length =30, min.cutoff =0,cluster_rows=F, max.cutoff = 3.5,cell_size = 5)

I then wanted to edit the parameters of p1 to change the font sizes of the genes and clusters names but I couldn't manage.

p1@ht_list$`Avg. Expression`@row_names_param$gp$fontsize= rep(8,length(markers))
doesn't change anything

Does anyone have an idea?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.