Internal Bug In RegionStats Leading To Issues With LinkPeaks
Internal Bug in RegionStats Leading to Issues with LinkPeaks
Introduction
The RegionStats
function in the GenomicRanges
package is used to calculate various statistics for genomic regions. However, in this article, we will discuss an internal bug in RegionStats
that leads to issues with LinkPeaks
. We will also provide a solution to this problem.
Problem Description
The problem arises when using the RegionStats
function with a combined object that contains both control and sample data. The RegionStats
function is used to calculate various statistics for genomic regions, but it returns an NA matrix when run with a combined object. This leads to issues with the LinkPeaks
function, which is used to identify peaks in the data.
Error Message
The error message returned by RegionStats
is:
Warning in RegionStats.default(object = regions, genome = genome, verbose = verbose, : Not all seqlevels present in supplied genome
This warning message indicates that not all sequence levels are present in the supplied genome.
Session Information
The session information for this problem is:
`R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_India.utf8 LC_CTYPE=English_India.utf8
[3] LC_MONETARY=English_India.utf8 LC_NUMERIC=C
[5] LC_TIME=English_India.utf8
time zone: Asia/Calcutta tzcode source: internal
attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] BSgenome.Drerio.UCSC.danRer11_1.4.2 ensembldb_2.28.1
[3] AnnotationFilter_1.28.0 GenomicFeatures_1.56.0
[5] AnnotationDbi_1.66.0 Biobase_2.64.0
[7] MASS_7.3-61 LSD_4.1-0
[9] ggrepel_0.9.6 pheatmap_1.0.12
[11] readr_2.1.5 hdf5r_1.3.12
[13] patchwork_1.3.0 future_1.34.0
[15] ggplot2_3.5.1 dplyr_1.1.4
[17] Signac_1.14.0 Seurat_5.1.0
[19] SeuratObject_5.0.2 sp_2.1-4
[21] BSgenome_1.72.0 rtracklayer_1.64.0
[23] BiocIO_1.14.0 Biostrings_2.72.1
[25] XVector_0.44.0 GenomicRanges_1.56.2
[27] GenomeInfoDb_1.40.1 IRanges_2.38.1
[29] S4Vectors_0.42.1 BiocGenerics_0.50.0
loaded via a namespace (and not attached):
[1] ProtGenerics_1.36.0 fs_1.6.5 matrixStats_1.4.1
[4] spatstat.sparse_3.1-0 bitops_1.0-9 enrichplot_1.24.4
[7] httr_1.4.7 RColorBrewer_1.1-3 tools_4.4.1
[10] sctransform_0.4.1 R6_2.6.1 lazyeval_0.2.2
[13] uwot_0.2.2 withr_3.0.2 gridExtra_2.3
[16] progressr_0.15.1 cli_3.6.3 spatstat.explore_3.3-3
[19] fastDummies_1.7.5 scatterpie_0.2.4 spatstat.data_3.1-4
[22] ggridges_0.5.6 pbapply_1.7-2 Rsamtools_2.20.0
[25] yulab.utils_0.2.0 gson_0.1.0 DOSE_3.30.5
[28] R.utils_2.13.0 parallelly_1.39.0 rstudioapi_0.17.1
[31] RSQLite_2.3.9 generics_0.1.3 gridGraphics_0.5-1
[34] ica_1.0-3 spatstat.random_3.3-2 GO.db_3.19.1
[37] Matrix_1.7-0 abind_1.4-8 R.methodsS3_1.8.2
[40] lifecycle_1.0.4 yaml_2.3.10 SummarizedExperiment_1.34.0
[43] qvalue_2.36.0 SparseArray_1.4.8 Rtsne_0.17
[46] grid_4.4.1 blob_1.2.4 promises_1.3.2
[49] crayon_1.5.3 miniUI_0.1.1.1 lattice_0.22-6
[52] cowplot_1.1.3 KEGGREST_1.44.1 pillar_1.10.1
[55] fgsea_1.30.0 rjson_0.2.23 boot_1.3-31
[58] future.apply_1.11.3 codetools_0.2-20 fastmatch_1.1-4
[61] leiden_0.4.3.1 glue_1.7.0 ggfun_0.1.8
[64] spatstat.univar_3.1-1 data.table_1.16.4 vctrs_0.6.5
[67] png_0.1-8 treeio_1.28.0 spam_2.11-0
[70] Rdpack_2.6.2 gtable_0.3.6 cachem_1.1.0
[73] rbibutils_2.3 S4Arrays_1.4.1 mime_0.12
[76] tidygraph_1.3.1 reformulas_0.4.0 survival_3.7-0
[79] SingleCellExperiment_1.26.0 RcppRoll_0.3.1 fitdistrplus_1.2-2
[82] ROCR_1.0-11 nlme_3.1-166 ggtree_3.12.0
[85] bit64_4.6.0-1 RcppAnnoy_0.0.22 irlba_2.3.5.1
[88] KernSmooth_2.23-24 colorspace_2.1-1 DBI_1.2.3
[91] tidyselect_1.2.1 bit_4.5.0.1 compiler_4.4.1
[94] curl_6.0.1 httr2_1.1.0 DelayedArray_0.30.1
[97] plotly_4.10.4 shadowtext_0.1.4 scales_1.3.0
[100] lmtest_0.9-40 rappdirs_0.3.3 stringr_1.5.1
[103] digest_0.6.37 goftest_1.2-3 spatstat.utils_3.1-1
[106] minqa_1.2.8 htmltools_0.5.8.1 pkgconfig_2.0.3
[109] lme4_1.1-36 MatrixGenerics_1.16.0 fastmap_1.2.0
[112] rlang_1.1.4 htmlwidgets_1.6.4 UCSC.utils_1.0.0
[115] shiny_1.10.0 farver_2.1.2 zoo_1.8-12
[118] jsonlite_1.8.9 BiocParallel_1.38.0 GOSemSim_2.30.2
[121] R.oo_1.27.0 RCurl_1.98-1.16 magrittr_2.0.3
[124] GenomeInfoDbData_1.2.12 ggplotify_0.1.2 dotCall64_1.2
[127] munsell_0.5.1 Rcpp_1.0.13 ape_5.8
Q&A: Internal Bug in RegionStats Leading to Issues with LinkPeaks
Q: What is the internal bug in RegionStats that leads to issues with LinkPeaks?
A: The internal bug in RegionStats is related to the calculation of DNA information for genomic regions. When the RegionStats function is run with a combined object that contains both control and sample data, it returns an NA matrix. This leads to issues with the LinkPeaks function, which is used to identify peaks in the data.
Q: What is the error message returned by RegionStats?
A: The error message returned by RegionStats is:
Warning in RegionStats.default(object = regions, genome = genome, verbose = verbose, : Not all seqlevels present in supplied genome
This warning message indicates that not all sequence levels are present in the supplied genome.
Q: What is the session information for this problem?
A: The session information for this problem is:
`R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_India.utf8 LC_CTYPE=English_India.utf8
[3] LC_MONETARY=English_India.utf8 LC_NUMERIC=C
[5] LC_TIME=English_India.utf8
time zone: Asia/Calcutta tzcode source: internal
attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] BSgenome.Drerio.UCSC.danRer11_1.4.2 ensembldb_2.28.1
[3] AnnotationFilter_1.28.0 GenomicFeatures_1.56.0
[5] AnnotationDbi_1.66.0 Biobase_2.64.0
[7] MASS_7.3-61 LSD_4.1-0
[9] ggrepel_0.9.6 pheatmap_1.0.12
[11] readr_2.1.5 hdf5r_1.3.12
[13] patchwork_1.3.0 future_1.34.0
[15] ggplot2_3.5.1 dplyr_1.1.4
[17] Signac_1.14.0 Seurat_5.1.0
[19] SeuratObject_5.0.2 sp_2.1-4
[21] BSgenome_1.72.0 rtracklayer_1.64.0
[23] BiocIO_1.14.0 Biostrings_2.72.1
[25] XVector_0.44.0 GenomicRanges_1.56.2
[27] GenomeInfoDb_1.40.1 IRanges_2.38.1
[29] S4Vectors_0.42.1 BiocGenerics_0.50.0
loaded via a namespace (and not attached):
[1] ProtGenerics_1.36.0 fs_1.6.5 matrixStats_1.4.1
[4] spatstat.sparse_3.1-0 bitops_1.0-9 enrichplot_1.24.4
[7] httr_1.4.7 RColorBrewer_1.1-3 tools_4.4.1
[10] sctransform_0.4.1 R6_2.6.1 lazyeval_0.2.2
[13] uwot_0.2.2 withr_3.0.2 gridExtra_2.3
[16] progressr_0.15.1 cli_3.6.3 spatstat.explore_3.3-3
[19] fastDummies_1.7.5 scatterpie_0.2.4 spatstat.data_3.1-4
[22] ggridges_0.5.6 pbapply_1.7-2 Rsamtools_2.20.0
[25] yulab.utils_0.2.0 gson_0.1.0 DOSE_3.30.5
[28] R.utils_2.13.0 parallelly_1.39.0 rstudioapi_0.17.1
[31] RSQLite_2.3.9 generics_0.1.3 gridGraphics_0.5-1
[34] ica_1.0-3 spatstat.random_3.3-2 GO.db_3.19.1
[37] Matrix_1.7-0 abind_1.4-8 R.methodsS3_1.8.2
[40] lifecycle_1.0.4 yaml_2.3.10 SummarizedExperiment_1.34.0
[43] qvalue_2.36.0 SparseArray_1.4.8 Rtsne_0.17
[46] grid_4.4.1 blob_1.2.4 promises_1.3.2
[49] crayon_1.5.3 miniUI_0.1.1.1 lattice_0.22-6
[52] cowplot_1.1.3 KEGGREST_1.44.1 pillar_1.10.1
[55] fgsea_1.30.0 rjson_0.2.23 boot_1.3-31
[58] future.apply_1.11.3 codetools_0.2-20 fastmatch_1.1-4
[61] leiden_0.4.3.1 glue_1.7.0 ggfun_0.1.8
[64] spatstat.univar_3.1-1 data.table_1.16.4 vctrs_0.6.5
[67] png_0.1-8 treeio_1.28.0 spam_2.11-0
[70] Rdpack_2.6.2 gtable_0.3.6 cachem_1.1.0
[73] rbibutils_2.3 S4Arrays_1.4.1 mime_0.12
[76] tidygraph_1.3.1 reformulas_0.4.0 survival_3.7-0
[79] SingleCellExperiment_1.26.0 RcppRoll_0.3.1 fitdistrplus_1.2-2
[82] ROCR_1.0-11 nlme_3.1-166 ggtree_3.12.0
[85] bit64_4.6.0-1 RcppAnnoy_0.0.22 irlba_2.3.5.1
[88] KernSmooth_2.23-24 colorspace_2.1-1 DBI_1.2.3
[91] tidyselect_1.2.1 bit_4.5.0.1 compiler_4.4.1
[94] curl_6.0.1 httr2_1.1.0 DelayedArray_0.30.1
[97] plotly_4.10.4 shadowtext_0.1.4 scales_1.3.0
[100] lmtest_0.9-40 rappdirs_0.3.3 stringr_1.5.1
[103] digest_0.6.37 goftest_1.2-3 spatstat.utils_3.1-1
[106] minqa_1.2.8 htmltools_0.5.8.1 pkgconfig_2.0.3
[109] lme4_1.1-36 MatrixGenerics_1.16.0 fastmap_1.2.0
[112] rlang_1.1.4 htmlwidgets_1.6.4 UCSC.utils_1.0.0
[115] shiny_1.10.0 farver_2.1.2 zoo_1.8-12
[118] jsonlite_1.8.9 BiocParallel_1.38.0 GOSemSim_2.30.2
[121] R.oo_1.27.0 RCurl_1.98-1.16 magrittr_2.0.3
[124] GenomeInfoDbData_1.2.12 ggplotify_0.1.2 dotCall64_1.2
[127] munsell_0.5.1 Rcpp_1.0.13 ape_5.8`
Q: How to fix the internal bug in RegionStats?
A: To fix the internal bug in RegionStats, you need to ensure that the