Giter Club home page Giter Club logo

zjufanlab / spatalk Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 17.0 10.04 MB

Knowledge-graph-based cell-cell communication inference for spatially resolved transcriptomic data

Home Page: https://github.com/multitalk/awesome-cell-cell-communication

License: GNU General Public License v3.0

R 94.85% Shell 5.15%
cell-cell-communication cell-cell-interaction graph-network knowledge-graph ligand-receptor-interaction single-cell spatial-data-analysis spatial-transcriptomics spatially-resolved-transcriptomics

spatalk's People

Contributors

multitalk avatar zjufanlab 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

Watchers

 avatar  avatar

spatalk's Issues

Document Package Dependency

Hi,

Thanks for producing this awesome software with clear documentations.

While I was trying to install your package, I realized that your package depends on some other package that is not on CRAN, e.g. NNLM.

It would be great if you could document that in your installation instruction. That will help nontechnical users to navigate through the installation process easier.

Thanks!

Question about codes for benchmark metrics

Hi,
Could you open source the codes of computing log-p and co-expression percent for all possible sender-receiver pairs? From the current code, I can only compute log-p for one specific sender-receiver pairs, which is not sufficient to reproduce results shown in Fig 2 d-e.
Thanks!

Cannot use deec_cci_all

Hi,
When I run the scripts and it pops an error for dec_cci_all method
image
It says "receptor_tf" not found.

Can you tell me how to fix this?

Find TF and pathway regard to specific LR pairs

Hi, if I have already found a ligand receptor of interest by other methods (CellChat, CellphoneDB...), how can I find the downstream TF and pathway by spatalk. I don't want to use spatalk to find the LR pairs, but to find TF and pathway regard to specific LR pairs.

Bugs for using find_lr_path(), dec_cci(), and dec_cci_all()

Hi,

I tried to skip the decomposition step and directly inferred the cell-cell communications. But I always met the same errors for find_lr_path(), dec_cci(), and dec_cci_all():

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'rowSums': 'data' must be of a vector type, was 'NULL'

I was back to review the code and found that when running .get_st_data() in these functions and the ST type was not single-cell, the code is

st_data <- object@data$newdata
st_meta <- object@meta$newmeta

However, the object doesn't contain newdata and newmeta. They should be rawdata and rawmeta. I explored further and found that newdata and newmeta will only be created when using dec_celltype().

In addition to the above bug, there is another bug related to spot-based ST data: In the .get_cellpair() function, there are several lines to call cell_sender$cell or cell_receiver$cell. For example:

celltype_dist1 <- celltype_dist[, cell_sender$cell[j]]

Based on the description of the createSpaTalk () function, the column name of spot-based ST data should be "spot" instead of "cell". The different names will cause errors for dec_cci() and dec_cci_all().

Right now the code works for me because I fixed it by myself. But I suggest adding suitable if-else statements into the related functions and checking these different conditions carefully.

Question about computation time

Hi,

Thanks for this useful package!

I have a question about the computation time. In the supplementary document of the paper, you provided two tables of the computation times, and they looked pretty good. I am trying to analyze the same 10X Visium data in your paper (i.e., P2.rep2). However, dec_celltype() has taken a pretty long time, and still no response after printing "Performing Non-negative regression for each spot". I would just like to check the number of cores and memory you used for getting efficient results in supplementary tables. I didn't find this information in the paper, not sure if I missed something.

Looking forward to your reply and thank you in advance!

Using RCTD to deconvolute

你好:
我在使用RCTD反卷积出现如下报错(使用最新版本的SpaTalk)
(1)使用SpaTalk进行反卷积时:
obj <- dec_celltype(object = obj,
sc_data = as.matrix(sc@assays$RNA@counts),
sc_celltype = as.character(sc$celltype),
use_n_cores = 10,
method = 2)
Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 7559, 7500
(2)或者直接将RCTD结果导入SpaTalk结果时(RCTD可以正常运行):
obj <- dec_celltype(object = obj,
sc_data = as.matrix(sc@assays$RNA@counts),
sc_celltype = as.character([email protected]$celltype),
dec_result = as.matrix(results),
use_n_cores = 10,
method = 2)
Error in : task 144 failed - invalid character indexing
请问如何解决,谢谢

