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

Negative log counts values from registration_pseudobulk() #106

Open
kinnaryshah opened this issue Apr 9, 2025 · 1 comment
Open

Negative log counts values from registration_pseudobulk() #106

kinnaryshah opened this issue Apr 9, 2025 · 1 comment

Comments

@kinnaryshah
Copy link

Thank you for developing this great package! @lahuuki and I discussed this issue and we wanted to get your input here. When I use the registration_pseudobulk() function on my own dataset and on the DLPFC dataset, I get a small percentage of values in the lognormalized pseudobulked matrix as negatives. Almost all of these values are 0 in the counts pseudobulked matrix. Is this behavior expected? I saw that the edgeR::cpm() function uses an average pseudocount of 1, so there are likely some values less than 1.

I bring this up for two reasons: 1) Are these negatives expected? If so, is this okay for running DE? 2) When visualizing the data, having negative logcounts values is hard to interpret. I would prefer to use the logcounts scale for visualization instead of the counts scale. My first solution would be to add a larger prior count, like 3, to prevent negatives while preserving the distribution of the data. Would you recommend this for the DE analysis as well?

spe <- spatialLIBD::fetch_data(type = "spatialDLPFC_Visium")
spe_pseudo <- registration_pseudobulk(spe, var_registration = "BayesSpace_harmony_09", var_sample_id = "sample_id" )
sum(logcounts(spe_pseudo)<0)

Which shows 170,257/3,276,300 values are negative.

@kinnaryshah
Copy link
Author

R version 4.3.2 Patched (2024-02-08 r85876)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Rocky Linux 9.4 (Blue Onyx)

Matrix products: default
BLAS: /jhpce/shared/community/core/conda_R/4.3.x/R/lib64/R/lib/libRblas.so
LAPACK: /jhpce/shared/community/core/conda_R/4.3.x/R/lib64/R/lib/libRlapack.so; LAPACK version 3.11.0

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

time zone: US/Eastern
tzcode source: system (glibc)

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

other attached packages:
[1] dplyr_1.1.4 gridExtra_2.3
[3] spatialLIBD_1.19.6 projectR_1.18.0
[5] synchronicity_1.3.10 bigmemory_4.6.4
[7] cowplot_1.1.3 patchwork_1.2.0
[9] bluster_1.12.0 igraph_2.1.1
[11] RColorBrewer_1.1-3 pheatmap_1.0.12
[13] scran_1.30.2 Matrix_1.6-5
[15] scRNAseq_2.16.0 here_1.0.1
[17] ggspavis_1.9.10 scater_1.30.1
[19] ggplot2_3.5.1 scuttle_1.12.0
[21] SpatialExperiment_1.12.0 SingleCellExperiment_1.24.0
[23] SummarizedExperiment_1.32.0 Biobase_2.62.0
[25] GenomicRanges_1.54.1 GenomeInfoDb_1.38.5
[27] IRanges_2.36.0 S4Vectors_0.40.2
[29] BiocGenerics_0.48.1 MatrixGenerics_1.14.0
[31] matrixStats_1.2.0

