drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

Error spatCellCellcom #448

Closed JessicaChevallier closed 1 year ago

JessicaChevallier commented 1 year ago

Hello,

I'm trying to use the function spatCellCellcom following the tutorial provided on seqFISH data. However, I obtain the following error. Has anyone run into a similar issue and could potentially guide me?

Thank you!

spatial_all_scores = spatCellCellcom(young_data, spatial_network_name = 'spatial_network', cluster_column = 'seurat_clusters', random_iter = 1000, gene_set_1 = select_ligands, gene_set_2 = select_receptors, adjust_method = 'none', do_parallel = F, verbose = 'a little')

PROCESS nr 28 : 2 and 2

completed 1: preparation completed 2: subset expression data completed 3: subset spatial locations completed 4: subset cell (spatial units) and feature IDs completed 5: subset cell metadata completed 6: subset feature metadata completed 7: subset spatial network(s) completed 8: subsetted dimension reductions completed 9: subsetted nearest network(s) completed 10: subsetted spatial enrichment results number of frames: 3 sys parent: 2

Error: level sets of factors are different

RubD commented 1 year ago

Hi @JessicaChevallier , are you using Giotto Suite 3.0.1? See packageVersion('Giotto')

And is this the tutorial you followed? https://giottosuite.readthedocs.io/en/latest/subsections/datasets/seqFISH_cortex.html

JessicaChevallier commented 1 year ago

Hi,

Thank you for getting back to me! I'm using Giotto Suite 3.0.1 and yes that's the tutorial I'm following.

packageVersion('Giotto') [1] 3.0.1

Maybe this is occurring because I'm not working with single-cell spatial transcriptomic data. As a result, the "cluster_column" argument contains my previously identified clusters instead of cell types. However, I used clusters instead of cell types with the function exprCellCellcom and no issues occurred. What do you think?

Best, Jessica

mattobny commented 1 year ago

Hello @JessicaChevallier, quick FYI, the arguments gene_set_1 and gene_set_2 are deprecated, and have since been replaced by feat_set_1 and feat_set_2. This trend holds true for practically all arguments in the package (i.e., arguments containing 'gene' have been deprecated and replaced by ones containing 'feat' instead).

I notice that your cluster column is entitled 'seurat_clusters'. Has your Giotto Object been created by converting from a Seurat format? If so, it's possible that the data within that container is of class "factor", which could be causing the issue.

In the tutorial, the cluster_column cell_types is a vector of class "character". Regardless, using clustering information instead of cell typing as an argument to cluster_column is possible; the clustering information as written in the tutorial is contained within leiden_clus in the cell_metadata slot, and is of class "numeric". Running the following:

spatial_all_scores = spatCellCellcom(SS_seqfish,
                                     spatial_network_name = 'spatial_network',
                                     cluster_column = 'leiden_clus',
                                     random_iter = 1000,
                                     feat_set_1 = select_ligands,
                                     feat_set_2 = select_receptors,
                                     adjust_method = 'fdr',
                                     do_parallel = F,
                                     verbose = 'a little')

works, but will take some time to complete.

In short, try to coerce the class of your cluster column to "numeric" or "character", and this should get you moving in the right direction. Please post a follow up if further assistance is required, we'd be glad to help you continue to troubleshoot!

JessicaChevallier commented 1 year ago

Hello,

Thank you for your help! Coercing the Seurat cluster column to "character" worked. I was wondering if you plan on adding an argument to this function that will allow users to use a custom receptor-ligand list?

mattobny commented 1 year ago

@JessicaChevallier There is not need for an additional argument here, since the arguments select_ligands and select_receptors already encompass these lists and may be customized. I apologize for the delay in this response as I thought I had replied much earlier. Regardless, since there have been no new developments in this thread I am marking it as closed. Please post a new issue if something comes up!