Closed ivykos closed 1 year ago
Hi Ivy, the function aggregate_cell_types
will compute these counts.
Best, Dylan
Can you explain the barcodes
parameter? I input what I thought were the barcodes but it returns the error
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'colSums': invalid or not-yet-implemented 'Matrix' subsetting
I used puck@counts@Dimnames[[2]]
as the barcodes parameter
I believe you should try library(Matrix) before executing this function. barcodes is a list of names for the pixels to be considered.
Dylan
On Wed, Feb 8, 2023 at 1:36 PM Ivy K. @.***> wrote:
Can you explain the barcodes parameter? I input what I thought were the barcodes but it returns the error
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'colSums': invalid or not-yet-implemented 'Matrix' subsetting
— Reply to this email directly, view it on GitHub https://github.com/dmcable/spacexr/issues/135#issuecomment-1423070926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUR66NJRPLP3ICKVTQYYPLWWPRTFANCNFSM6AAAAAAUQTLUPU . You are receiving this because you commented.Message ID: @.***>
The Matrix library is loaded, but the error is persisting.
Please post your data and code to reproduce the error.
On Wed, Feb 8, 2023 at 2:16 PM Ivy K. @.***> wrote:
The Matrix library is loaded, but the error is persisting.
— Reply to this email directly, view it on GitHub https://github.com/dmcable/spacexr/issues/135#issuecomment-1423116100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUR66O7IGU5HNWDK2L2VGTWWPWJ3ANCNFSM6AAAAAAUQTLUPU . You are receiving this because you commented.Message ID: @.***>
### Read SN data, make reference
sn_counts <- as.data.frame(GetAssayData(SN, slot="counts"))
cell_types <- SN@active.ident
cell_types <- as.factor(cell_types)
reference <- Reference(sn_counts, cell_types)
### Read visium data
coords.tmp <- read.csv("SAMPLE/spatial/tissue_positions_list.csv")
coords <- data.frame(coords.tmp$barcode,coords.tmp$array_row, coords.tmp$array_col)
rownames(coords) <- coords[,1]
coords <- coords[ -c(1)]
colnames(coords)[1] = "x"
colnames(coords)[2] = "y"
counts <- ReadMtx("SAMPLE/outs/filtered_feature_bc_matrix/matrix.mtx.gz",
cells = "SAMPLE/outs/filtered_feature_bc_matrix/barcodes.tsv.gz",
features = "SAMPLE/outs/filtered_feature_bc_matrix/features.tsv.gz")
puck <- SpatialRNA(coords, counts)
### run RCTD
myRCTD <- create.RCTD(puck, reference, max_cores=1)
myRCTD <- run.RCTD(myRCTD, doublet_mode = 'full')
results <- myRCTD@results
norm_weights <- normalize_weights(results$weights)
cell_type_names <- myRCTD@cell_type_info$info[[2]]
spatialRNA <- myRCTD@spatialRNA
barcodes <- as.list(puck@counts@Dimnames[[2]])
Barcodes is a list of barcodes
> sessioninfo
Error: object 'sessioninfo' not found
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] tibble_3.1.8 stringr_1.4.1 patchwork_1.1.2
[4] viridis_0.6.2 viridisLite_0.4.1 RColorBrewer_1.1-3
[7] devtools_2.4.5 usethis_2.1.6 Matrix_1.5-1
[10] spacexr_2.0.7 BayesSpace_1.6.0 SpatialExperiment_1.6.1
[13] SingleCellExperiment_1.18.1 SummarizedExperiment_1.26.1 Biobase_2.56.0
[16] GenomicRanges_1.48.0 GenomeInfoDb_1.32.4 IRanges_2.30.1
[19] S4Vectors_0.34.0 BiocGenerics_0.42.0 MatrixGenerics_1.8.1
[22] matrixStats_0.62.0 harmony_0.1.0 Rcpp_1.0.9
[25] data.table_1.14.4 hdf5r_1.3.7 dplyr_1.0.10
[28] ggplot2_3.4.0 sp_1.5-1 SeuratObject_4.1.3
[31] Seurat_4.2.1
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 scattermore_0.8 R.methodsS3_1.8.2
[4] maxLik_1.5-2 coda_0.19-4 tidyr_1.2.1
[7] bit64_4.0.5 irlba_2.3.5.1 DelayedArray_0.22.0
[10] R.utils_2.12.1 RCurl_1.98-1.9 doParallel_1.0.17
[13] generics_0.1.3 ScaledMatrix_1.4.1 callr_3.7.2
[16] cowplot_1.1.1 RSQLite_2.2.18 RANN_2.6.1
[19] future_1.29.0 bit_4.0.4 spatstat.data_3.0-0
[22] httpuv_1.6.6 assertthat_0.2.1 promises_1.2.0.1
[25] fansi_1.0.3 dbplyr_2.2.1 igraph_1.3.5
[28] DBI_1.1.3 htmlwidgets_1.5.4 spatstat.geom_3.0-3
[31] purrr_0.3.5 ellipsis_0.3.2 deldir_1.0-6
[34] sparseMatrixStats_1.8.0 vctrs_0.5.0 remotes_2.4.2
[37] ROCR_1.0-11 abind_1.4-5 cachem_1.0.6
[40] withr_2.5.0 progressr_0.11.0 sctransform_0.3.5
[43] prettyunits_1.1.1 scran_1.24.1 mclust_6.0.0
[46] goftest_1.2-3 cluster_2.1.3 lazyeval_0.2.2
[49] crayon_1.5.2 spatstat.explore_3.0-3 labeling_0.4.2
[52] edgeR_3.38.4 pkgconfig_2.0.3 nlme_3.1-157
[55] vipor_0.4.5 pkgload_1.3.1 pals_1.7
[58] rlang_1.0.6 globals_0.16.1 lifecycle_1.0.3
[61] miniUI_0.1.1.1 sandwich_3.0-2 filelock_1.0.2
[64] BiocFileCache_2.4.0 rsvd_1.0.5 dichromat_2.0-0.1
[67] polyclip_1.10-4 lmtest_0.9-40 Rhdf5lib_1.18.2
[70] zoo_1.8-11 beeswarm_0.4.0 ggridges_0.5.4
[73] processx_3.8.0 png_0.1-7 rjson_0.2.21
[76] bitops_1.0-7 R.oo_1.25.0 KernSmooth_2.23-20
[79] rhdf5filters_1.8.0 blob_1.2.3 DelayedMatrixStats_1.18.2
[82] parallelly_1.32.1 spatstat.random_3.0-1 beachmat_2.12.0
[85] scales_1.2.1 memoise_2.0.1 magrittr_2.0.3
[88] plyr_1.8.7 ica_1.0-3 zlibbioc_1.42.0
[91] DirichletReg_0.7-1 compiler_4.2.1 miscTools_0.6-26
[94] dqrng_0.3.0 fitdistrplus_1.1-8 cli_3.4.1
[97] XVector_0.36.0 urlchecker_1.0.1 listenv_0.8.0
[100] pbapply_1.5-0 ps_1.7.2 Formula_1.2-4
[103] MASS_7.3-58 tidyselect_1.2.0 stringi_1.7.8
[106] BiocSingular_1.12.0 locfit_1.5-9.6 ggrepel_0.9.2
[109] grid_4.2.1 tools_4.2.1 future.apply_1.10.0
[112] parallel_4.2.1 rstudioapi_0.14 bluster_1.6.0
[115] foreach_1.5.2 metapod_1.4.0 gridExtra_2.3
[118] farver_2.1.1 Rtsne_0.16 DropletUtils_1.16.0
[121] digest_0.6.30 shiny_1.7.3 quadprog_1.5-8
[124] scuttle_1.6.3 later_1.3.0 RcppAnnoy_0.0.20
[127] httr_1.4.4 colorspace_2.0-3 fs_1.5.2
[130] tensor_1.5 reticulate_1.26 splines_4.2.1
[133] uwot_0.1.14 statmod_1.4.37 spatstat.utils_3.0-1
[136] scater_1.24.0 xgboost_1.6.0.1 mapproj_1.2.9
[139] plotly_4.10.1 sessioninfo_1.2.2 xtable_1.8-4
[142] jsonlite_1.8.3 R6_2.5.1 profvis_0.3.7
[145] pillar_1.8.1 htmltools_0.5.3 mime_0.12
[148] glue_1.6.2 fastmap_1.1.0 BiocParallel_1.30.4
[151] BiocNeighbors_1.14.0 codetools_0.2-18 maps_3.4.1
[154] pkgbuild_1.3.1 utf8_1.2.2 lattice_0.20-45
[157] spatstat.sparse_3.0-0 curl_4.3.3 ggbeeswarm_0.6.0
[160] leiden_0.4.3 magick_2.7.3 survival_3.2-13
[163] limma_3.52.4 munsell_0.5.0 rhdf5_2.40.0
[166] GenomeInfoDbData_1.2.8 iterators_1.0.14 HDF5Array_1.24.2
[169] reshape2_1.4.4 gtable_0.3.1
Please email your data to me at dylanmcable@gmail.com
Dylan
Hi again Dylan. Instead of getting barcodes from the SpatialRNA object, I grabbed them from the myRCTD object and this seems to have solved the problem.
Hi there. Thank you for spacexr, I've found it very useful in my work.
My question is regarding the function plot_cond_occur()
I was hoping to compare two experimental conditions by looking at how cell type proportions change between them. Using the function with my RCTD object outputs the bar graph just like in the Vignette, but I was wondering if you could tell me where these count numbers are stored so that I can do some significance testing.
Thank you again