loaded via a namespace (and not attached):
[1] later_1.3.2 BiocIO_1.12.0
[3] bitops_1.0-7 filelock_1.0.3
[5] tibble_3.2.1 XML_3.99-0.16.1
[7] lifecycle_1.0.4 edgeR_4.0.14
[9] doParallel_1.0.17 rprojroot_2.0.4
[11] lattice_0.22-5 ensembldb_2.26.0
[13] magrittr_2.0.3 sass_0.4.8
[15] plotly_4.10.4 limma_3.58.1
[17] jquerylib_0.1.4 yaml_2.3.8
[19] metapod_1.10.1 httpuv_1.6.14
[21] NMF_0.28 ggside_0.2.3
[23] askpass_1.2.0 sessioninfo_1.2.2
[25] reticulate_1.35.0 DBI_1.2.1
[27] golem_0.4.1 abind_1.4-5
[29] zlibbioc_1.48.0 purrr_1.0.2
[31] AnnotationFilter_1.26.0 RCurl_1.98-1.14
[33] rappdirs_0.3.3 circlize_0.4.15
[35] GenomeInfoDbData_1.2.11 ggrepel_0.9.5
[37] irlba_2.3.5.1 umap_0.2.10.0
[39] MatrixModels_0.5-3 RSpectra_0.16-1
[41] dqrng_0.3.2 DelayedMatrixStats_1.24.0
[43] codetools_0.2-19 DelayedArray_0.28.0
[45] DT_0.31 xml2_1.3.6
[47] shape_1.4.6 tidyselect_1.2.0
[49] ScaledMatrix_1.10.0 viridis_0.6.5
[51] shinyWidgets_0.8.1 BiocFileCache_2.10.1
[53] GenomicAlignments_1.38.2 jsonlite_1.8.8
[55] GetoptLong_1.0.5 BiocNeighbors_1.20.2
[57] ellipsis_0.3.2 ggalluvial_0.12.5
[59] iterators_1.0.14 foreach_1.5.2
[61] tools_4.3.2 progress_1.2.3
[63] Rcpp_1.0.12 glue_1.7.0
[65] SparseArray_1.2.3 withr_3.0.0
[67] BiocManager_1.30.22 fastmap_1.1.1
[69] fansi_1.0.6 openssl_2.1.1
[71] digest_0.6.34 rsvd_1.0.5
[73] R6_2.5.1 mime_0.12
[75] colorspace_2.1-0 biomaRt_2.58.2
[77] RSQLite_2.3.5 config_0.3.2
[79] tidyr_1.3.1 utf8_1.2.4
[81] generics_0.1.3 data.table_1.15.4
[83] rtracklayer_1.62.0 htmlwidgets_1.6.4
[85] prettyunits_1.2.0 httr_1.4.7
[87] S4Arrays_1.2.0 pkgconfig_2.0.3
[89] gtable_0.3.4 tsne_0.1-3.1
[91] registry_0.5-1 blob_1.2.4
[93] ComplexHeatmap_2.18.0 XVector_0.42.0
[95] htmltools_0.5.7 clue_0.3-65
[97] ProtGenerics_1.34.0 scales_1.3.0
[99] attempt_0.3.1 png_0.1-8
[101] bigmemory.sri_0.1.8 uuid_1.2-0
[103] reshape2_1.4.4 rjson_0.2.21
[105] curl_5.2.3 GlobalOptions_0.1.2
[107] cachem_1.0.8 stringr_1.5.1
[109] BiocVersion_3.18.1 parallel_4.3.2
[111] vipor_0.4.7 AnnotationDbi_1.64.1
[113] restfulr_0.0.15 pillar_1.9.0
[115] grid_4.3.2 vctrs_0.6.5
[117] promises_1.2.1 BiocSingular_1.18.0
[119] dbplyr_2.4.0 beachmat_2.18.0
[121] xtable_1.8-4 cluster_2.1.6
[123] paletteer_1.6.0 beeswarm_0.4.0
[125] GenomicFeatures_1.54.3 magick_2.8.2
[127] cli_3.6.2 locfit_1.5-9.8
[129] compiler_4.3.2 Rsamtools_2.18.0
[131] rngtools_1.5.2 rlang_1.1.3
[133] crayon_1.5.2 rematch2_2.1.2
[135] plyr_1.8.9 ggbeeswarm_0.7.2
[137] stringi_1.8.3 gridBase_0.4-7
[139] viridisLite_0.4.2 BiocParallel_1.36.0
[141] munsell_0.5.0 Biostrings_2.70.2
[143] lazyeval_0.2.2 benchmarkme_1.0.8
[145] ExperimentHub_2.10.0 hms_1.1.3
[147] sparseMatrixStats_1.14.0 bit64_4.0.5
[149] KEGGREST_1.42.0 statmod_1.5.0
[151] shiny_1.8.0 interactiveDisplayBase_1.40.0
[153] AnnotationHub_3.10.0 ROCR_1.0-11
[155] memoise_2.0.1 bslib_0.6.1
[157] benchmarkmeData_1.0.4 bit_4.0.5

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

1 participant