drieslab / Giotto

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

RANK enrichment issue #152

Open juan-quintana2020 opened 2 years ago

juan-quintana2020 commented 2 years ago

Hi there,

Firstly - excellent tool! I really like the outputs so far.

I'm trying to map my single cell dataset onto my spatial dataset using RANK enrichment (script below from your website).

single cell matrix

single_cell_DT = fread('/path/to/raw_exp_small.txt') single_cell_matrix = Giotto:::dt_to_matrix(single_cell_DT) single_cell_matrix[1:4, 1:4]

single cell annotation vector

cell_annotations = read.table(file = '/path/to/major_cluster_small.txt') cell_annotations = as.vector(cell_annotations$V1) cell_annotations[1:10]

1.2 create rank matrix

rank_matrix = makeSignMatrixRank(sc_matrix = single_cell_matrix, sc_cluster_ids = cell_annotations)

1.3 enrichment test with RANK

runSpatialEnrich() can also be used as a wrapper for all currently provided enrichment options

my_giotto_object = runRankEnrich(gobject = my_giotto_object, sign_matrix = rank_matrix)

I'm struggling to find out how to retrieve the equivalent of the "raw_exp_small.txt" and "major_cluster_small.txt" files from my Seurat scRNAseq object? Is there any other way to map the data? Once the mapping has been done, how do I rename the Leiden clusters? Or how do I add the cell ID info onto the metadata?

Many thanks!

juan-quintana2020 commented 2 years ago

Hi there, I think I managed to find a way around this. However, it is taking >24h to run the deconvolution. I guess it depends on the size of the reference dataset, but was wondering if this is normal?

gcyuan commented 2 years ago

Could you let us know which branch you are working on and how big is your data? The older version 1.0.3 has some bugs and has since been fixed. For the current version, it took us 16 mins to analyze Visium mouse brain data from 10X Genomics website on a personal computer. Some compter-to-computer variation is expected but should not be too large.

juan-quintana2020 commented 2 years ago

Hu @gcyuan - I'm trying to use the deconvolution tool instead but the process is taking >24h. The script below:

sign_matrix <- readExprMatrix("/Users/juanquintana/Downloads/avgexp_combined.txt") cell_types_subset = colnames(sign_matrix) sign_matrix <- makeSignMatrixDWLS(gobject = d45, sign_gene = signature_matrix, cell_type = cell_types) d45 <- runSpatialDeconv(gobject = d45, deconv_method = "DWLS", expression_values = "normalized", logbase = 2, cluster_column = "leiden_clus", sign_matrix = sign_matrix, n_cell = 10, cutoff = 2, name = "DWLS_1")

I did not try the RANK deconvolution analysis as I couldn't understand where to get the data from? Would this work with an expression matrix from scRNAseq data?

The only package that is working for me now is PAGE using marker genes from my scRNAseq dataset. However, I'm not sure how to resolve the spots with this package? The script below:

signature_matrix = makeSignMatrixPAGE(sign_names = c('Cx3cr1_1_micro_markers', 'Cx3cr1_2_micro_markers','Cd14_mono_markers', 'Chil3_macs_markers', "B_markers", "Olig1_markers", "Olig2_markers", "Olig3_markers", "Neuron_markers", "Gfap_markers", "Agt_markers", "Cd8_1 markers", "Cd8_2 markers", "Cd4_markers"), sign_list = list(Cx3cr1_1_micro_markers, Cx3cr1_2_micro_markers,Cd14_mono_markers, Chil3_macs_markers, B_markers, Olig1_markers, Olig2_markers, Olig3_markers, Neuron_markers, Gfap_markers, Agt_markers, Cd8_1_markers, Cd8_2_markers, Cd4_markers)) d45 = runPAGEEnrich(gobject = d45, sign_matrix = signature_matrix, min_overlap_genes = 2) cell_types_subset = colnames(signature_matrix) spatCellPlot(gobject = d45, spat_enr_names = 'PAGE',cell_annotation_values = cell_types_subset, cow_n_col = 2,coord_fix_ratio = NULL, point_size = 1.5) d45@spatial_enrichment

I can't seem to find the cell ID assign to each spot, or even the proportion of cells, after running this script.

I was also wondering about the interoperability between packages. Can I use SPOTLight outputs for cell-cell interaction analysis on Giotto?

Thanks a lot,

Juan

bernard2012 commented 2 years ago

Hi, For rank enrichment, the beauty is that you do not need to supply the signature matrix yourself. I don't know where you are getting the instructions from. But I think the instructions from the original website, under dataset examples under SlideSeq provides a pretty clear example how to use the function:

http://spatialgiotto.rc.fas.harvard.edu/giotto.slideseq.html

We apologize if this error is due to mismatching instructions. Let us know where you see those instructions so we can fix them. @RubD