drieslab / Giotto

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

About using FDR in heatmap #751

Open Pedramto89 opened 1 year ago

Pedramto89 commented 1 year ago

Story

I did an analysis for cell-to-cell proximity and tried to visualize the results via heatmap built in function in giotto. However, I am not sure how in this code or plot, the FDR has been involved and should be interpreted.

...

Error Message

```r # Your error message here ```

Expected behavior

I expected to see a kind of plot that involves the FDR results into the cell-to-cell proximity enrichment scores. I used this code: "cell_proximity_results <- cellProximityEnrichment( gobject = my_giotto_object,
spatial_network_name = "kNN_network",
cluster_column = "subcluster_combined", number_of_simulations = 1000,
adjust_method = "fdr",
set_seed = TRUE,
seed_number = 1234
)"

image

If applicable, add screenshots to help explain your problem. NOTE: Screenshots of the attempted function call and full error message(s) are helpful for troubleshooting!

System Information

Please replace the following according to your machine:

Pedramto89 commented 11 months ago

Hi @RubD I hope you are well. I am still waiting for your response. In the cell proximity analysis in Giotto, I am not sure how we should visualize the statically significant results? Thnx!

RubD commented 11 months ago

hi @Pedramto89, the result from cellProximityEnrichment() is a simple list.

The first element of the list is the raw simulation table data and the second element provides a data.table with information about enrichment and significance (e.g. fdr). You can work with the data.table or convert that into a data.frame if you want (e.g. as.data.frame(cell_proximity_results[[2]]) and then filter the results as you wish.

Pedramto89 commented 11 months ago

Thank you for your prompt response @RubD !

I guess you are referring to this: "> str(cell_proximity_results) List of 2 $ raw_sim_table:Classes ‘data.table’ and 'data.frame': 35023 obs. of 5 variables: ..$ unified_int: chr [1:35023] "NA--NA" "Malignant_1--Malignant_1" "Malignant_1--Malignant_3" "Fibroblast_2--Malignant_1" ... ..$ type_int : chr [1:35023] NA "homo" "hetero" "hetero" ... ..$ round : chr [1:35023] "original" "original" "original" "original" ... ..$ V1 : num [1:35023] 17096 608 86 274 301 ... ..$ orig : chr [1:35023] "original" "original" "original" "original" ... ..- attr(, ".internal.selfref")= ..- attr(, "index")= int(0) .. ..- attr(, "__unified_int")= int [1:35023] 26 52 79 111 135 164 194 223 249 275 ... $ enrichm_res :Classes ‘data.table’ and 'data.frame': 29 obs. of 13 variables: ..$ unified_int : Factor w/ 29 levels "","Fibroblast_1",..: 29 28 27 26 25 24 23 22 21 20 ... ..$ type_int : chr [1:29] NA "homo" "homo" "homo" ... ..$ original : num [1:29] 17096 608 399 197 475 ... ..$ simulations : num [1:29] 0 186 123 62 151 ... ..$ enrichm : num [1:29] 14.06 1.71 1.7 1.65 1.65 ... ..$ p_higher_orig: num [1:29] 0 0 0 0 0 0 0 0.039 0.384 0.659 ... ..$ p_lower_orig : num [1:29] 1 1 1 1 1 1 1 0.963 0.644 0.356 ... ..$ p.adj_higher : num [1:29] 0 0 0 0 0 ... ..$ p.adj_lower : num [1:29] 1 1 1 1 1 ... ..$ PI_value : num [1:29] 42.18 5.12 5.09 4.95 4.95 ... ..$ int_ranking : int [1:29] 1 2 3 4 5 6 7 8 9 10 ... ..$ first_type : chr [1:29] "Malignant_1" "Fibroblast_3" "Malignant_3" ... ..$ second_type : chr [1:29] "NA" "Malignant_1" "Fibroblast_3" "Malignant_3" ... ..- attr(, ".internal.selfref")="

As you know, in most biological experiments, the statistical ajd.p.val cutoff is lower than 0.05;however, here, I see p.adj_higher and p.adj_lower which makes me confused about which one should I select as the cutoff? ALso, for the enrichm, I guess the more is the score, the more probable that two cells are close to each other spatially, and negative values show the opposite, am I correct? I tried to read the documentation but could not find any useful like.