Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labeling clusters with FeaturePlot_scCustom in v1.0 #80

Closed
jeremynkay opened this issue Dec 10, 2022 · 2 comments
Closed

Labeling clusters with FeaturePlot_scCustom in v1.0 #80

jeremynkay opened this issue Dec 10, 2022 · 2 comments

Comments

@jeremynkay
Copy link

Samuel,
Thanks for this package -- we love it in my lab!

We have mainly been using version 0.70 but several of us have recently upgraded to the latest 1.n release. There seems to be a change to FeaturePlot_scCustom in the new version that is breaking a bunch of our scripts. We often like to use the label = TRUE argument with FeaturePlot_scCustom so as to print the Ident name directly on the plot. In version 0.70 this argument was passed to Seurat::FeaturePlot and it worked just fine.

But in 1.02 there is now a newFeaturePlot_scCustom argument label_feature_yaxis. And for some reason the label = TRUE argument in our scripts is being interpreted as trying to set the label_feature_yaxis argument, instead of being passed to Seurat::FeaturePlot. Which unfortunately throws an error.

Screen Shot 2022-12-10 at 3 26 36 PM

If one explicitly sets label_feature_yaxis = FALSE then label = TRUE is passed to Seurat::FeaturePlot as before, and it works. But this is a lot of extra text to add, all to set the argument to its default value. There are obviously other workarounds so ultimately this is a pretty minor issue, but it sure would be great if cluster name labeling could work as seamlessly as it did before.

With my limited knowledge of R I'm not sure if maybe there is a way to specify what should happen to the label argument? Or maybe this is something that needs to be addressed under the hood? Your help is much appreciated!

Code example

library (Seurat)
library (scCustomize)
library (SeuratData)
data("pbmc3k.final")

# Seurat function
FeaturePlot(pbmc3k.final, "CX3CR1", label = T)

# works in 0.70, not in 1.02
FeaturePlot_scCustom(pbmc3k.final, "CX3CR1", label = T)

# works in 1.02
FeaturePlot_scCustom(pbmc3k.final, "CX3CR1", label_feature_yaxis = F, label = T)
sessionInfo() output
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] pbmc3k.SeuratData_3.1.4 SeuratData_0.2.2        scCustomize_1.0.2       SeuratObject_4.1.3     
[5] Seurat_4.3.0           

loaded via a namespace (and not attached):
  [1] Rtsne_0.16             ggbeeswarm_0.6.0       colorspace_2.0-3       ggsignif_0.6.4        
  [5] deldir_1.0-6           ellipsis_0.3.2         ggridges_0.5.4         snakecase_0.11.0      
  [9] circlize_0.4.15        GlobalOptions_0.1.2    rstudioapi_0.14        spatstat.data_3.0-0   
 [13] farver_2.1.1           ggpubr_0.5.0           leiden_0.4.3           listenv_0.8.0         
 [17] ggrepel_0.9.2          lubridate_1.9.0        fansi_1.0.3            codetools_0.2-18      
 [21] splines_4.2.2          polyclip_1.10-4        jsonlite_1.8.4         broom_1.0.1           
 [25] ica_1.0-3              cluster_2.1.4          png_0.1-8              uwot_0.1.14           
 [29] ggprism_1.0.4          shiny_1.7.3            sctransform_0.3.5      spatstat.sparse_3.0-0 
 [33] compiler_4.2.2         httr_1.4.4             backports_1.4.1        assertthat_0.2.1      
 [37] Matrix_1.5-3           fastmap_1.1.0          lazyeval_0.2.2         cli_3.4.1             
 [41] later_1.3.0            htmltools_0.5.4        tools_4.2.2            igraph_1.3.5          
 [45] gtable_0.3.1           glue_1.6.2             RANN_2.6.1             reshape2_1.4.4        
 [49] dplyr_1.0.10           rappdirs_0.3.3         Rcpp_1.0.9             carData_3.0-5         
 [53] scattermore_0.8        vctrs_0.5.1            spatstat.explore_3.0-5 nlme_3.1-160          
 [57] progressr_0.11.0       lmtest_0.9-40          spatstat.random_3.0-1  stringr_1.5.0         
 [61] globals_0.16.2         timechange_0.1.1       mime_0.12              miniUI_0.1.1.1        
 [65] lifecycle_1.0.3        irlba_2.3.5.1          rstatix_0.7.1          goftest_1.2-3         
 [69] future_1.29.0          MASS_7.3-58.1          zoo_1.8-11             scales_1.2.1          
 [73] promises_1.2.0.1       spatstat.utils_3.0-1   parallel_4.2.2         rematch2_2.1.2        
 [77] RColorBrewer_1.1-3     reticulate_1.26        colorway_0.2.0         pbapply_1.6-0         
 [81] gridExtra_2.3          ggplot2_3.4.0          stringi_1.7.8          paletteer_1.5.0       
 [85] shape_1.4.6            rlang_1.0.6            pkgconfig_2.0.3        matrixStats_0.63.0    
 [89] lattice_0.20-45        ROCR_1.0-11            purrr_0.3.5            tensor_1.5            
 [93] labeling_0.4.2         patchwork_1.1.2        htmlwidgets_1.5.4      cowplot_1.1.1         
 [97] tidyselect_1.2.0       parallelly_1.32.1      RcppAnnoy_0.0.20       plyr_1.8.8            
[101] magrittr_2.0.3         R6_2.5.1               generics_0.1.3         DBI_1.1.3             
[105] withr_2.5.0            pillar_1.8.1           fitdistrplus_1.1-8     survival_3.4-0        
[109] abind_1.4-5            sp_1.5-1               tibble_3.1.8           future.apply_1.10.0   
[113] crayon_1.5.2           janitor_2.1.0          car_3.1-1              KernSmooth_2.23-20    
[117] utf8_1.2.2             spatstat.geom_3.0-3    plotly_4.10.1          viridis_0.6.2         
[121] grid_4.2.2             data.table_1.14.6      forcats_0.5.2          digest_0.6.30         
[125] xtable_1.8-4           tidyr_1.2.1            httpuv_1.6.6           munsell_0.5.0         
[129] beeswarm_0.4.0         viridisLite_0.4.1      vipor_0.4.5         
@samuel-marsh
Copy link
Owner

Hi,

Thanks so much for kind words! I’ll take look at this. They should be interpreted independently but something going wrong obviously. I’ll work on fix this week.

Best,
Sam

@samuel-marsh
Copy link
Owner

Hi,

Fix is now live for this issue in the dev branch (v1.0.2.9019). The issue was due to error collision and now solved by explicitly adding the label param to FeaturePlot_scCustom to mirror the Seurat FALSE by default. I just tested with code you posted FeaturePlot_scCustom(pbmc, "CX3CR1", label = T) and it works for me. The dev branch should be stable right now (it's in prep for CRAN submission) so shouldn't be any issues. If you continue to have any issues after updating to dev branch let me know and I'll reopen the issue.

Best,
Sam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants