Compute cell-cell interaction enrichment (observed vs expected)
cellProximityEnrichment(
gobject,
spat_unit = NULL,
feat_type = NULL,
spatial_network_name = "Delaunay_network",
cluster_column,
number_of_simulations = 1000,
adjust_method = c("none", "fdr", "bonferroni", "BH", "holm", "hochberg", "hommel",
"BY"),
set_seed = TRUE,
seed_number = 1234
)
giotto object
spatial unit
feature type
name of spatial network to use
name of column to use for clusters
number of simulations to create expected observations
method to adjust p.values
use of seed
seed number to use
List of cell Proximity scores (CPscores) in data.table format. The first data.table (raw_sim_table) shows the raw observations of both the original and simulated networks. The second data.table (enrichm_res) shows the enrichment results.
Spatial proximity enrichment or depletion between pairs of cell types is calculated by calculating the observed over the expected frequency of cell-cell proximity interactions. The expected frequency is the average frequency calculated from a number of spatial network simulations. Each individual simulation is obtained by reshuffling the cell type labels of each node (cell) in the spatial network.
g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> python already initialized in this session
#> active environment : '/usr/bin/python3'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
cellProximityEnrichment(g, cluster_column = "leiden_clus")
#> $raw_sim_table
#> Index: <unified_int>
#> unified_int type_int round V1 orig
#> <char> <char> <char> <num> <char>
#> 1: 1--5 hetero original 91 original
#> 2: 1--1 homo original 305 original
#> 3: 1--3 hetero original 208 original
#> 4: 2--2 homo original 287 original
#> 5: 4--4 homo original 220 original
#> ---
#> 32020: 3--7 hetero sim999 0 original
#> 32021: 2--3 hetero sim1000 0 original
#> 32022: 2--4 hetero sim1000 0 original
#> 32023: 2--7 hetero sim1000 0 original
#> 32024: 3--7 hetero sim1000 0 original
#>
#> $enrichm_res
#> unified_int type_int original simulations enrichm p_higher_orig
#> <fctr> <char> <num> <num> <num> <num>
#> 1: 7--7 homo 10 0.400 2.9740048 0.000
#> 2: 4--4 homo 220 39.441 2.4501558 0.000
#> 3: 2--2 homo 287 60.358 2.2307454 0.000
#> 4: 6--6 homo 37 7.949 2.0862010 0.000
#> 5: 5--5 homo 124 30.389 1.9935971 0.000
#> 6: 3--3 homo 204 58.244 1.7908830 0.000
#> 7: 6--7 hetero 12 3.678 1.4745479 0.000
#> 8: 1--1 homo 305 130.037 1.2235574 0.000
#> 9: 4--6 hetero 72 35.104 1.0157378 0.000
#> 10: 1--3 hetero 208 174.354 0.2532326 0.001
#> 11: 1--7 hetero 20 14.927 0.3989148 0.085
#> 12: 5--6 hetero 39 30.993 0.3222437 0.064
#> 13: 2--5 hetero 73 85.352 -0.2227043 0.942
#> 14: 1--5 hetero 91 126.419 -0.4698747 1.000
#> 15: 5--7 hetero 2 7.263 -1.4617032 0.997
#> 16: 1--6 hetero 26 64.350 -1.2752278 1.000
#> 17: 4--7 hetero 1 8.329 -2.2217224 1.000
#> 18: 3--6 hetero 10 42.879 -1.9960271 1.000
#> 19: 3--4 hetero 9 95.910 -3.2766455 1.000
#> 20: 3--5 hetero 7 83.958 -3.4086779 1.000
#> 21: 3--7 hetero 0 9.895 -3.4455943 1.000
#> 22: 2--6 hetero 3 43.098 -3.4626413 1.000
#> 23: 2--7 hetero 0 10.108 -3.4735272 1.000
#> 24: 4--5 hetero 4 69.237 -3.8122312 1.000
#> 25: 1--4 hetero 3 143.602 -5.1759437 1.000
#> 26: 1--2 hetero 3 177.274 -5.4779525 1.000
#> 27: 2--4 hetero 0 97.936 -6.6284237 1.000
#> 28: 2--3 hetero 0 118.516 -6.9010600 1.000
#> unified_int type_int original simulations enrichm p_higher_orig
#> p_lower_orig p.adj_higher p.adj_lower PI_value int_ranking
#> <num> <num> <num> <num> <int>
#> 1: 1.000 0.000 1.000 8.9220144 1
#> 2: 1.000 0.000 1.000 7.3504674 2
#> 3: 1.000 0.000 1.000 6.6922363 3
#> 4: 1.000 0.000 1.000 6.2586031 4
#> 5: 1.000 0.000 1.000 5.9807914 5
#> 6: 1.000 0.000 1.000 5.3726489 6
#> 7: 1.000 0.000 1.000 4.4236436 7
#> 8: 1.000 0.000 1.000 3.6706723 8
#> 9: 1.000 0.000 1.000 3.0472133 9
#> 10: 1.000 0.001 1.000 0.6834672 10
#> 11: 0.952 0.085 0.952 0.4250443 11
#> 12: 0.951 0.064 0.951 0.3825312 12
#> 13: 0.083 0.942 0.083 -0.2395677 13
#> 14: 0.000 1.000 0.000 -1.4096240 14
#> 15: 0.016 0.997 0.016 -2.5865584 15
#> 16: 0.000 1.000 0.000 -3.8256835 16
#> 17: 0.003 1.000 0.003 -5.3275571 17
#> 18: 0.000 1.000 0.000 -5.9880814 18
#> 19: 0.000 1.000 0.000 -9.8299366 19
#> 20: 0.000 1.000 0.000 -10.2260337 20
#> 21: 0.000 1.000 0.000 -10.3367829 21
#> 22: 0.000 1.000 0.000 -10.3879240 22
#> 23: 0.000 1.000 0.000 -10.4205815 23
#> 24: 0.000 1.000 0.000 -11.4366937 24
#> 25: 0.000 1.000 0.000 -15.5278311 25
#> 26: 0.000 1.000 0.000 -16.4338575 26
#> 27: 0.000 1.000 0.000 -19.8852710 27
#> 28: 0.000 1.000 0.000 -20.7031799 28
#> p_lower_orig p.adj_higher p.adj_lower PI_value int_ranking
#>