Giter Club home page Giter Club logo

Comments (5)

enblacar avatar enblacar commented on June 8, 2024

Hi @athulmenon,

Thanks for using my package!

This is something I am working on for update v2.0.0. However, and sadly, displaying the proportions in the plot will only work if the fractions are sufficiently big for the numbers to be seen. Otherwise, they will collapse on top of each other. An alternative is to repel the text/labels, but it also generates quite noisy visualizations.

Therefore, I decided to add the option to display the total number of observations with add.n parameter when position = fill is set, so that one can get an insight on the observations per bar.

I am also adding a return_data parameter that will output a tibble with the counts and proportions displayed in the plot. This can then be used as supplementary data that goes along with the bar plot, if used for a publication.

I hope this answer helps you! All these changes will roll out when the next update is ready. Until then, you can access them via GitHub downloading the last commit. However, bear in mind that the commit versions might still have bugs and be in experimental phase!

Best,
Enrique

from scpubr.

athulmenon avatar athulmenon commented on June 8, 2024

Hi @enblacar,

Thank you for your reply.

I installed the recent commit and could generate the barplots without any issues.
But when I tried return_data = T it throws an error as below.
Error: 'reframe' is not an exported object from 'namespace:dplyr'

I made sure dplyr is loaded to the R and updated. Do you have any suggestions on how to use return_data?

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

Matrix products: default

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

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

other attached packages:
[1] org.Mm.eg.db_3.14.0 dplyr_1.0.10 limma_3.50.3 metap_1.8
[5] multtest_2.50.0 sctransform_0.3.5 purrr_0.3.5 gridExtra_2.3
[9] celldex_1.4.0 SingleR_1.8.1 ensembldb_2.18.4 AnnotationFilter_1.18.0
[13] GenomicFeatures_1.46.5 AnnotationDbi_1.56.2 AnnotationHub_3.2.2 BiocFileCache_2.2.1
[17] dbplyr_2.2.1 RCurl_1.98-1.8 cowplot_1.1.1 scales_1.2.1
[21] Matrix_1.5-1 SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 Biobase_2.54.0
[25] GenomicRanges_1.46.1 GenomeInfoDb_1.30.1 IRanges_2.28.0 S4Vectors_0.32.4
[29] BiocGenerics_0.40.0 MatrixGenerics_1.6.0 matrixStats_0.62.0 patchwork_1.1.2
[33] ggplot2_3.4.0 BiocParallel_1.28.3 scDblFinder_1.8.0 sp_1.5-0
[37] SeuratObject_4.1.2 Seurat_4.2.0 SCpubr_2.0.0.9000

