Git Product home page Git Product logo

spotlight's People

Contributors

catalyst-project avatar federicomarini avatar jwokaty avatar marcelosua avatar nturaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spotlight's Issues

arguments explanation

Hi,

would it be possible to have a brief eplanation of ouple of arguments?

  • hvg. The default it's 0, what does it mean?
  • ntop. It says that the default is't 100 in the docs, but then the actual default is NULL? See pic
    image

Thank you!

Spot composition visualization

Hi,

I am trying to compare your deconvolution method with Seurat integration method. To do so, I am trying to reproduce your vignette with some Visium public dataset (kidney mouse). Single cell data used for the deconvolution comes from a RDS file storing a merged dataset (4 scRNA seq) that i have annotated (a column carries the information about cell type for each cell).

I didn't get warning from the code i was running (the same than your vignette) but my visualization showed almost every spot with unknown label:

Spotlight_deconvolution

Deconvolution_all

I thought the deconvolution went fine by looking to the topic profiles but i may be wrong:
NMF

I was able to annotated these data through Seurat integrated method which is similar than deconvolution:

Seurat_annotation_integrated

Best,

R4.01

Installation in R 4.01 (with dplyr 1.02) is not working or at least causing problems (from github). In my case, the problem is due to some files of the package .RDS files which include an old version of dplyr. Sourcing the code makes it work. Nice package!

Cannot repeat the same result with the SPOTlight 1.0.0

I run SPOTlight 0.1.7 and 1.0.0 with the same single cell data to model nsNMF and the same spatial date to deconvolution. But I got different annotated spatial results.

