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

BPcells doesn't work with chromatin Assay #1507

Open
LucaTucciarone opened this issue Oct 10, 2023 · 4 comments
Open

BPcells doesn't work with chromatin Assay #1507

LucaTucciarone opened this issue Oct 10, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@LucaTucciarone
Copy link

BPCells doesn't wok with chromatin assay

I am working with a big multiomics object. I updated Seurat to Version 5, because I need the support of BPcells to avoid breaking R because of the size of the matrix I am working with.

This works just fine:
reference = readRDS(multiome.dir)
DefaultAssay(reference) <- 'ATAC'
write_matrix_dir(mat = reference[["ATAC"]]$counts, dir = paste0(reference.map.dir, "multiome_counts"))

304316 x 57064 IterableMatrix object with class MatrixDir
Row names: chr1-100006443-100006958, chr1-10001125-10001359 ... chrY-9160959-9161339
Col names: JB_631_627_AAACATGCAAGGTCCT-1, JB_631_627_AAACCGAAGTAACCCG-1 ... QY_2021_2020_GTGGTTAGTCTTACTA-1
Data type: double
Storage order: column major
Queued Operations:

  1. Load compressed matrix from directory /nfs/lab/projects/Heart_LV/data/reference.map/multiome_counts

counts.mat <- open_matrix_dir(dir = paste0(reference.map.dir, "multiome_counts"))

Then here I get the error:
reference[["ATAC"]]$counts <- counts.mat

Error:
Error in SetAssayData.ChromatinAssay(object = object, slot = layer, new.data = value): Data must be a matrix or sparseMatrix

thoughts?
Here my session info:
R version 4.2.3 (2023-03-15)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS/LAPACK: /home/luca/.conda/envs/seurat5_bpcells/lib/libopenblasp-r0.3.24.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] grid parallel stats4 stats graphics grDevices utils
[8] datasets methods base

other attached packages:
[1] ggh4x_0.2.6 patchwork_1.1.3
[3] gridExtra_2.3 ggbreak_0.1.2
[5] ggrepel_0.9.3 ggpubr_0.6.0
[7] ggplot2_3.4.3 logr_1.3.4
[9] EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.22.0
[11] AnnotationFilter_1.22.0 GenomicFeatures_1.50.4
[13] AnnotationDbi_1.60.2 Biobase_2.58.0
[15] GenomicRanges_1.50.2 GenomeInfoDb_1.34.9
[17] IRanges_2.32.0 S4Vectors_0.36.2
[19] BiocGenerics_0.44.0 BPCells_0.1.0
[21] SoupX_1.6.2 knitr_1.44
[23] harmony_1.0.3 Rcpp_1.0.11
[25] Signac_1.11.9000 Seurat_4.9.9.9067
[27] SeuratObject_4.9.9.9091 sp_2.1-0
[29] hdf5r_1.3.8 Matrix_1.6-1.1
[31] tidyr_1.3.0 data.table_1.14.8
[33] stringr_1.5.0 dplyr_1.1.3
[35] reticulate_1.32.0