loaded via a namespace (and not attached):
[1] rsvd_1.0.5 ica_1.0-3 svglite_2.1.0 ps_1.7.2
[5] Rsamtools_2.10.0 lmtest_0.9-40 rprojroot_2.0.3 crayon_1.5.2
[9] spatstat.core_2.4-4 rbibutils_2.2.11 MASS_7.3-54 nlme_3.1-152
[13] rlang_1.0.6 XVector_0.34.0 ROCR_1.0-11 irlba_2.3.5.1
[17] callr_3.7.3 scater_1.22.0 filelock_1.0.2 xgboost_1.6.0.1
[21] stringfish_0.15.7 qs_0.25.4 rjson_0.2.21 bit64_4.0.5
[25] glue_1.6.2 pheatmap_1.0.12 parallel_4.1.1 processx_3.8.0
[29] vipor_0.4.5 spatstat.sparse_3.0-0 spatstat.geom_3.0-3 tidyselect_1.2.0
[33] usethis_2.1.6 fitdistrplus_1.1-8 XML_3.99-0.12 tidyr_1.2.1
[37] zoo_1.8-11 qqconf_1.3.0 GenomicAlignments_1.30.0 distributional_0.3.2
[41] xtable_1.8-4 magrittr_2.0.3 evaluate_0.17 Rdpack_2.4
[45] scuttle_1.4.0 cli_3.4.1 zlibbioc_1.40.0 sn_2.1.0
[49] rstudioapi_0.14 miniUI_0.1.1.1 rpart_4.1-15 mathjaxr_1.6-0
[53] shiny_1.7.3 BiocSingular_1.10.0 xfun_0.34 pkgbuild_1.4.0
[57] cluster_2.1.2 KEGGREST_1.34.0 tibble_3.1.8 interactiveDisplayBase_1.32.0
[61] ggrepel_0.9.1 listenv_0.8.0 Biostrings_2.62.0 png_0.1-7
[65] future_1.28.0 withr_2.5.0 bitops_1.0-7 plyr_1.8.7
[69] dqrng_0.3.0 pillar_1.8.1 RcppParallel_5.1.5 GlobalOptions_0.1.2
[73] cachem_1.0.6 multcomp_1.4-20 fs_1.5.2 DelayedMatrixStats_1.16.0
[77] vctrs_0.5.0 ellipsis_0.3.2 generics_0.1.3 devtools_2.4.5
[81] RApiSerialize_0.1.2 tools_4.1.1 beeswarm_0.4.0 munsell_0.5.0
[85] DelayedArray_0.20.0 fastmap_1.1.0 compiler_4.1.1 pkgload_1.3.2
[89] abind_1.4-5 httpuv_1.6.6 rtracklayer_1.54.0 ExperimentHub_2.2.1
[93] sessioninfo_1.2.2 plotly_4.10.0 rgeos_0.5-9 GenomeInfoDbData_1.2.7
[97] edgeR_3.36.0 lattice_0.20-44 deldir_1.0-6 mutoss_0.1-12
[101] utf8_1.2.2 later_1.3.0 jsonlite_1.8.3 ScaledMatrix_1.2.0
[105] pbapply_1.5-0 sparseMatrixStats_1.6.0 lazyeval_0.2.2 promises_1.2.0.1
[109] goftest_1.2-3 spatstat.utils_3.0-1 reticulate_1.26 sandwich_3.0-2
[113] rmarkdown_2.17 openxlsx_4.2.5.2 statmod_1.4.37 Rtsne_0.16
[117] forcats_0.5.2 uwot_0.1.14 igraph_1.3.5 plotrix_3.8-2
[121] survival_3.2-11 numDeriv_2016.8-1.1 yaml_2.3.6 systemfonts_1.0.4
[125] htmltools_0.5.3 memoise_2.0.1 profvis_0.3.7 BiocIO_1.4.0
[129] locfit_1.5-9.6 here_1.0.1 viridisLite_0.4.1 digest_0.6.30
[133] assertthat_0.2.1 mime_0.12 rappdirs_0.3.3 RSQLite_2.2.18
[137] yulab.utils_0.0.5 future.apply_1.9.1 remotes_2.4.2 data.table_1.14.4
[141] urlchecker_1.0.1 blob_1.2.3 splines_4.1.1 labeling_0.4.2
[145] ProtGenerics_1.26.0 hms_1.1.2 colorspace_2.0-3 BiocManager_1.30.19
[149] mnormt_2.1.1 ggbeeswarm_0.6.0 shape_1.4.6 ggrastr_1.0.1
[153] Rcpp_1.0.9 RANN_2.6.1 mvtnorm_1.1-3 circlize_0.4.15
[157] fansi_1.0.3 parallelly_1.32.1 R6_2.5.1 grid_4.1.1
[161] ggridges_0.5.4 lifecycle_1.0.3 zip_2.2.2 TFisher_0.2.0
[165] bluster_1.4.0 curl_4.3.3 ggsignif_0.6.4 leiden_0.4.3
[169] TH.data_1.1-1 desc_1.4.2 RcppAnnoy_0.0.20 RColorBrewer_1.1-3
[173] stringr_1.4.1 htmlwidgets_1.5.4 beachmat_2.10.0 polyclip_1.10-4
[177] biomaRt_2.50.3 gridGraphics_0.5-1 mgcv_1.8-36 globals_0.16.1
[181] spatstat.random_2.2-0 progressr_0.11.0 codetools_0.2-18 metapod_1.2.0
[185] prettyunits_1.1.1 ggdist_3.2.1 gtable_0.3.1 DBI_1.1.3
[189] ggalluvial_0.12.3 tensor_1.5 httr_1.4.4 KernSmooth_2.23-20
[193] stringi_1.7.8 progress_1.2.2 reshape2_1.4.4 farver_2.1.1
[197] viridis_0.6.2 xml2_1.3.3 BiocNeighbors_1.12.0 restfulr_0.0.15
[201] ggplotify_0.1.0 scattermore_0.8 BiocVersion_3.14.0 decoupleR_2.3.3
[205] scran_1.22.1 bit_4.0.4 spatstat.data_3.0-0 pkgconfig_2.0.3
[209] knitr_1.40 `

Regards,
Athul

from scpubr.

athulmenon avatar athulmenon commented on June 8, 2024

Hi @enblacar

The issue is solved with updating dplyr v1.1

Regards,
Athul

from scpubr.

enblacar avatar enblacar commented on June 8, 2024

Hi @athulmenon,

Yes, I was gonna mention that you should update dplyr.

For the return_data, just assign the call to SCpubr::do_BarPlot() to a variable and you should retrieve an output list with the plot and the data.frame with the data you need.

Please also consider updating to this commit:

devtools::install_github("enblacar/SCpubr", ref = "0cd9dfd")
# Reload R Session
detach("package:SCpubr")
library(SCpubr)

Let me know if it works!
Enrique

from scpubr.

athulmenon avatar athulmenon commented on June 8, 2024

Thanks @enblacar,

It worked!

Regards,
Athul

from scpubr.

Related Issues (20)

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.