plot_cci_lrpairs

Dear SpaTalk developers,

I've run SpaTalk on a dataset half a year ago or so, and it worked fine, giving a heatmap for LR interaction results. I came back to it today, but now it's yielding the "No LR pairs found" error, although I'm very certain it wasn't so before. I've checked that lrpairs ligands and receptors include genes present in the dataset. This is spatial transcriptomics. Is there a function to run prior to plot_cci_lrpairs apart from createSpaTalk and find_lr_path? Many thanks.

problem: dec_cci and dec_cci_all

Hi, When I used dec_cci and dec_cci_all to analysis my data about cell-cell communications
and it pops errors
dec_cci error :

Error in intI(j, n = d[2L], dn[[2L]], give.dn = FALSE): invalid character indexing
Traceback:

1. dec_cci(object = obj, celltype_sender = "Vascular", celltype_receiver = "Differentiated_like", 
 .     use_n_cores = 4)
2. .lr_distance_doParallel(st_data, cell_pair, lrdb, celltype_sender, 
 .     celltype_receiver, per_num, pvalue)
3. st_data[lrdb$ligand, cell_pair$cell_sender]
4. st_data[lrdb$ligand, cell_pair$cell_sender]
5. callGeneric(x, i = i, j = j, drop = TRUE)
6. eval(call, parent.frame())
7. eval(call, parent.frame())
8. x[i = i, j = j, drop = TRUE]
9. x[i = i, j = j, drop = TRUE]
10. subCsp_ij(x, i, j, drop = drop)
11. intI(j, n = d[2L], dn[[2L]], give.dn = FALSE)
12. stop("invalid character indexing")