loaded via a namespace (and not attached):
[1] pacman_0.5.1 utf8_1.2.3
[3] spatstat.explore_3.2-3 tidyselect_1.2.0
[5] RSQLite_2.3.1 htmlwidgets_1.6.2
[7] BiocParallel_1.32.6 Rtsne_0.16
[9] munsell_0.5.0 codetools_0.2-19
[11] ica_1.0-3 pbdZMQ_0.3-10
[13] future_1.33.0 miniUI_0.1.1.1
[15] withr_2.5.1 spatstat.random_3.1-6
[17] colorspace_2.1-0 progressr_0.14.0
[19] filelock_1.0.2 uuid_1.1-1
[21] ROCR_1.0-11 ggsignif_0.6.4
[23] tensor_1.5 listenv_0.9.0
[25] MatrixGenerics_1.10.0 repr_1.1.6
[27] GenomeInfoDbData_1.2.9 polyclip_1.10-6
[29] bit64_4.0.5 parallelly_1.36.0
[31] vctrs_0.6.3 generics_0.1.3
[33] xfun_0.40 BiocFileCache_2.6.1
[35] R6_2.5.1 gridGraphics_0.5-1
[37] DelayedArray_0.24.0 bitops_1.0-7
[39] spatstat.utils_3.0-3 cachem_1.0.8
[41] promises_1.2.1 BiocIO_1.8.0
[43] scales_1.2.1 gtable_0.3.4
[45] globals_0.16.2 goftest_1.2-3
[47] spam_2.9-1 rlang_1.1.1
[49] RcppRoll_0.3.0 splines_4.2.3
[51] rstatix_0.7.2 rtracklayer_1.58.0
[53] lazyeval_0.2.2 broom_1.0.5
[55] spatstat.geom_3.2-5 yaml_2.3.7
[57] reshape2_1.4.4 abind_1.4-5
[59] backports_1.4.1 httpuv_1.6.11
[61] tools_4.2.3 ggplotify_0.1.2
[63] ellipsis_0.3.2 RColorBrewer_1.1-3
[65] ggridges_0.5.4 plyr_1.8.9
[67] base64enc_0.1-3 progress_1.2.2
[69] zlibbioc_1.44.0 purrr_1.0.2
[71] RCurl_1.98-1.12 prettyunits_1.2.0
[73] deldir_1.0-9 pbapply_1.7-2
[75] cowplot_1.1.1 zoo_1.8-12
[77] SummarizedExperiment_1.28.0 cluster_2.1.4
[79] fs_1.6.3 magrittr_2.0.3
[81] RSpectra_0.16-1 scattermore_1.2
[83] lmtest_0.9-40 RANN_2.6.1
[85] ProtGenerics_1.30.0 fitdistrplus_1.1-11
[87] matrixStats_1.0.0 hms_1.1.3
[89] mime_0.12 evaluate_0.22
[91] xtable_1.8-4 XML_3.99-0.14
[93] fastDummies_1.7.3 compiler_4.2.3
[95] biomaRt_2.54.1 tibble_3.2.1
[97] KernSmooth_2.23-22 crayon_1.5.2
[99] htmltools_0.5.6.1 ggfun_0.1.3
[101] later_1.3.1 aplot_0.2.2
[103] DBI_1.1.3 dbplyr_2.3.4
[105] MASS_7.3-60 rappdirs_0.3.3
[107] car_3.1-2 cli_3.6.1
[109] dotCall64_1.0-2 igraph_1.5.1
[111] pkgconfig_2.0.3 GenomicAlignments_1.34.1
[113] IRdisplay_1.1 plotly_4.10.2
[115] spatstat.sparse_3.0-2 xml2_1.3.5
[117] XVector_0.38.0 yulab.utils_0.1.0
[119] digest_0.6.33 sctransform_0.4.0
[121] RcppAnnoy_0.0.21 common_1.0.9
[123] spatstat.data_3.0-1 Biostrings_2.66.0
[125] leiden_0.4.3 fastmatch_1.1-4
[127] uwot_0.1.16 restfulr_0.0.15
[129] curl_5.1.0 shiny_1.7.5
[131] Rsamtools_2.14.0 rjson_0.2.21
[133] lifecycle_1.0.3 nlme_3.1-163
[135] jsonlite_1.8.7 carData_3.0-5
[137] viridisLite_0.4.2 fansi_1.0.4
[139] pillar_1.9.0 lattice_0.21-9
[141] KEGGREST_1.38.0 fastmap_1.1.1
[143] httr_1.4.7 survival_3.5-7
[145] glue_1.6.2 png_0.1-8
[147] bit_4.0.5 stringi_1.7.12
[149] blob_1.2.4 RcppHNSW_0.5.0
[151] memoise_2.0.1 IRkernel_1.3.2
[153] irlba_2.3.5.1 future.apply_1.11.0

@LucaTucciarone LucaTucciarone added the bug Something isn't working label Oct 10, 2023
@LucaTucciarone LucaTucciarone changed the title BPcells BPcells doesn't work with chromatin Assay Oct 10, 2023
@timoast
Copy link
Collaborator

timoast commented Oct 11, 2023

We do not currently support v5 chromatin assays, this will require a substantial amount of work to build the software. Hopefully we can support this in the future

@timoast timoast added enhancement New feature or request and removed bug Something isn't working labels Oct 11, 2023
@LucaTucciarone
Copy link
Author

Is there an idea of if/when this may happen?
ATACseq its R limitations way more often than RNAseq, that's the whole point of bpcells in my opinion, so it would be very valuable to be able to load the matrixDir in a chromatin assay.

I did try to recreate the assay in this way:
reference[["ATAC"]] <- CreateChromatinAssay(
counts = counts.mat,
sep = c(":", "-"),
genome='hg38',
fragments=frag.file,
min.cells=10, min.features=-1,
annotation=annotations,
)

It works, but seems like the class of reference[["ATAC"]]$counts goes back to dgmatrix anyways

@timoast
Copy link
Collaborator

timoast commented Oct 12, 2023

I agree with you, we just don't have the resources to do this right now. I am trying to find funding support to hire a developer, which would enable these improvements as well as several others

@shahrozeabbas
Copy link

Just offering another vote for this enhancement. This is becoming increasingly necessary it seems.

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

No branches or pull requests

3 participants