SpaTalk
SpaTalk copied to clipboard
Error running dec_celltype function together with cell2location result matrix
Very useful tool. I want to use SpaTalk in our lab. I am working on the 10x visium ST dataset (multiple samples : 2 replicate each).
I split my integrated Seurat object based on the sample id i.e A1, B1, C1 and D1 and decided to apply SpaTalk on each section one by one.
obj <- createSpaTalk(st_data = as.matrix(st_count_a1), st_meta = st_meta_a1, species = "Mouse", if_st_is_sc = F, spot_max_cell =1)
Everything works fine until this step and created SpaTalk object.
length(colnames(obj@data$rawdata)) 1800 length(rownames(st_meta_a1 ) ) 1800
Next I would like to use deconvolution result from cell2location which consist of weights ( spot id x cell types) .
To create input for single cell count data, I used function https://satijalab.org/seurat/reference/averageexpression to get genes_labels x celltypes matrix and saved as sc_count.
celltypes <- c("Tcells" , "Bcells", "Macro")
obj <- dec_celltype(obj, sc_data = sc_count, sc_celltype = celltypes, if_doParallel = F, use_n_cores = 3, dec_result = st_meta_cells_fil )
It gives error such as :
Error in dec_celltype(obj, sc_data = sc_mat1, sc_celltype = celltypes, : Please provide a correct dec_result matrix! See demo_dec_result()!
My cell2location result matrix is in same format as required. Tcells Bcells Macro CA_1_1 0.07227784 0.002217575 0.003214246 CT_1_1 0.11673413 0.005541645 0.008517662 AG_1_1 0.30936356 0.007579740 0.048766695 TT_1_1 0.14501309 2.209639668 0.147608649 CC_1_1 0.24153571 0.970593423 0.296744515
But still I am having this error. Please correct me if I am doing something wrong at any step.
I would appreciate all your suggestion!!!
Thanks in advance