dec_cci_all error
Note: there are 6 cell types and 30 pair-wise cell pairs
Begin to find LR pairs
Error in {: task 1 failed - "invalid character indexing"
Traceback:

  1. dec_cci_all(object = obj, use_n_cores = 4)
  2. foreach::foreach(i = 1:nrow(celltype_pair), .packages = c("Matrix",
    . "reshape2"), .export = c(".get_cellpair", ".lr_distance",
    . ".get_tf_res", ".get_score")) %dopar% {
    . celltype_sender <- celltype_pair$celltype_sender[i]
    . celltype_receiver <- celltype_pair$celltype_receiver[i]
    . cell_pair <- .get_cellpair(celltype_dist, st_meta, celltype_sender,
    . celltype_receiver, n_neighbor)
    . cell_sender <- st_meta[st_meta$celltype == celltype_sender,
    . ]
    . cell_receiver <- st_meta[st_meta$celltype == celltype_receiver,
    . ]
    . cell_pair_all <- nrow(cell_sender) * nrow(cell_receiver)/2
    . if (nrow(cell_pair) > min_pairs) {
    . if (nrow(cell_pair) > cell_pair_all * min_pairs_ratio) {
    . lrdb <- object@lr_path$lrpairs
    . lrdb <- .lr_distance(st_data, cell_pair, lrdb, celltype_sender,
    . celltype_receiver, per_num, pvalue)
    . max_hop <- object@para$max_hop
    . receptor_tf <- NULL
    . if (nrow(lrdb) > 0) {
    . receptor_tf <- .get_tf_res(celltype_sender, celltype_receiver,
    . lrdb, ggi_tf, cell_pair, st_data, max_hop,
    . co_exp_ratio)
    . if (!is.null(receptor_tf)) {
    . lrdb <- .get_score(lrdb, receptor_tf)
    . }
    . else {
    . lrdb <- NULL
    . }
    . }
    . if (is.data.frame(lrdb)) {
    . if (nrow(lrdb) > 0) {
    . list(lrdb = lrdb, receptor_tf = receptor_tf,
    . cell_pair = cell_pair)
    . }
    . }
    . }
    . }
    . }
  3. e$fun(obj, substitute(ex), parent.frame(), e$data)

Supply the data

Hi,would you mind supplying the data of starmap_data.rda and starmap_meta.rda of STARmap.
Thank you!

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

Seurat 5.0.1 Compatibility Issues

Hi there,

In the tutorial (https://raw.githack.com/multitalk/awesome-cell-cell-communication/main/method/spot_tutorial.html), when running the code with Seurat Version 5.0.1 for decoding cell-type decomposition (code shown below), there was an error message of " Error in .normalize_data(st_data) : no slot of name "data" for this object of class "Assay5" ".

After changing the Seurat Version to 4.4.0, the error is sorted.

It will be great if you can look into it.

Thank you very much!

decode the cell-type composition

obj <- dec_celltype(object = obj,
sc_data = as.matrix(starmap_data),
sc_celltype = starmap_meta$celltype)

pathways collection

How is pathways links information collected from Reactome or kegg, and through what package is it handled?

Error dec_celltype using cell2loc

Good day!

I have gicen a try to use this great tool with my data but have encountered a problem when using cell2loc. The pipeline ran and generated the cell2loca_results matrix but one it usues the function generate_newmeta_cell generates the error below:

New names:
• `` -> `...1`
Rows: 3967 Columns: 30
── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr  (1): ...1
dbl (29): q05cell_abundance_w_sf_AC_like, q05cell_abundance_w_sf_Astrocyte, ...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Generating single-cell data for each spot 
Error in {: task 1 failed - "incompatible dimensions"
Traceback:

1. dec_celltype(object = obj, sc_data = as.matrix(GetAssayData(sc, 
 .     slot = "counts")), sc_celltype = as.character([email protected]$celltype), 
 .     method = 7, env = "cell2loc_env")
2. .generate_newmeta_cell(newmeta, st_ndata, sc_ndata, sc_celltype, 
 .     iter_num, if_doParallel)
3. foreach::foreach(i = 1:length(newmeta_spotname), .combine = "rbind", 
 .     .packages = "Matrix", .export = ".generate_newmeta_spot") %dopar% 
 .     {
 .         spot_name <- newmeta_spotname[i]
 .         .generate_newmeta_spot(spot_name, newmeta, st_ndata, 
 .             sc_ndata, sc_celltype, iter_num)
 .     }
4. e$fun(obj, substitute(ex), parent.frame(), e$data)

Do you know where the problem might be?

My sessionInfo()

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: /hpc/pmc_stunnenberg/cruiz/miniconda3/envs/r_pHGG_project/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] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] sceasy_0.0.7       reticulate_1.26    future_1.28.0      patchwork_1.1.2   
 [5] RColorBrewer_1.1-3 igraph_1.3.1       SpaTalk_1.0        doParallel_1.0.17 
 [9] iterators_1.0.14   foreach_1.5.2      ggalluvial_0.12.3  ggplot2_3.3.6     
[13] dplyr_1.0.10       sp_1.4-7           SeuratObject_4.1.0 Seurat_4.1.0      
[17] data.table_1.14.2  Matrix_1.3-3      

loaded via a namespace (and not attached):
  [1] backports_1.4.1       uuid_1.1-0            plyr_1.8.7           
  [4] repr_1.1.3            lazyeval_0.2.2        splines_4.0.3        
  [7] RcppHNSW_0.4.1        listenv_0.8.0         scattermore_0.8      
 [10] digest_0.6.29         htmltools_0.5.3       fansi_1.0.3          
 [13] magrittr_2.0.3        tensor_1.5            cluster_2.1.2        
 [16] ROCR_1.0-11           tzdb_0.3.0            globals_0.16.1       
 [19] readr_2.1.2           matrixStats_0.62.0    vroom_1.5.7          
 [22] spatstat.sparse_2.1-1 prettyunits_1.1.1     colorspace_2.0-3     
 [25] rappdirs_0.3.3        ggrepel_0.9.1         crayon_1.5.1         
 [28] jsonlite_1.8.0        scatterpie_0.1.8      progressr_0.11.0     
 [31] spatstat.data_2.2-0   survival_3.2-11       zoo_1.8-10           
 [34] glue_1.6.2            polyclip_1.10-0       gtable_0.3.1         
 [37] leiden_0.4.3          car_3.1-0             future.apply_1.9.1   
 [40] abind_1.4-5           scales_1.2.1          pheatmap_1.0.12      
 [43] DBI_1.1.2             rstatix_0.7.0         spatstat.random_2.2-0
 [46] miniUI_0.1.1.1        Rcpp_1.0.9            viridisLite_0.4.1    
 [49] xtable_1.8-4          progress_1.2.2        spatstat.core_2.4-2  
 [52] bit_4.0.4             NNLM_0.4.4            htmlwidgets_1.5.4    
 [55] httr_1.4.4            ellipsis_0.3.2        ica_1.0-3            
 [58] pkgconfig_2.0.3       farver_2.1.1          uwot_0.1.11          
 [61] deldir_1.0-6          here_1.0.1            utf8_1.2.2           
 [64] labeling_0.4.2        tidyselect_1.1.2      rlang_1.0.4          
 [67] reshape2_1.4.4        later_1.3.0           munsell_0.5.0        
 [70] tools_4.0.3           cli_3.3.0             generics_0.1.3       
 [73] broom_1.0.1           ggridges_0.5.3        evaluate_0.16        
 [76] stringr_1.4.1         fastmap_1.1.0         goftest_1.2-3        
 [79] bit64_4.0.5           fitdistrplus_1.1-8    purrr_0.3.4.9000     
 [82] RANN_2.6.1            pbapply_1.5-0         nlme_3.1-152         
 [85] mime_0.12             ggExtra_0.10.0        hdf5r_1.3.5          
 [88] compiler_4.0.3        plotly_4.10.0.9001    png_0.1-7            
 [91] ggsignif_0.6.3        spatstat.utils_2.3-1  tibble_3.1.8         
 [94] tweenr_2.0.2          stringi_1.7.8         RSpectra_0.16-1      
 [97] rgeos_0.5-9           lattice_0.20-44       IRdisplay_1.0        
[100] vctrs_0.4.1           pillar_1.8.1          lifecycle_1.0.1      
[103] spatstat.geom_2.4-0   lmtest_0.9-40         RcppAnnoy_0.0.19     
[106] cowplot_1.1.1         irlba_2.3.5           httpuv_1.6.6         
[109] R6_2.5.1              promises_1.2.0.9000   KernSmooth_2.23-20   
[112] gridExtra_2.3         parallelly_1.32.1     codetools_0.2-18     
[115] fastDummies_1.6.3     MASS_7.3-54           assertthat_0.2.1     
[118] rprojroot_2.0.3       withr_2.5.0           sctransform_0.3.3    
[121] mgcv_1.8-35           hms_1.1.2             grid_4.0.3           
[124] rpart_4.1-15          ggfun_0.0.7           IRkernel_1.1.1       
[127] tidyr_1.2.1           carData_3.0-5         Cairo_1.5-15         
[130] Rtsne_0.16            ggpubr_0.4.0          pbdZMQ_0.3-5         
[133] ggforce_0.3.4         shiny_1.7.2           base64enc_0.1-3  

Thanks in advance!

Cannot use method plot_path2gene

Hi,
Currently I can use all the other functions, but when I try to run plot_path2gene, it shows an error that
image
Cna you tell me how to fix this?
Thanks!

problem plot_ccdist()

i test plot_ccdist()
# Point plot with spatial distribution of celltype_sender and celltype_receiver plot_ccdist(object = obj, celltype_sender = 'eL5', celltype_receiver = 'Astro', size = 2, arrow_length = 0.1)
problem is :
Error in f(): ! Insufficient values in manual scale. 3 needed but only 1 provided.

Error when running dec_celltype

I am running into the following error message when running dec_celltype. Would you mind providing any insights on where this message could come from?

Thank you very much.

Generating single-cell data for each spot 
Error in h(simpleError(msg, call)) :
  error in evaluating the argument 'x' in selecting a method for function 'rowSums': invalid character indexing

Where to find the root squared of both intra-cellular and inter-cellular score ?

It's more a set of questions than a bug report.

I was wondering if the score in obj@lrpair provided after find_lr_path & dec_cci_all was the intra-cellular score, the inter-cellular or the final one as the root squared of both.
Just to know if at this point you were already taking account of the TF, targets genes. The p-palue seems only base on the LR co-expression, right ? So that would mean it's only the inter-cellular score.

So score in obj@tf is probably the intra-cellular score ? but both scores are not yet mixed to rank the interaction ? So it's needed to apply get_lr_path.

get_lr_path gives p-value for pathways based on Fisher for specific L/R , Sender/Receiver. but also the final score ?

I'd like to know where to set my p-val cutoff for filtering LR but want miss the fact that is you are taking account of downstream genes...I don't know if you see my point.

obj <- createSpaTalk(st_data = counts,
                     st_meta = areas[,c("cell","x","y")],
                     species = "Human",
                     if_st_is_sc = T,
                     spot_max_cell = 1,
                     celltype = areas$cell_type)

obj <- find_lr_path(object = obj , lrpairs = lrpairs, pathways = pathways,if_doParallel = T,use_n_cores=32)
obj <- dec_cci_all(object = obj,if_doParallel = T,use_n_cores=32)

I was wondering if it's necessary to do a loop to compute all the final root squared product of intra/inter scores for all LR provided by get_lr_path.

datalist.pval    = list()
datalist.tf_path = list()

for (i in 1:dim(obj@lrpair)[1]) {

print("### Call get_lr_path for each pair")
print(i)
print(dim(obj@lrpair)[1])

    # Get LR and downstream pathways
    obj_lr_path <- get_lr_path(object = obj,
                               celltype_sender = obj@lrpair[i,c("celltype_sender")],
                               celltype_receiver = obj@lrpair[i,c("celltype_receiver")],
                               ligand = obj@lrpair[i,c("ligand")],
                               receptor = obj@lrpair[i,c("receptor")])

     datalist.pval[[i]] <- obj_lr_path$path_pvalue # add it to your list
     datalist.tf_path[[i]] <- obj_lr_path$tf_path # add it to your list

}

big_data.pval <- do.call(rbind, datalist.pval)
big_data.tf <- do.call(rbind, datalist.tf_path)

write.table(big_data.pval, glue("lrpath.pvalue.tsv"), col.names = TRUE, row.names = FALSE, sep="\t", quote=FALSE)
write.table(big_data.tf, glue("lrpath.tf_path.tsv"), col.names = TRUE, row.names = FALSE, sep="\t", quote=FALSE)

Last question, is that possible to use SPATALK for the whole spatial transcriptomics setting for all cells two clusters. Imagine you have any appriori over the cell type / clusters. One cell would have both cluster1 / cluster2 anotations and so every cells would be compared.
Is this working ?

Great job you have done here by the way.
Thanks.

Analyze of Spot-based ST without deconvolution

I don't have single cell associated to my spot based visium data.
I would like to analyze my spot based ST it without deconvolution.
I was wondering if spatalk still can be applied in this situation (setting spot_max_cell to 1), at least in an exploratory mode.

Also when you use deconvolution, you reconstruct a matrix of cells.
From a spot based matrix, you end up with a cell matrix where counts are recomputed thanks to non linear model , right ?

Last question. When you say you apply deconvolution directly (here) over result which is a matrix. What is the format needed?
obj <- dec_celltype(obj, ..., dec_result = result)

Rows are cell spot. Columns are cell types. The values are the proportions or pvalues ?

Update:
` obj <- dec_celltype(obj, ..., dec_result = result)

Here you can reuse the output from deconvolution method. (in the case you don't have the counts of the sc data)
But in fact you still need to pass sc_data :/ and sc_celltype il also mandatory. Ok for sc_celltype, but for sc_data, it's kind of weird ? Can it be bypassed by reusing the count from the spot ....because you should only use the output file of the deconvolution, no ? Or do you reuse the sc data from here later ?
Tks.

你好 我在使用您的软件时候报错了 请问会是什么原因呢

这是报错信息:
Begin to find LR pairs
Error in { : task 34 failed - "replacement has 157 rows, data has 1"
Calls: dec_cci -> .get_tf_res_doParallel -> %dopar% ->
Execution halted
这是我的运行代码:
stRNA <- dec_cci(object = stRNA,
use_n_cores = 10,
celltype_sender = 'CD8_T',
celltype_receiver = 'Epithelial_cancer')

Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) : invalid character indexing

Hi guys,

Been stuck with this error all this morning.

Error in intI(i, n = x@Dim[1], dn[[1]], give.dn = FALSE) : invalid character indexing Calls : find_lr_path ... callGeneric -> eval -> eval -> [ -> [ -> subCsp_cols -> intI

I finally found why, so I prefer to share it with you if someone meet the same problem then he could easily find the solution here.

The error occurs because I defined in celltype argument NA values via in areas$ground_truth ...but the createSpaTalk object was well created. So maybe you could add some check to avoid this error when NA.


obj <- createSpaTalk(st_data = counts,
                     st_meta = areas[,c("cell","x","y")],
                     species = "Human",
                     if_st_is_sc = T,
                     spot_max_cell = 1,
                     celltype = areas$ground_truth)

obj <- find_lr_path(object = obj , lrpairs = lrpairs, pathways = pathways,if_doParallel = T,use_n_cores=8)

画图问题

您好!请问使用plot_ccdist画图时,如何保持图片的纵横比

Question about benckmark codes for SpaOTsc

Hi,
Could you also open source the codes of benchmarking SpaTalk with other cell-cell interaction methods like SpaOTsc? Since I also would like to see how much SpaTalk performs better than SpaOTsc.
Thanks!

Probelm in deconvolution

Dear author,
Our group hopes to use the Spatalk package. When we analyze the 10x Visium data, the function dec_celltype can not work.
Our code:

obj <- dec_celltype(obj,
                               sc_data = as.matrix(sc_count),
                               sc_celltype = celltype,
                               if_doParallel = T,
                               use_n_cores = N_CORES,
                              dec_result = decon_prop)

Error:

Error in { :
  task 14 failed - "error in evaluating the argument 'x' in selecting a method for function 'rowSums':
invalid character indexing"

Could you tell me the reason for the error? Thank you!

Best,
Sheng

No LR pairs found between any of the cell type

Thanks for the tool. I have run the tool with your suggestions on fixing the memory issue. But I get the error message for all the cell types in my dataset:-No LR pairs found between X and Y.

Why is this so? I had run the sub-sampled version of my same data with less genes and less spots and it seems to work well there, but not for entire data.

For the dataset in the tutorial: one weird issue: sometimes the program gives the LR pairs for 2 cell-types, but doesn't give LR pair for the same if I run it on next day. :(

Sudden error in createSpaTalk()

Hi,

I've been running SpaTalk package successfully for a while but today when I tried to run a script, I noticed that I am not able to create SpaTalk object. Any ideas what might be the cause?

`> obj_list
[[1]]
An object of class SpaTalk
Error in (new("standardGeneric", .Data = function (object) :
object 'obj' not found

traceback()
2: (new("standardGeneric", .Data = function (object)
standardGeneric("show"), generic = structure("show", package = "methods"),
package = "methods", group = list(), valueClass = character(0),
signature = structure("object", simpleOnly = TRUE), default = new("derivedDefaultMethod",
.Data = function (object)
showDefault(object), target = new("signature", .Data = "ANY",
names = "object", package = "methods"), defined = new("signature",
.Data = "ANY", names = "object", package = "methods"),
generic = structure("show", package = "methods")), skeleton = (new("derivedDefaultMethod",
.Data = function (object)
showDefault(object), target = new("signature", .Data = "ANY",
names = "object", package = "methods"), defined = new("signature",
.Data = "ANY", names = "object", package = "methods"),
generic = structure("show", package = "methods")))(object)))(new("SpaTalk",
data = list(rawdata = new("dgCMatrix", i = c(0L, 3L, 4L,
5L, 7L, 8L, 10L, 13L, 14L, 15L, 18L, 20L, 23L, 25L, 27L,
31L, 35L, 36L, 41L, 46L, 48L, 49L, 50L, 52L, 59L, 62L, 65L,
67L, 68L, 69L, 70L, 72L, 73L, 74L, 77L, 78L, 79L, 80L, 81L,
82L, 84L, 87L, 89L, 90L, 92L, 96L, 97L, 104L, 105L, 108L,
112L, 113L, 114L, 115L, 116L, 120L, 121L, 124L, 125L, 126L,
...
1: (new("standardGeneric", .Data = function (object)
standardGeneric("show"), generic = structure("show", package = "methods"),
package = "methods", group = list(), valueClass = character(0),
signature = structure("object", simpleOnly = TRUE), default = new("derivedDefaultMethod",
.Data = function (object)
showDefault(object), target = new("signature", .Data = "ANY",
names = "object", package = "methods"), defined = new("signature",
.Data = "ANY", names = "object", package = "methods"),
generic = structure("show", package = "methods")), skeleton = (new("derivedDefaultMethod",
.Data = function (object)
showDefault(object), target = new("signature", .Data = "ANY",
names = "object", package = "methods"), defined = new("signature",
.Data = "ANY", names = "object", package = "methods"),
generic = structure("show", package = "methods")))(object)))(new("SpaTalk",
data = list(rawdata = new("dgCMatrix", i = c(0L, 3L, 4L,
5L, 7L, 8L, 10L, 13L, 14L, 15L, 18L, 20L, 23L, 25L, 27L,
31L, 35L, 36L, 41L, 46L, 48L, 49L, 50L, 52L, 59L, 62L, 65L,
67L, 68L, 69L, 70L, 72L, 73L, 74L, 77L, 78L, 79L, 80L, 81L,
82L, 84L, 87L, 89L, 90L, 92L, 96L, 97L, 104L, 105L, 108L,
112L, 113L, 114L, 115L, 116L, 120L, 121L, 124L, 125L, 126L,
...`

Could not find any LRpairs on stereo-seq data

Hi, thanks for your tools!

Since the stereo-seq data is single-cell level, I follow the tutorial of single-cell ST data, using the custom LRs and pathway in the "Data". But after the "find_lr_path", there is no LR pairs in the object and the following steps could not be continued. There is more than five cell types in my data. Did I miss something?

obj <- SpaTalk::createSpaTalk(st_data, st_meta,species="Mouse", if_st_is_sc = T, spot_max_cell = 1, celltype = as.character(st$region))

obj

An object of class SpaTalk
15488 genes across 3654 single-cells (0 lrpair)

load("../Spatalk/Code_github/data/lrpairs.rda") load("../Spatalk/Code_github/data/pathways.rda")
obj <- find_lr_path(object = obj, lrpairs = lrpairs, pathways = pathways,use_n_cores = 10)
Checking input data
Begin to filter lrpairs and pathways
Done

obj
An object of class SpaTalk
15488 genes across 3654 single-cells (0 lrpair)

obj <- dec_cci_all(obj, min_pairs = 1, use_n_cores = 10, per_num = 100, n_neighbor = 50)
Note: there are 8 cell types and 56 pair-wise cell pairs
Begin to find LR pairs
Error in { : task 1 failed - "invalid character indexing"

How to screen and visualize the genes or TFS of interest in the plot_lr_path regulatory network?

Hello, when I use plot_lr_path to generate the downstream regulatory network of ligand and receptor pairs, a large number of genes and TFS will be generated. How to screen and visualize the concerned genes or TFs in the plot_lr_path regulatory network? I have tried to modify the code of the plot_lr_path function to only retain the genes of interest and generate the x and y axis coordinates of the points and lines, but they cannot be accurately plotted. Can you provide help to complete this task?

How to get predict CCI results?

Hi,

Could you tell me which variable I should use if I want to get the predicting results of the cell-cell interactions from the R obj? I think all the functions in this repository is for plotting the results, but I would like to get the data.

Thanks!

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.