When I compared your R scripts, I found your W and H matrices having different dimensions to the 0.1.7 version.
0.1.7: W is of dimension (#groups)x(#features), H is of dimension (#samples)x(#groups)
1.0.0: W is of dimension (#features)x(#groups), H is of dimension (#groups)x(#samples)
Because the order of multiplication is essential, so I'm afraid the new version 1.0.0 of SPOTlight could not give the same calculations as your paper described.

Could you help me to find the reason to this difference?
Thank you!

A typo in updated vignette

Hi there. Maybe there is a typo in the updated vignette. In line 237, n_cells <- 2 should be modified to n_cells <- 20 which means downsample to at most 20 per identity. Am I right?

Error: 'spotlight_deconvolution' is not an exported object from 'namespace:SPOTlight'

After updating my R version and re-installing SPOTlight via github via the following command:

devtools::install_github("https://github.com/MarcElosua/SPOTlight")

I am getting the above error. Do you know how to fix this issue? I have tried re-installing without success. In the past, SPOTlight has worked for me (version 0.1.7, whereas now it looks like version 0.99.4 is installed)

Thanks in advance!

SessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.2.1

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

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

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

other attached packages:
[1] org.Mm.eg.db_3.14.0 AnnotationDbi_1.56.2 IRanges_2.28.0 S4Vectors_0.32.3
[5] clusterProfiler_4.2.2 patchwork_1.1.1 hdf5r_1.3.5 amap_0.8-18
[9] corrplot_0.92 reshape_0.8.8 cowplot_1.1.1 tibble_3.1.6
[13] RColorBrewer_1.1-2 igraph_1.2.11 SPOTlight_0.99.4 data.table_1.14.2
[17] Matrix_1.4-0 gridExtra_2.3 dplyr_1.0.8 ggplot2_3.3.5
[21] Seurat_4.1.0 Biobase_2.54.0 BiocGenerics_0.40.0 SeuratObject_4.0.4

loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.24 tidyselect_1.1.2
[4] RSQLite_2.2.10 htmlwidgets_1.5.4 gmp_0.6-4
[7] grid_4.1.1 BiocParallel_1.28.3 Rtsne_0.15
[10] scatterpie_0.1.7 munsell_0.5.0 codetools_0.2-18
[13] ica_1.0-2 future_1.24.0 miniUI_0.1.1.1
[16] withr_2.5.0 spatstat.random_2.1-0 colorspace_2.0-3
[19] GOSemSim_2.20.0 rstudioapi_0.13 SingleCellExperiment_1.16.0
[22] ROCR_1.0-11 tensor_1.5 DOSE_3.20.1
[25] listenv_0.8.0 NMF_0.23.0 labeling_0.4.2
[28] MatrixGenerics_1.6.0 GenomeInfoDbData_1.2.7 polyclip_1.10-0
[31] pheatmap_1.0.12 bit64_4.0.5 farver_2.1.0
[34] downloader_0.4 treeio_1.18.1 parallelly_1.30.0
[37] vctrs_0.3.8 generics_0.1.2 R6_2.5.1
[40] doParallel_1.0.17 GenomeInfoDb_1.30.1 graphlayouts_0.8.0
[43] gridGraphics_0.5-1 bitops_1.0-7 spatstat.utils_2.3-0
[46] cachem_1.0.6 fgsea_1.20.0 DelayedArray_0.20.0
[49] assertthat_0.2.1 arrangements_1.1.9 promises_1.2.0.1
[52] scales_1.1.1 ggraph_2.0.5 enrichplot_1.14.2
[55] gtable_0.3.0 globals_0.14.0 goftest_1.2-3
[58] tidygraph_1.2.0 rlang_1.0.2 splines_4.1.1
[61] lazyeval_0.2.2 spatstat.geom_2.3-2 reshape2_1.4.4
[64] abind_1.4-5 httpuv_1.6.5 qvalue_2.26.0
[67] tools_4.1.1 ggplotify_0.1.0 gridBase_0.4-7
[70] ellipsis_0.3.2 spatstat.core_2.4-0 ggridges_0.5.3
[73] Rcpp_1.0.8 plyr_1.8.6 zlibbioc_1.40.0
[76] purrr_0.3.4 RCurl_1.98-1.6 rpart_4.1.16
[79] deldir_1.0-6 pbapply_1.5-0 viridis_0.6.2
[82] zoo_1.8-9 SummarizedExperiment_1.24.0 ggrepel_0.9.1
[85] cluster_2.1.2 magrittr_2.0.2 RSpectra_0.16-0
[88] scattermore_0.8 DO.db_2.9 lmtest_0.9-39
[91] RANN_2.6.1 fitdistrplus_1.1-6 matrixStats_0.61.0
[94] mime_0.12 xtable_1.8-4 compiler_4.1.1
[97] gt_0.4.0 shadowtext_0.1.1 KernSmooth_2.23-20
[100] crayon_1.5.0 htmltools_0.5.2 ggfun_0.0.5
[103] mgcv_1.8-39 later_1.3.0 tidyr_1.2.0
[106] aplot_0.1.2 DBI_1.1.2 tweenr_1.0.2
[109] MASS_7.3-55 cli_3.2.0 parallel_4.1.1
[112] GenomicRanges_1.46.1 pkgconfig_2.0.3 registry_0.5-1
[115] plotly_4.10.0 spatstat.sparse_2.1-0 foreach_1.5.2
[118] ggtree_3.2.1 ggcorrplot_0.1.3 rngtools_1.5.2
[121] pkgmaker_0.32.2 XVector_0.34.0 yulab.utils_0.0.4
[124] stringr_1.4.0 digest_0.6.29 sctransform_0.3.3
[127] RcppAnnoy_0.0.19 spatstat.data_2.1-2 Biostrings_2.62.0
[130] leiden_0.3.9 fastmatch_1.1-3 tidytree_0.3.9
[133] uwot_0.1.11 shiny_1.7.1 lifecycle_1.0.1
[136] nlme_3.1-155 jsonlite_1.8.0 viridisLite_0.4.0
[139] fansi_1.0.2 pillar_1.7.0 lattice_0.20-45
[142] KEGGREST_1.34.0 fastmap_1.1.0 httr_1.4.2
[145] survival_3.3-1 GO.db_3.14.0 glue_1.6.2
[148] png_0.1-7 iterators_1.0.14 bit_4.0.4
[151] ggforce_0.3.3 stringi_1.7.6 nnls_1.4
[154] blob_1.2.2 memoise_2.0.1 ape_5.6-2
[157] irlba_2.3.5 future.apply_1.8.1

support for SingleCellExperiment or just count matrices?

Hi,

thank you for developing this interesting package.
I was wondering whether it would be possible to add support to SingleCellExperiment for the sc_count or just count matrices (if that's the case, then it would be nice allowing the various markers etc. arguments to just accepts e.g. vectors).

Thank you!

Question for multiple ST samples

Dear MarcElosua,

I have multiple ST samples in one experiment. I am wondering, once my NMF model is trained ( nmf_mod_ls in the tutorial), can I use one NMF model for multiple ST samples to deconvolve the mixture/spots?

What conditions do the samples need to satisfy before I could try using the same NMF model? Or would you recommend always training the NMF again for each sample?

Thanks,

install error

Dear developer,

I know this install error has been reported, but I tried different ways to install, still did not work. Can you help me? I am using M1 chip MacBook and r version was 4.1

install_github("https://github.com/MarcElosua/SPOTlight")
Downloading GitHub repo MarcElosua/SPOTlight@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: GenomeInf... (1.2.4 -> 1.2.7) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
✓ checking for file ‘/private/var/folders/by/2dc9qylx40d5f6kfx153psxw0000gn/T/Rtmpi0E0XM/remotes172144398a0c5/MarcElosua-SPOTlight-8f77e35/DESCRIPTION’ ...
─ preparing ‘SPOTlight’:
✓ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘SPOTlight_0.99.9.tar.gz’

Error: 5:1: unexpected input
4:
5:
^
Execution halted
Warning message:
In i.p(...) :
installation of package ‘/var/folders/by/2dc9qylx40d5f6kfx153psxw0000gn/T//Rtmpi0E0XM/file172145963082e/SPOTlight_0.99.9.tar.gz’ had non-zero exit status

Thanks a lot for your time

Error in installation

Hi, I am having trouble installing SPOTlight. When I run the command:

devtools::install_git("https://github.com/MarcElosua/SPOTlight")

I get the following error:
Downloading GitHub repo satijalab/seurat@spatial
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://api.github.com/repos/satijalab/seurat/tarball/spatial'
✓ checking for file ‘/private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/Rtmpj3iotG/file13b7e5725b352/DESCRIPTION’ ...
─ preparing ‘SPOTlight’: (622ms)
✓ checking DESCRIPTION meta-information
Warning: /private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/RtmprOI0PX/Rbuild13c2121ab3e7/SPOTlight/man/mixture_deconvolution_nmf.Rd:26: unexpected section header '\value'
Warning: /private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/RtmprOI0PX/Rbuild13c2121ab3e7/SPOTlight/man/mixture_deconvolution_nmf.Rd:29: unexpected section header '\description'
Warning: /private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/RtmprOI0PX/Rbuild13c2121ab3e7/SPOTlight/man/mixture_deconvolution_nmf.Rd:32: unexpected section header '\examples'
Warning: /private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/RtmprOI0PX/Rbuild13c2121ab3e7/SPOTlight/man/spotlight_deconvolution.Rd:56: unexpected END_OF_INPUT '
'
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
NB: this package now depends on R (>= 3.5.0)
WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/inst/allen_cortex_dwn.rds' WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/inst/markers_anterior.RDS' WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/inst/spotlight_ls_anterior.RDS' WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/sample_data/allen_cortex_dwn.rds' WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/sample_data/markers_anterior.RDS' WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'SPOTlight/sample_data/spotlight_ls_anterior.RDS'
─ building 'SPOTlight_0.1.7.tar.gz'

  • installing source package ‘SPOTlight’ ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    Error : (converted from warning) /private/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T/RtmplKXRp9/R.INSTALL13c2e267f523e/SPOTlight/man/mixture_deconvolution_nmf.Rd:26: unexpected section header '\value'
    ERROR: installing Rd objects failed for package ‘SPOTlight’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/SPOTlight’
    Error: Failed to install 'unknown package' from Git:
    (converted from warning) installation of package ‘/var/folders/nt/fw_0vt6n647_d_zvvngdkj_c0000gn/T//Rtmpj3iotG/file13b7e6046a5bd/SPOTlight_0.1.7.tar.gz’ had non-zero exit status

Please help. Is there a dependency that I am missing?

Topics to Cell types

Hi,

How do you go from topics to cell types using the SPOTlight code?

When I run the example code (SPOTlight_kidney.Rmd) I only obtain "topics" and not the Cell types, except for the plotTopicProfiles(...facet=TRUE) in the end of section 4.1.

Is it correct that for instance the ScatterPie in section 4.4 show the distribution of topics instead of cell types?

Section 4 4

And that the first graph in section 4.1 show topic signatures against topic signatures and not cell types. Why then specify cell types in the command, plotTopicProfiles( x = mod, y = sce$free_annotation, ... )?

Section 4 1 1

spatial_scatterplot spots not aligned with image

Hello,
I am trying to plot the spot composition using your spatial_scatterplot function. It works great for 2 out 4 of my samples. But for the other ones the spots are misaligned form the sample image even though I use the exact same code. Here it is :
SPOTlight::spatial_scatterpie(se_obj=C140,
cell_types_all = cell_types_all_C140,
img_path = "/home/Morgane/Visium/Human/C363-c12/outs/spatial/tissue_lowres_image.png",
slice=C140,
pie_scale = 0.8)

Would you be able to help with that please?
thanks for this great tool.
Morgane

Questions concerning the workflow of SPOTlight

Thank you for your very interesting tool!
I am following the updated vignette and have a few questions:

  1. I have used Seurat to analyse my single-cell data and used FindAllMarkers with only.pos = TRUE. I then filtered the markers based on pct, adjusted p value and log2FC. Can I use these markers as input for the mgs parameter? If so, I do not have the mean.AUC. Can I use the log2FC, p-val or a combination thereof for the weight_id parameter?
  2. I use WhichCells with the downsample parameter on the seurat object for downsampling. Since I have a large dataset with many cells and a few subpopulations are quite similar, I was thinking to use more cells than the suggested 100. How many would be sensible?
  3. Am I correct in assuming that hvg = 2000 extracts the 2000 variable features of the seurat object? Or should I extract them and use them as input?
  4. I hope this command looks ok:
res <- SPOTlight(
  x = sc_down,
  y = spatial@assays$Spatial@counts,
  groups = as.character(sc_down$ann),
  mgs = cluster_markers_all, # markers from FindAllMarkers
  hvg = 2000,
  weight_id = "avg_log2FC",
  group_id = "cluster",
  gene_id = "gene"
) 

Thank you so much in advance!

Cell overabundance in deconvolution

Greetings,

I have been trying to deconvolute my spatial data using a single-cell dataset of ours, however, for some reason a known cell-type is appearing to be much too abundant in the deconvoluted spots. When I look at a FeaturePlot of a gene specific for this cell type, there are only a few spots. If I set min_cont to a cutoff where the expression is more appropriate, it ends up cutting off another cell type of interest.

Any ideas of what to do here? Could it be a problem with the resolution of my reference data set? The topic profile for this cell type is specific for only this cell type. Is this potentially noise caused by the LS method?

image

Any help would be appreciated as I've tried a few things to try and get around this and none have worked thus far.

Cheers,

Griffen

get_spatial_interaction_graph_fun.R

First, thanks for this fantastic tool! However, as I'm following the vignette, I have some issues understanding the calculation behind get_spatial_interaction_graph_fun

In particular, I didn't quite follow how the importance of the network is calculated by the algorithm. Besides, is there a reason why the row sum of decon_mtrx is not 1? Intuitively, since the row sum represents the sum of the composition of all possible cell types across one spot, the sum should be 1. I'd really appreciate any help~

spatial interaction graph - plotting error

Hi Marc,

Firstly SPOTlight is an awesome package - really useful for our spatial data.

I appear to have an issue with the spatial interaction graph plotting (see attached pdf) - as you can see the plot is absent of all labelling and I cannot work out why as all other aspects of your vignette have worked superbly.

Any thoughts on how to address this issue?

BW

Kev

Plot_error.pdf

train_nmf run time

I have a single-cell data set that has approximately 50k cells and 20 celltypes. I have downsampled this dataset as per your example in the vignette

se_sc_down <- downsample_se_obj(se_obj = sc_data,
                                clust_vr = "celltypes",
                                cluster_markers = cluster_markers_all,
                                cl_n = 100,
                                hvg = 3000)

I'm trying to use SPOTlight for deconvolution but the train_nmf function is taking a really long time. I'm about 1 hr in and wondering if this is to be expected or if there is anything that I can do to speed the process up.

Thanks for your help.

Error with NMF function when running spotlight_deconvolution

Hi,

Thank you so much for developing this really interesting tool! I've been using it on some Visium datasets with mixed success. Sometimes spotlight_ls will run without any errors but sometimes it throws an error related to the NMF package/function:

"Error: NMF::nmf - Input matrix x contains at least one null or NA-filled row."

This error seems to happen almost randomly, as sometimes spotlight_deconvolution will run without errors and sometimes it gives the error above, without me changing any of the inputs to the function. Any advice? I'm running R version 3.6.3 and SPOTlight version 0.1.4. Thank you!

Insufficient number of features shared between single-cell and mixture dataset.

Hi there. When I run SPOTlight(), there is an error that says Insufficient number of features shared between single-cell and mixture dataset.. What's the meaning and how can I fix it? Thanks a lot!

I'm annotating a Visium FFPE data using a reference scRNA-seq data. I wonder whether the inconsistency between the total number of genes detected in Visium and scRNA-seq leads to the above error?

"Preparing Gene set" error

Hello,

I am trying to follow through the tutorial as is on the main page, I downloaded the data directly from the 'sample data' directory. All processing steps prior to running the deconvolution are perfect, however while running the spotlight_deconvolution step, I get an error:

Calculating gene variances
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating feature variances of standardized and clipped values
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
[1] "Preparing Gene set"
Error in rowSums(mtrx_spatial == 0) :
'x' must be an array of at least two dimensions

Could you please assist me with resolving this? Please let me know what further information you could need. Thanks!

EDIT: I also tried directly loading the spotlight_ls_anterior.rds file provided. On doing that, when I plot the scatterplot using spatial_scatterpie, I get an error:
Error in is.data.frame(col_df) : object 'col_df' not found

SPOTlight Compatibility with Staffli Objects Generated from STUtility

Hi!

I have been processing some 10X Visium data with STUtility. The pipeline generated therein returns a Staffli object where the scaled images in raster format and coordinates for the corresponding spots are saved.

I later turned the Staffli object into a Seurat object to do harmony integration and clustering analysis, but when I try to plot the Spatial Scatterpie it does not return. Do you have any suggestions on accessing the Staffli data?

could not find function "downsample_se_obj"

Hi,
I am trying to do downsampling a data reference for deconvolution, have installed the library but getting this error:
could not find function "downsample_se_obj"
Is this function in spotlight package?
I am using these libraries:
library(Seurat)
library(ggplot2)
library(dplyr)
library(purrr)
library(SPOTlight)
library(NMF)
library(nnls)
library(scrattch.io)
library(scater)
library(scran)

a new error encountered

Hi,

I encountered an error when run deconvolution:

Error in nnls::nnls(A = W, b = count_mtrx[, i]): NA/NaN/Inf in foreign function call (arg 5)
Traceback:

  1. spotlight_deconvolution(se_sc = qin, counts_spatial = st_data[[1]]@assays$Spatial@counts[,
    . 1:2], clust_vr = "majorCluster", cluster_markers = cell_type_markers,
    . cl_n = 10, hvg = 300, ntop = NULL, transf = "uv", method = "nsNMF",
    . min_cont = 0)
  2. mixture_deconvolution_nmf(nmf_mod = nmf_mod_ls[[1]], mixture_transcriptome = counts_spatial,
    . transf = transf, reference_profiles = ct_topic_profiles,
    . min_cont = min_cont)
  3. predict_spatial_mixtures_nmf(nmf_mod = nmf_mod, mixture_transcriptome = mixture_transcriptome,
    . transf = transf)
  4. nnls::nnls(A = W, b = count_mtrx[, i])

No idea why this happened.

Hope get some help, thanks!

Issues using plotSpatialScatterpie() with Seurat

Hi,
I was trying to use SPOTlight on visium data saved as a Seurat object. However, I ran into this issue:

image

I looked at the code and it seems like the Seurat object x is getting converted into a matrix before the plotImage() step. This was done here when extracting coordinates from the Seurat object:

image

This is problematic as extracting the image requires that x remains a Seurat object.

image

I tried submitting a PR but didn't have write access. I was able to solve it locally by giving the newly created x matrix a new name instead of replacing the Seurat object. Here’s my session info (sorry it’s so big)

image

topic and cell type ?

what is the different meaning about topic and cell type?
could not understand why use NNLS lastly to solve Q and P since last step have solved the ST data propotion?

spatial_scatterpie does not work

Hi.
I use the demo data and demo code to run the basic workflow. I can not use Rstudio on my server while other code and results are run the same way as in the workflow except the spatial_scatterpie.
The spatial_scatterpie does not work. It gives the original .png file without any pies and labels on it. The spatial_scatterpie also return two warning:
1: In SPOTlight::spatial_scatterpie(se_obj = anterior, cell_types_all = cell_types_all, :Using slice anterior1
2: Removed 62008 rows containing non-finite values (stat_pie)

Could you give me any suggestions? Thanks.

R and related package shows below:

R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /data/home/998_temp/anaconda3/envs/spotlight/lib/libopenblasp-r0.3.12.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 stats graphics grDevices utils datasets
[8] methods base

other attached packages:
[1] jpeg_0.1-8.1 png_0.1-7
[3] imager_0.42.8 magrittr_2.0.1
[5] cowplot_1.1.1 ggplot2_3.3.3
[7] tidyr_1.1.3 stringr_1.4.0
[9] nnls_1.4 edgeR_3.32.1
[11] limma_3.46.0 NMF_0.23.0
[13] Biobase_2.50.0 BiocGenerics_0.36.0
[15] cluster_2.1.1 rngtools_1.5
[17] pkgmaker_0.32.2 registry_0.5-1
[19] tibble_3.1.1 purrr_0.3.4
[21] RColorBrewer_1.1-2 igraph_1.2.6
[23] SPOTlight_0.1.6 gt_0.2.2
[25] dplyr_1.0.5 stxBrain.SeuratData_0.1.1
[27] SeuratData_0.2.1 SeuratObject_4.0.0
[29] Seurat_4.0.1 data.table_1.14.0
[31] Matrix_1.3-2

loaded via a namespace (and not attached):
[1] backports_1.2.1 plyr_1.8.6 lazyeval_0.2.2
[4] splines_4.0.3 crosstalk_1.1.1 listenv_0.8.0
[7] scattermore_0.7 gridBase_0.4-7 digest_0.6.27
[10] foreach_1.5.1 htmltools_0.5.1.1 tiff_0.1-8
[13] fansi_0.4.2 checkmate_2.0.0 tensor_1.5
[16] doParallel_1.0.16 ROCR_1.0-11 globals_0.14.0
[19] matrixStats_0.58.0 spatstat.sparse_2.0-0 colorspace_2.0-0
[22] rappdirs_0.3.3 ggrepel_0.9.1 crayon_1.4.1
[25] jsonlite_1.7.2 scatterpie_0.1.5 spatstat.data_2.1-0
[28] survival_3.2-10 zoo_1.8-9 iterators_1.0.13
[31] glue_1.4.2 polyclip_1.10-0 gtable_0.3.0
[34] leiden_0.3.7 future.apply_1.7.0 abind_1.4-5
[37] scales_1.1.1 miniUI_0.1.1.1 Rcpp_1.0.6
[40] viridisLite_0.4.0 xtable_1.8-4 reticulate_1.18
[43] spatstat.core_2.1-2 DT_0.18 htmlwidgets_1.5.3
[46] httr_1.4.2 ellipsis_0.3.1 ica_1.0-2
[49] pkgconfig_2.0.3 farver_2.1.0 sass_0.3.1
[52] uwot_0.1.10 deldir_0.2-10 locfit_1.5-9.4
[55] utf8_1.2.1 tidyselect_1.1.0 labeling_0.4.2
[58] rlang_0.4.10 reshape2_1.4.4 later_1.1.0.1
[61] munsell_0.5.0 tools_4.0.3 cli_2.4.0
[64] generics_0.1.0 ggridges_0.5.3 fastmap_1.1.0
[67] yaml_2.2.1 goftest_1.2-2 fitdistrplus_1.1-3
[70] RANN_2.6.1 readbitmap_0.1.5 pbapply_1.4-3
[73] future_1.21.0 nlme_3.1-152 mime_0.10
[76] compiler_4.0.3 rstudioapi_0.13 plotly_4.9.3
[79] spatstat.utils_2.1-0 tweenr_1.0.2 bslib_0.2.4
[82] stringi_1.5.3 ps_1.6.0 RSpectra_0.16-0
[85] lattice_0.20-41 vctrs_0.3.7 pillar_1.6.0
[88] lifecycle_1.0.0 BiocManager_1.30.12 spatstat.geom_2.1-0
[91] lmtest_0.9-38 jquerylib_0.1.3 RcppAnnoy_0.0.18
[94] irlba_2.3.3 httpuv_1.5.5 patchwork_1.1.1
[97] R6_2.5.0 promises_1.2.0.1 KernSmooth_2.23-18
[100] gridExtra_2.3 bmp_0.3 parallelly_1.24.0
[103] codetools_0.2-18 MASS_7.3-53.1 assertthat_0.2.1
[106] withr_2.4.2 sctransform_0.3.2 mgcv_1.8-34
[109] rpart_4.1-15 rvcheck_0.1.8 Rtsne_0.15
[112] ggforce_0.3.3 shiny_1.6.0

Spots are shifted from the image

Hi,
I tried to use SPOTlight::spatial_scatterpie on my data and the spots had a shift from the image.
After probing the code I found the reason why:

Plot spatial scatterpie plot

scatterpie_plt <- suppressMessages(ggplot2::ggplot() +
ggplot2::annotation_custom(grob = img_grob,
xmin = 0,
xmax = 600,
ymin = 0,
ymax = -600) +
scatterpie::geom_scatterpie(data = spatial_coord,
aes(x = imagecol_scaled,
y = imagerow_scaled),
cols = cell_types_all,
color = NA,
alpha = scatterpie_alpha,
pie_scale = pie_scale) +
ggplot2::scale_y_reverse() +
ggplot2::ylim(600, 0) +
ggplot2::xlim(0, 600) +
cowplot::theme_half_open(11, rel_small = 1) +
ggplot2::theme_void() +
ggplot2::coord_fixed(ratio = 1,
xlim = NULL,
ylim = NULL,
expand = TRUE,
clip = "on"))

The hard coding here of -600 and 600 instead of using the image dimensions like this:
xmax = ncol(img) and ymax = -nrow(img).

Spatial_scatterpie mutate() error

Hi !

I followed your tutorial with my own data but when I came to the part to plot the scatterpie with specific cell type of interest an error rise about mutate:

<error/dplyr:::mutate_error>
Problem with mutate() column rsum.
rsum = base::rowSums(.[, cell_types_interest, drop = FALSE]).
✖ undefined columns selected
Backtrace:

  1. ├─SPOTlight::spatial_scatterpie(...)
  2. │ └─%>%(...)
  3. ├─tibble::column_to_rownames(., "barcodeID")
  4. │ ├─base::stopifnot(is.data.frame(.data))
  5. │ └─base::is.data.frame(.data)
  6. ├─dplyr::left_join(...)
  7. ├─dplyr::select(., "barcodeID")
  8. ├─dplyr::filter(., rsum != 0)
  9. ├─dplyr::mutate(...)
  10. ├─dplyr:::mutate.data.frame(...)
  11. │ └─dplyr:::mutate_cols(.data, ..., caller_env = caller_env())
  12. │ ├─base::withCallingHandlers(...)
  13. │ └─mask$eval_all_mutate(quo)
  14. ├─base::rowSums(.[, cell_types_interest, drop = FALSE])
  15. │ └─base::is.data.frame(x)
  16. ├─.[, cell_types_interest, drop = FALSE]
  17. ├─base::[.data.frame(., , cell_types_interest, drop = FALSE)
  18. │ └─base::stop("undefined columns selected")
  19. └─base::.handleSimpleError(...)
  20. └─dplyr:::h(simpleError(msg, call))
    <error/simpleError>
    undefined columns selected

Here my sessionInfo if it helps:

R version 4.0.5 (2021-03-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /CONDAS/users/delage-w/r_work/lib/libopenblasp-r0.3.15.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] jpeg_0.1-9 png_0.1-7 imager_0.42.10
[4] magrittr_2.0.1 cowplot_1.1.1 tidyr_1.1.4
[7] tibble_3.1.6 stringr_1.4.0 Biobase_2.52.0
[10] BiocGenerics_0.38.0 ggcorrplot_0.1.3 RColorBrewer_1.1-2
[13] igraph_1.2.8 SPOTlight_0.1.7 gt_0.3.1
[16] data.table_1.14.2 Matrix_1.3-4 dplyr_1.0.7
[19] patchwork_1.1.1 ggplot2_3.3.5 SeuratDisk_0.0.0.9019
[22] SeuratData_0.2.1 SeuratObject_4.0.3 Seurat_4.0.5.9003

loaded via a namespace (and not attached):
[1] Rtsne_0.15 colorspace_2.0-2 deldir_1.0-6
[4] ellipsis_0.3.2 ggridges_0.5.3 rprojroot_2.0.2
[7] spatstat.data_2.1-0 farver_2.1.0 leiden_0.3.9
[10] listenv_0.8.0 ggrepel_0.9.1 bit64_4.0.5
[13] scatterpie_0.1.7 RSpectra_0.16-0 fansi_0.5.0
[16] codetools_0.2-18 splines_4.0.5 doParallel_1.0.16
[19] readbitmap_0.1.5 polyclip_1.10-0 jsonlite_1.7.2
[22] gridBase_0.4-7 ica_1.0-2 cluster_2.1.2
[25] uwot_0.1.10 ggforce_0.3.3 shiny_1.7.1
[28] sctransform_0.3.2 spatstat.sparse_2.0-0 compiler_4.0.5
[31] httr_1.4.2 bmp_0.3 assertthat_0.2.1
[34] fastmap_1.1.0 lazyeval_0.2.2 cli_3.1.0
[37] tweenr_1.0.2 later_1.3.0 htmltools_0.5.2
[40] tools_4.0.5 gtable_0.3.0 glue_1.5.0
[43] RANN_2.6.1 reshape2_1.4.4 rappdirs_0.3.3
[46] Rcpp_1.0.7 scattermore_0.7 NMF_0.23.0
[49] vctrs_0.3.8 nlme_3.1-153 iterators_1.0.13
[52] lmtest_0.9-39 globals_0.14.0 mime_0.12
[55] miniUI_0.1.1.1 lifecycle_1.0.1 irlba_2.3.3
[58] rngtools_1.5.2 goftest_1.2-3 future_1.23.0
[61] MASS_7.3-54 zoo_1.8-9 scales_1.1.1
[64] spatstat.core_2.3-1 promises_1.2.0.1 spatstat.utils_2.2-0
[67] reticulate_1.22 pbapply_1.5-0 gridExtra_2.3
[70] ggfun_0.0.4 pkgmaker_0.32.2 rpart_4.1-15
[73] stringi_1.7.5 foreach_1.5.1 tiff_0.1-10
[76] rlang_0.4.12 pkgconfig_2.0.3 matrixStats_0.61.0
[79] lattice_0.20-45 ROCR_1.0-11 purrr_0.3.4
[82] tensor_1.5 labeling_0.4.2 htmlwidgets_1.5.4
[85] bit_4.0.4 tidyselect_1.1.1 here_1.0.1
[88] parallelly_1.28.1 RcppAnnoy_0.0.19 plyr_1.8.6
[91] R6_2.5.1 generics_0.1.1 DBI_1.1.1
[94] pillar_1.6.4 withr_2.4.2 mgcv_1.8-38
[97] fitdistrplus_1.1-6 survival_3.2-13 abind_1.4-5
[100] future.apply_1.8.1 crayon_1.4.2 hdf5r_1.3.4
[103] KernSmooth_2.23-20 utf8_1.2.2 spatstat.geom_2.3-0
[106] plotly_4.10.0 digest_0.6.28 xtable_1.8-4
[109] httpuv_1.6.3 munsell_0.5.0 registry_0.5-1
[112] viridisLite_0.4.0

Any idea ? I see that the issue comes from dplyr but I am unable to figure out how to resolve it.
Best,
WesDe

Error: `.data` must be a data frame without row names

Hi Marc,

I am getting an error when running spotlight_deconvolution() with your example dataset. More info:

[1] "Preparing Gene set"
[1] "Normalizing count matrix"
[1] "Seeding initial matrices"
[1] "Training..."
[1] "Time to train NMF model was 11.81mins"
Error: `.data` must be a data frame without row names.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/tibble_error_already_has_rownames>
`.data` must be a data frame without row names.
Backtrace:
 1. SPOTlight::spotlight_deconvolution(...)
 5. tibble::column_to_rownames(., "clust_vr")
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/tibble_error_already_has_rownames>
`.data` must be a data frame without row names.
Backtrace:
    █
 1. ├─SPOTlight::spotlight_deconvolution(...)
 2. │ └─SPOTlight::topic_profile_per_cluster_nmf(...)
 3. │   └─`%>%`(...)
 4. ├─base::as.matrix(.)
 5. └─tibble::column_to_rownames(., "clust_vr")
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] edgeR_3.32.1              limma_3.46.0              Matrix_1.3-2              NMF_0.23.0               
 [5] cluster_2.1.0             rngtools_1.5              pkgmaker_0.32.2           registry_0.5-1           
 [9] tibble_3.0.5              purrr_0.3.4               stxBrain.SeuratData_0.1.1 SeuratData_0.2.1         
[13] Seurat_3.2.3              SPOTlight_0.1.2           AnnotationHub_2.22.0      BiocFileCache_1.14.0     
[17] dbplyr_2.0.0              org.Mm.eg.db_3.12.0       org.Mmu.eg.db_3.12.0      org.Hs.eg.db_3.12.0      
[21] AnnotationDbi_1.52.0      IRanges_2.24.1            S4Vectors_0.28.1          Biobase_2.50.0           
[25] BiocGenerics_0.36.0       knitr_1.30                ggupset_0.3.0             shinyjs_2.0.0.9000       
[29] enrichR_2.1               rmdformats_1.0.1          ggplot2_3.3.3             dplyr_1.0.3              
[33] shinytest_1.5.0           promises_1.1.1            shiny_1.5.0              

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.1                scattermore_0.7               tidyr_1.1.2                  
  [4] bit64_4.0.5                   irlba_2.3.3                   rpart_4.1-15                 
  [7] data.table_1.13.6             doParallel_1.0.16             RCurl_1.98-1.2               
 [10] generics_0.1.0                callr_3.5.1                   cowplot_1.1.1                
 [13] usethis_2.0.0                 RSQLite_2.2.2                 shadowtext_0.0.7             
 [16] RANN_2.6.1                    future_1.21.0                 chron_2.3-56                 
 [19] bit_4.0.4                     enrichplot_1.10.1             spatstat.data_1.7-0          
 [22] httpuv_1.5.5                  assertthat_0.2.1              viridis_0.5.1                
 [25] STRINGdb_2.2.0                xfun_0.20                     evaluate_0.14                
 [28] fansi_0.4.2                   caTools_1.18.1                igraph_1.2.6                 
 [31] DBI_1.1.1                     pingr_2.0.1                   htmlwidgets_1.5.3            
 [34] hash_2.2.6.1                  ellipsis_0.3.1                RSpectra_0.16-0              
 [37] crosstalk_1.1.1               ggnewscale_0.4.5              backports_1.2.1              
 [40] bookdown_0.21                 gridBase_0.4-7                deldir_0.2-9                 
 [43] vctrs_0.3.6                   remotes_2.2.0                 ROCR_1.0-11                  
 [46] abind_1.4-5                   withr_2.4.0                   ggforce_0.3.2                
 [49] checkmate_2.0.0               sctransform_0.3.2             prettyunits_1.1.1            
 [52] goftest_1.2-2                 DOSE_3.16.0                   lazyeval_0.2.2               
 [55] crayon_1.3.4                  webdriver_1.0.6               pkgconfig_2.0.3              
 [58] labeling_0.4.2                tweenr_1.0.1                  nlme_3.1-151                 
 [61] pkgload_1.1.0                 rematch_1.0.1                 devtools_2.3.2               
 [64] rlang_0.4.10                  globals_0.14.0                lifecycle_0.2.0              
 [67] miniUI_0.1.1.1                downloader_0.4                rsvd_1.0.3                   
 [70] rprojroot_2.0.2               polyclip_1.10-0               matrixStats_0.57.0           
 [73] lmtest_0.9-38                 showimage_1.0.0               graph_1.68.0                 
 [76] zoo_1.8-8                     base64enc_0.1-3               formattable_0.2.1            
 [79] geneSetVis_1.0.0              ggridges_0.5.3                processx_3.4.5               
 [82] png_0.1-7                     viridisLite_0.3.0             rjson_0.2.20                 
 [85] bitops_1.0-6                  shinydashboard_0.7.1          debugme_1.1.0                
 [88] KernSmooth_2.23-18            blob_1.2.1                    stringr_1.4.0                
 [91] qvalue_2.22.0                 parallelly_1.23.0             reactome.db_1.74.0           
 [94] scales_1.1.1                  memoise_1.1.0                 graphite_1.36.0              
 [97] magrittr_2.0.1                plyr_1.8.6                    ica_1.0-2                    
[100] gplots_3.1.1                  compiler_4.0.3                scatterpie_0.1.5             
[103] RColorBrewer_1.1-2            plotrix_3.7-8                 fitdistrplus_1.1-3           
[106] cli_2.2.0                     listenv_0.8.0                 patchwork_1.1.1              
[109] pbapply_1.4-3                 ps_1.5.0                      mgcv_1.8-33                  
[112] MASS_7.3-53                   tidyselect_1.1.0              stringi_1.5.3                
[115] yaml_2.2.1                    GOSemSim_2.16.1               locfit_1.5-9.4               
[118] ggrepel_0.9.1                 grid_4.0.3                    fastmatch_1.1-0              
[121] tools_4.0.3                   future.apply_1.7.0            rstudioapi_0.13              
[124] foreach_1.5.1                 gridExtra_2.3                 farver_2.0.3                 
[127] Rtsne_0.15                    ggraph_2.0.4                  digest_0.6.27                
[130] rvcheck_0.1.8                 BiocManager_1.30.10           proto_1.0.0                  
[133] Rcpp_1.0.6                    BiocVersion_3.12.0            later_1.1.0.1                
[136] RcppAnnoy_0.0.18              shinyWidgets_0.5.5            httr_1.4.2                   
[139] rsconnect_0.8.16              colorspace_2.0-0              tensor_1.5                   
[142] fs_1.5.0                      reticulate_1.18               splines_4.0.3                
[145] uwot_0.1.10                   spatstat.utils_1.20-2         graphlayouts_0.7.1           
[148] plotly_4.9.3                  sessioninfo_1.1.1             xtable_1.8-4                 
[151] jsonlite_1.7.2                spatstat_1.64-1               tidygraph_1.2.0              
[154] testthat_3.0.1                R6_2.5.0                      gsubfn_0.7                   
[157] pillar_1.4.7                  htmltools_0.5.1               mime_0.9                     
[160] glue_1.4.2                    fastmap_1.0.1                 clusterProfiler_3.18.0       
[163] DT_0.17                       BiocParallel_1.24.1           interactiveDisplayBase_1.28.0
[166] codetools_0.2-18              fgsea_1.16.0                  pkgbuild_1.2.0               
[169] lattice_0.20-41               sqldf_0.4-11                  curl_4.3                     
[172] leiden_0.3.6                  gtools_3.8.2                  ReactomePA_1.34.0            
[175] GO.db_3.12.1                  survival_3.2-7                rmarkdown_2.6                
[178] parsedate_1.2.0               desc_1.2.0                    munsell_0.5.0                
[181] DO.db_2.9                     iterators_1.0.13              reshape2_1.4.4               
[184] gtable_0.3.0                  msigdbr_7.2.1     

Any insight as to why?

Thanks

spotlight_deconvolution function error

Hello, I am currently running the SPOTlight package and attempting the spotlight decomposition portion of the. code on my reference scRNAseq data. The code I am running is below:
#Spotlight decomposition
set.seed(123)
spotlight_ls <-spotlight_deconvolution(
se_sc = E14_sc,
counts_spatial = anterior@assays$RNA@counts,
clust_vr = "subclass", # Variable in sc_seu containing the cell-type annotation
cluster_markers = cluster_markers_all, # Dataframe with the marker genes
cl_n = 100, # number of cells per cell type to use
hvg = 3000, # Number of HVG to use
ntop = NULL, # How many of the marker genes to use (by default all)
transf = "uv", # Perform unit-variance scaling per cell and spot prior to factorzation and NLS
method = "nsNMF", # Factorization method
min_cont = 0 # Remove those cells contributing to a spot below a certain threshold
)

When I run this code, I get the following error: Error in spotlight_deconvolution(se_sc = E14_sc, counts_spatial = anterior@assays$RNA@counts, :
could not find function "spotlight_deconvolution"

spatial_scatterpie - col_df argument

Hi Marc!!

I am trying to change the colors in the spatial_scatterpie with the argument col_df and by passing to it a dataframe object containing a color for each cell type (first column is the cell type and the second is the color assigned to it), and I get the following error:

Error in SPOTlight::spatial_scatterpie(se_obj = spatial, cell_types_all = cell_types_all, :
unused argument (col_df = colors)

Thank you!

Mouse vs human gene symbols

Hello,

thank you for developing this helpful deconvolution tool! I was wondering in the function spotlight_deconvolution(), if it is already possible to use mouse SC data for deconvolving human ST data. The function now returns the error "Not enough genes in common between the single-cell and mixture dataset." which makes complete sense! The mouse gene symbols still have to be converted to uppercase.

As work-around I can find a human reference SC or convert rownames myself, but I was thinking more users might want to use reference sets from mouse/other species.

Thanks!

Benchmarking SPOTlight

Hi @MarcElosua

As a part of cell2location paper (https://www.biorxiv.org/content/10.1101/2020.11.15.378125v1), we are doing a benchmark of all spatial mapping methods that integrate scRNA & spatial sequencing data. We seem to get the poor performance of SPOTlight on both simulated data (Fig S2, https://www.biorxiv.org/content/biorxiv/early/2020/11/17/2020.11.15.378125/DC1/embed/media-1.pdf?download=true) and real data of both the mouse brain (https://github.com/vitkl/cell2location_paper/blob/master/notebooks/selected_results/benchmarking/mouse_visium_snrna/SPOTlight/plots/figures/spatialall_maps_dotST8059048.pdf) and the human lymph nodes (https://github.com/vitkl/cell2location_paper/blob/master/notebooks/selected_results/benchmarking/lymph_nodes_analysis/SPOTlight/plots/figures/spatialall_maps_dot.png).

I copied over the workflow from your readme and installed the package as instructed. Here are the links to Rmd notebooks (and corresponding *.html report) used for the analysis on mouse brain (https://github.com/vitkl/cell2location_paper/blob/master/notebooks/benchmarking/other_methods/SPOTlight_mouse_brain.Rmd) and human lymph node (https://github.com/vitkl/cell2location_paper/blob/master/notebooks/benchmarking/other_methods/SPOTlight_human_LN.Rmd). I am wondering if you have any suggestions that might explain this. Could I be using a bad combination of hyperparameters?
We do see better results with the lymph node which relies on scRNA rather than snRNA reference dataset and has fewer cell types (34 compared to 59 in the mouse brain). Our working hypothesis is that methods which do not model the gene-specific difference between technologies (SPOTlight, Seurat V3, NNLS) perform worse than cell2location / RCTD / stereoscope when such differences are present in the data.

If you would like to reproduce these results you can find the mouse brain Visium and snRNA-seq as h5ad files as described in this section: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_short_demo.html#1.-Loading-Visium-data. You can get lymph node Visium data from 10X website and the scRNA-reference dataset we used from https://cell2location.cog.sanger.ac.uk/paper/integrated_lymphoid_organ_scrna/RegressionNBV4Torch_57covariates_73260cells_10237genes/sc.h5ad. You can also find our simulated data here: https://cell2location.cog.sanger.ac.uk/browser.html?shared=paper/lowdens_synthetic_ST_fewcells/.

Would be great if you help to get to the bottom of this.

Thanks a lot,

Vitalii

Error: object 'count_mtrx' not found

Hi,

I'm getting the following error at the "Training...." step when trying to run spotlight_deconvolution when transf is set to either "sct" or "cpm":

Error in NMF::nmf(x = count_mtrx, rank = k, seed = nmf_init, method = method) :
object 'count_mtrx' not found

It works perfectly with transf = "raw" or "uv" so the issue seems to be related to the transformation type itself. Any idea? Thanks!

spotlight_deconvolution error

Hello, I am trying to run my data through the same code as is provided for the tutorial and keep running into the issue below. The tutorial code with the provided brain data ran perfectly fine, but I am not having any luck on my own work. If you have any suggestions, that would be greatly appreciated! Thanks!
SPOTlight_error

using purrr::map to speed up deconvolution process

Hi,

The deconvolution process is pretty slow, as one spot takes roughly 10~30s. For a large dataset consisting of thousands of spots, the whole deconvolution process consumes more than 5 hours, making it hard for the user to tune the parameter quickly based on the results. Part of this problem is that spotlight deconvolute spots one by one. Any thoughts to append parallel computing in the spotlight to fuel the speed?

Plus, very nice program and congratulations on the NAR publication!

@QqQss

Interpretation graph interaction and cell-cell correlation

Hi,

Thank you again for your tools which provides some interesting features compared to other tools ! I had a naive question about graph interaction and cell-cell correlation. In your vignette we can see that some cell types have a strong interaction but a weak correlation (Astro - Oligo : -0.1). I might miss an important point but I thought that if cell types had a strong interaction they would have naturally a high correlation. Does the interaction graph is a count of interaction between cell types that can be biased by the number of spot containing the same mixing cell type? Then the pearson correlation allows to remove this bias ? Could you help me to understand how to interpret both graph because I am confronted with the same result with my data please ?

Best,
WesDe

When scRNA Seurat object contains column named 'ID' training breaks

Hi Marc

I seem to have get error when scRNA Seurat object contains the column named 'ID'. I think this is because this block creates a column with that name:

name <- function(se_obj, clust_vr, cl_n=5000) {
  
 lapply(split([email protected], [email protected][, clust_vr]), 
        function(subdf) {
            n_sample <- if_else(nrow(subdf) < cl_n, as.numeric(nrow(subdf)), 
                as.numeric(cl_n))
            tmp_ds <- subdf[sample(seq_len(nrow(subdf)), n_sample), 
                ] %>% tibble::rownames_to_column("ID") %>% dplyr::pull(ID)
            return(tmp_ds)
        }) %>% purrr::flatten_chr()
}

Specifically, tibble::rownames_to_column("ID").

> name(se_obj=sc_seu, clust_vr='Subset')
 Error: Column name `ID` must not be duplicated.
Run `rlang::last_error()` to see where the error occurred. 
> rlang::last_error()
█
├─<error/tibble_error_column_names_must_be_unique>
│ Column name `ID` must not be duplicated.
└─<error/vctrs_error_names_must_be_unique>
  Names must be unique.
Backtrace:
  1. global::name(se_obj = sc_seu, clust_vr = "Subset")
  8. tibble::rownames_to_column(., "ID")
  9. tibble:::repaired_names(c(unique(names2(df)), var))
 12. vctrs::vec_as_names(...)
 14. vctrs:::validate_unique(names = names, arg = arg)
 15. vctrs:::stop_names_must_be_unique(names, arg)
 16. vctrs:::stop_names(...)
 17. vctrs:::stop_vctrs(class = c(class, "vctrs_error_names"), ...)
Run `rlang::last_trace()` to see the full context.

applying SPOTLight on multiple ST samples

@MarcElosua thank you for developing a great "Deconvolution" tool for spatial transcriptomics
I have a follow-up question on #32.
I also have multiple ST samples in seurat object and run the SPOTLight in a merged format and would like to visualize individual samples and would like to know if there is an easy way to split the visualization based on sample names/replicates.

In addition, I would also like to add the celltype names in the "metadata" as a "factor" with predicted celltype names in a level instead of individual celltype names in a "double" format.

Thanks!

data links in README don't work - release data with package

you can release the data into your package by putting them into the inst folder of your package.

If you would like to keep the data light you'd use just a subset of 'em.

Once, installed you can retrieve them with the system.files(package="SPOTlight") function.

Dario

Question related to normalization

I have maybe a very naive question related to the normalization. I realised that for finding FindAllMarkers you actually use normalized scRNA-seq data with SCT. However, later on to deconvolve the spatial data you use the counts data from spatial which is the raw data. Why don't you use over there as well the SCT normalized data?

Thank you for your help and I really like SPOTlight

Interpretation heatmap cell interactions

Dear MarcElosua,
thank you for this great tool! I really like the plot where cell-cell interactions are visualized in a heatmap, it is visually very intuitive. I understand the proportion is based on the count of spots where a particular combination of 2 celltypes are present, but I’m unsure how this proportion is calculated exactly.
CWM

I’m interested in the specifics, because I would like to combine multiple white matter brain samples into one heatmap. My questions are:

  1. Is the proportion normalized for the total abundance of each cell type? It seems the more abundant cell types in tissue (oligodendrocytes) dominate the plot. How do you define the proportion here?
  2. How do I interpret the words “From” and “To” . From the graph I understand it is an undirected graph

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.