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

Update convenience.R Xenium new blank unassigned assay #7346

Open
wants to merge 1 commit into
base: seurat5
Choose a base branch
from

Conversation

Ceallaig33
Copy link

With new version of Xenium output, the output matrix "Blank Codeword" was changed to "Unassigned Codeword". Suggesting change to allow import of this updated Xenium output. Not sure if a data version check needs to also be included. Thanks @aclark5 for finding this.

Note

Thanks for your interest in contributing! Please make your PR to the develop branch. You can check out our wiki for the current developers guide.

With new version of Xenium output, the output matrix "Blank Codeword" was changed to "Unassigned Codeword". Suggesting change to allow import of this updated Xenium output. Not sure if a data version check needs to also be included. Thanks @aclark5 for finding this.
@Ceallaig33
Copy link
Author

Note that the fix is already completed on the develop branch, but does not seem to updated on the seurat5 branch

@Margokap
Copy link

Hi there, I've also encountered this issue with Human Xenium data from 10x genomics (https://www.10xgenomics.com/resources/datasets/xenium-human-brain-preview-data-1-standard)

The features.tsv file from this experiment contains "Unassigned Codeword" in lieu of "Blank Codeword"

ie:

data <- ReadXenium(data.dir = data.dir, type =c('centroids', 'segmentation'))
10X data contains more than one type and is being returned as a list containing matrices of each type.
|--------------------------------------------------|
|==================================================|
data$matrix[["Blank Codeword"]]
NULL

however:

data$matrix[["Unassigned Codeword"]]
161 x 24406 sparse Matrix of class "dgCMatrix"
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]

BLANK_0001 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0007 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0008 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0013 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0014 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0016 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0019 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0020 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0021 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0022 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......

..............................
........suppressing 24367 columns and 136 rows in show(); maybe adjust 'options(max.print= *, width = *)'
..............................
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]

BLANK_0460 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0466 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0471 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0472 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0473 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0475 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0483 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0484 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0487 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0489 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0490 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0494 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......

data$matrix[["Unassigned Codeword"]]
161 x 24406 sparse Matrix of class "dgCMatrix"
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]

BLANK_0001 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0007 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0008 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0013 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0014 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0016 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0019 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0020 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0021 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0022 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......

..............................
........suppressing 24367 columns and 136 rows in show(); maybe adjust 'options(max.print= *, width = *)'
..............................
[[ suppressing 39 column names ‘barcodes’, ‘1’, ‘2’ ... ]]

BLANK_0460 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0466 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0471 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0472 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0473 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0475 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0483 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0484 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0487 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0489 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0490 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ......
BLANK_0494 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

To try to resolve this issue, I used the following:

remotes::install_github(repo = 'Ceallaig33/seurat', ref = 'patch-1')

but am still unable to load the Xenium data:
reprex:

xeni-human <- LoadXenium(data.dir = data.dir)
10X data contains more than one type and is being returned as a list containing matrices of each type.
|--------------------------------------------------|
|==================================================|
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Warning: Feature names cannot have underscores (''), replacing with dashes ('-')
Error in [[<-:
! Cannot add new cells with [[<-
Run rlang::last_trace() to see where the error occurred

Thank you very much for any possible help or suggestions! I posted this at #7491 and got a little help, was directed here.

&session info:

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

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

other attached packages:
[1] ggplot2_3.4.2 future_1.32.0 dplyr_1.1.2 Seurat_4.9.9.9045 SeuratObject_4.9.9.9086
[6] sp_2.0-0

loaded via a namespace (and not attached):
[1] Rtsne_0.16 colorspace_2.1-0 deldir_1.0-9 ellipsis_0.3.2 ggridges_0.5.4 rprojroot_2.0.3
[7] rstudioapi_0.14 spatstat.data_3.0-1 leiden_0.4.3 listenv_0.9.0 farver_2.1.1 remotes_2.4.2
[13] ggrepel_0.9.3 bit64_4.0.5 fansi_1.0.4 codetools_0.2-18 splines_4.2.1 R.methodsS3_1.8.2
[19] polyclip_1.10-4 spam_2.9-1 jsonlite_1.8.5 ica_1.0-3 cluster_2.1.4 png_0.1-8
[25] R.oo_1.25.0 uwot_0.1.15 shiny_1.7.4 sctransform_0.3.5 spatstat.sparse_3.0-2 compiler_4.2.1
[31] httr_1.4.6 Matrix_1.5-1 fastmap_1.1.1 lazyeval_0.2.2 cli_3.6.1 later_1.3.1
[37] prettyunits_1.1.1 htmltools_0.5.5 tools_4.2.1 igraph_1.5.0 dotCall64_1.0-2 gtable_0.3.3
[43] glue_1.6.2 RANN_2.6.1 reshape2_1.4.4 Rcpp_1.0.10 scattermore_1.2 vctrs_0.6.3
[49] spatstat.explore_3.2-1 nlme_3.1-160 progressr_0.13.0 lmtest_0.9-40 spatstat.random_3.1-5 stringr_1.5.0
[55] ps_1.7.5 globals_0.16.2 mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.3 irlba_2.3.5.1
[61] goftest_1.2-3 MASS_7.3-58.1 zoo_1.8-12 scales_1.2.1 promises_1.2.0.1 spatstat.utils_3.0-3
[67] parallel_4.2.1 RColorBrewer_1.1-3 curl_5.0.1 reticulate_1.30 pbapply_1.7-2 gridExtra_2.3
[73] stringi_1.7.12 desc_1.4.2 pkgbuild_1.4.0 rlang_1.1.1 pkgconfig_2.0.3 matrixStats_1.0.0
[79] lattice_0.20-45 ROCR_1.0-11 purrr_1.0.1 tensor_1.5 patchwork_1.1.2 htmlwidgets_1.6.2
[85] labeling_0.4.2 processx_3.8.1 bit_4.0.5 cowplot_1.1.1 tidyselect_1.2.0 parallelly_1.36.0
[91] RcppAnnoy_0.0.20 plyr_1.8.8 magrittr_2.0.3 R6_2.5.1 generics_0.1.3 pillar_1.9.0
[97] withr_2.5.0 fitdistrplus_1.1-11 survival_3.4-0 abind_1.4-5 tibble_3.2.1 future.apply_1.11.0
[103] crayon_1.5.2 KernSmooth_2.23-20 utf8_1.2.3 spatstat.geom_3.2-1 plotly_4.10.2 grid_4.2.1
[109] data.table_1.14.8 callr_3.7.3 digest_0.6.32 xtable_1.8-4 tidyr_1.3.0 httpuv_1.6.11
[115] R.utils_2.12.2 munsell_0.5.0 viridisLite_0.4.2

@alikhuseynov
Copy link

alikhuseynov commented Jun 29, 2023

I guess, before adding FOVs one should subset them to have the same cells as the object.

coords %<>% 
    # only consider the cells we have counts and a segmentation.
    subset(x = .,
           cells = intersect(x = Cells(x = .[["segmentation"]]),
                               y = Cells(x = xenium.obj)))
xenium.obj[[fov]] <- coords

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

Successfully merging this pull request may close these issues.

None yet

3 participants