Spatial Cell-Cell communication scores based on spatial expression of interacting cells
spatCellCellcom(
gobject,
feat_type = NULL,
spat_unit = NULL,
spatial_network_name = "Delaunay_network",
cluster_column = "cell_types",
random_iter = 1000,
feat_set_1,
feat_set_2,
gene_set_1 = NULL,
gene_set_2 = NULL,
log2FC_addendum = 0.1,
min_observations = 2,
detailed = FALSE,
adjust_method = c("fdr", "bonferroni", "BH", "holm", "hochberg", "hommel", "BY",
"none"),
adjust_target = c("feats", "cells"),
do_parallel = TRUE,
cores = NA,
set_seed = TRUE,
seed_number = 1234,
verbose = c("a little", "a lot", "none")
)
giotto object to use
feature type
spatial unit
spatial network to use for identifying interacting cells
cluster column with cell type information
number of iterations
first specific feature set from feature pairs
second specific feature set from feature pairs
deprecated, use feat_set_1
deprecated, use feat_set_2
addendum to add when calculating log2FC
minimum number of interactions needed to be considered
provide more detailed information (random variance and z-score)
which method to adjust p-values
adjust multiple hypotheses at the cell or feature level
run calculations in parallel with mclapply
number of cores to use if do_parallel = TRUE
set a seed for reproducibility
seed number
verbose
Cell-Cell communication scores for feature pairs based on spatial interaction
Statistical framework to identify if pairs of genes (such as ligand-receptor combinations) are expressed at higher levels than expected based on a reshuffled null distribution of feature expression values in cells that are spatially in proximity to each other.
LR_comb: Pair of ligand and receptor
lig_cell_type: cell type to assess expression level of ligand
lig_expr: average expression of ligand in lig_cell_type
ligand: ligand name
rec_cell_type: cell type to assess expression level of receptor
rec_expr: average expression of receptor in rec_cell_type
receptor: receptor name
LR_expr: combined average ligand and receptor expression
lig_nr: total number of cells from lig_cell_type that spatially interact with cells from rec_cell_type
rec_nr: total number of cells from rec_cell_type that spatially interact with cells from lig_cell_type
rand_expr: average combined ligand and receptor expression from random spatial permutations
av_diff: average difference between LR_expr and rand_expr over all random spatial permutations
sd_diff: (optional) standard deviation of the difference between LR_expr and rand_expr over all random spatial permutations
z_score: (optional) z-score
log2fc: log2 fold-change (LR_expr/rand_expr)
pvalue: p-value
LR_cell_comb: cell type pair combination
p.adj: adjusted p-value
PI: significance score: log2fc * -log10(p.adj)
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
#> cell_spatInfo_spatVector.shp
#> cell
#>
#> 3.2 read Giotto spatial centroid information
#> cell
#>
#> 3.3 read Giotto spatial overlap information
#> No overlaps were found, overlap loading will be
#> skipped
#>
#> 4. read Giotto image information
#> a giotto python environment was found
#> Using python path:
#> "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw"
spatCellCellcom(
gobject = g,
cluster_column = "leiden_clus",
feat_set_1 = "Gm19935",
feat_set_2 = "9630013A20Rik",
verbose = "a lot",
random_iter = 10
)
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10 <- Inf returned
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10
#> simulations: 1 2 3 4 5 6 7 8 9 10 <- Inf returned
#> Warning: no adjusted p.values that are not zero; returning Inf
#> Warning: no adjusted p.values that are not zero; returning Inf
#> LR_comb lig_cell_type lig_expr ligand rec_cell_type
#> <char> <fctr> <num> <char> <fctr>
#> 1: Gm19935-9630013A20Rik 5 1.78685038 Gm19935 6
#> 2: Gm19935-9630013A20Rik 6 1.25341386 Gm19935 5
#> 3: Gm19935-9630013A20Rik 6 1.39370283 Gm19935 1
#> 4: Gm19935-9630013A20Rik 1 1.26325380 Gm19935 6
#> 5: Gm19935-9630013A20Rik 6 1.34521521 Gm19935 6
#> 6: Gm19935-9630013A20Rik 6 1.51239103 Gm19935 2
#> 7: Gm19935-9630013A20Rik 5 0.14614174 Gm19935 5
#> 8: Gm19935-9630013A20Rik 7 0.60289491 Gm19935 7
#> 9: Gm19935-9630013A20Rik 4 0.92522428 Gm19935 1
#> 10: Gm19935-9630013A20Rik 7 0.40437296 Gm19935 1
#> 11: Gm19935-9630013A20Rik 5 0.11024392 Gm19935 2
#> 12: Gm19935-9630013A20Rik 6 0.59885919 Gm19935 3
#> 13: Gm19935-9630013A20Rik 3 0.67646973 Gm19935 5
#> 14: Gm19935-9630013A20Rik 2 0.06646316 Gm19935 5
#> 15: Gm19935-9630013A20Rik 6 0.60686608 Gm19935 7
#> 16: Gm19935-9630013A20Rik 1 0.55560407 Gm19935 7
#> 17: Gm19935-9630013A20Rik 1 0.30914232 Gm19935 1
#> 18: Gm19935-9630013A20Rik 5 0.13598163 Gm19935 1
#> 19: Gm19935-9630013A20Rik 3 0.29380142 Gm19935 1
#> 20: Gm19935-9630013A20Rik 6 0.27008393 Gm19935 4
#> 21: Gm19935-9630013A20Rik 2 0.11342034 Gm19935 2
#> 22: Gm19935-9630013A20Rik 3 0.33661638 Gm19935 4
#> 23: Gm19935-9630013A20Rik 1 0.20683620 Gm19935 3
#> 24: Gm19935-9630013A20Rik 1 0.17850483 Gm19935 5
#> 25: Gm19935-9630013A20Rik 3 0.21449815 Gm19935 3
#> 26: Gm19935-9630013A20Rik 4 0.09396233 Gm19935 4
#> 27: Gm19935-9630013A20Rik 4 0.14061468 Gm19935 6
#> 28: Gm19935-9630013A20Rik 1 0.00000000 Gm19935 2
#> 29: Gm19935-9630013A20Rik 2 0.00000000 Gm19935 1
#> 30: Gm19935-9630013A20Rik 2 0.00000000 Gm19935 6
#> 31: Gm19935-9630013A20Rik 5 0.00000000 Gm19935 3
#> 32: Gm19935-9630013A20Rik 4 0.00000000 Gm19935 5
#> 33: Gm19935-9630013A20Rik 5 0.00000000 Gm19935 4
#> 34: Gm19935-9630013A20Rik 1 0.00000000 Gm19935 4
#> 35: Gm19935-9630013A20Rik 3 0.00000000 Gm19935 6
#> 36: Gm19935-9630013A20Rik 4 0.00000000 Gm19935 3
#> 37: Gm19935-9630013A20Rik 7 0.00000000 Gm19935 6
#> LR_comb lig_cell_type lig_expr ligand rec_cell_type
#> rec_expr receptor LR_expr lig_nr rec_nr rand_expr av_diff
#> <num> <char> <num> <int> <int> <num> <num>
#> 1: 0.98253548 9630013A20Rik 2.7693859 23 16 1.25380331 1.51558255
#> 2: 0.86184960 9630013A20Rik 2.1152635 16 23 1.09797881 1.01728464
#> 3: 0.22070242 9630013A20Rik 1.6144053 15 17 1.11451441 0.49989085
#> 4: 0.32184532 9630013A20Rik 1.5850991 17 15 0.81778091 0.76731822
#> 5: 0.20155242 9630013A20Rik 1.5467676 37 37 1.46096767 0.08579996
#> 6: 0.00000000 9630013A20Rik 1.5123910 2 3 0.99784387 0.51454716
#> 7: 0.95582749 9630013A20Rik 1.1019692 76 76 0.97852590 0.12344334
#> 8: 0.38773430 9630013A20Rik 0.9906292 8 8 1.22060116 -0.22997195
#> 9: 0.00000000 9630013A20Rik 0.9252243 3 2 0.28138576 0.64383852
#> 10: 0.45406594 9630013A20Rik 0.8584389 8 14 0.66226014 0.19617876
#> 11: 0.73487022 9630013A20Rik 0.8451141 34 38 0.59552083 0.24959330
#> 12: 0.17685852 9630013A20Rik 0.7757177 4 9 0.90734006 -0.13162236
#> 13: 0.00000000 9630013A20Rik 0.6764697 5 6 0.47407385 0.20239588
#> 14: 0.60181006 9630013A20Rik 0.6682732 38 34 0.57442519 0.09384803
#> 15: 0.00000000 9630013A20Rik 0.6068661 9 5 1.42367411 -0.81680803
#> 16: 0.00000000 9630013A20Rik 0.5556041 14 8 0.92352381 -0.36791974
#> 17: 0.17530545 9630013A20Rik 0.4844478 161 161 0.48444777 0.00000000
#> 18: 0.31893557 9630013A20Rik 0.4549172 57 41 0.69040344 -0.23548624
#> 19: 0.12413060 9630013A20Rik 0.4179320 89 102 0.43736950 -0.01943749
#> 20: 0.13080439 9630013A20Rik 0.4008883 47 26 0.81445915 -0.41357082
#> 21: 0.23907794 9630013A20Rik 0.3524983 121 121 0.34671247 0.00578580
#> 22: 0.00000000 9630013A20Rik 0.3366164 6 6 0.31198154 0.02463484
#> 23: 0.09032721 9630013A20Rik 0.2971634 102 89 0.36467062 -0.06750721
#> 24: 0.11224192 9630013A20Rik 0.2907468 41 57 0.64797278 -0.35722602
#> 25: 0.07000002 9630013A20Rik 0.2844982 108 108 0.28449817 0.00000000
#> 26: 0.10048837 9630013A20Rik 0.1944507 93 93 0.19445069 0.00000000
#> 27: 0.00000000 9630013A20Rik 0.1406147 26 47 0.55446844 -0.41385376
#> 28: 0.00000000 9630013A20Rik 0.0000000 3 1 0.36365588 -0.36365588
#> 29: 0.00000000 9630013A20Rik 0.0000000 1 3 1.15415007 -1.15415007
#> 30: 0.00000000 9630013A20Rik 0.0000000 3 2 0.77674202 -0.77674202
#> 31: 0.00000000 9630013A20Rik 0.0000000 6 5 0.32603077 -0.32603077
#> 32: 0.00000000 9630013A20Rik 0.0000000 4 1 0.04787715 -0.04787715
#> 33: 0.00000000 9630013A20Rik 0.0000000 1 4 0.14062751 -0.14062751
#> 34: 0.00000000 9630013A20Rik 0.0000000 2 3 0.60011948 -0.60011948
#> 35: 0.00000000 9630013A20Rik 0.0000000 9 4 0.52376116 -0.52376116
#> 36: 0.00000000 9630013A20Rik 0.0000000 6 6 0.17062548 -0.17062548
#> 37: 0.00000000 9630013A20Rik 0.0000000 5 9 1.59463534 -1.59463534
#> rec_expr receptor LR_expr lig_nr rec_nr rand_expr av_diff
#> log2fc pvalue LR_cell_comb p.adj PI
#> <num> <num> <char> <num> <num>
#> 1: 1.083724e+00 0.0 5--6 0.0 -Inf
#> 2: 8.868759e-01 0.0 6--5 0.0 -Inf
#> 3: 4.973286e-01 0.2 6--1 0.2 0.347617756
#> 4: 8.766118e-01 0.0 1--6 0.0 0.612725328
#> 5: 7.719634e-02 0.8 6--6 0.8 0.007481098
#> 6: 5.545288e-01 0.6 6--2 0.6 0.123021513
#> 7: 1.563391e-01 0.1 5--5 0.1 0.156339149
#> 8: -2.760341e-01 0.3 7--7 0.3 -0.144332371
#> 9: 1.426617e+00 0.4 4--1 0.4 0.567707847
#> 10: 3.304030e-01 0.4 7--1 0.4 0.131480586
#> 11: 4.423948e-01 0.0 5--2 0.0 0.176046606
#> 12: -2.020130e-01 0.6 6--3 0.6 -0.044816333
#> 13: 4.356933e-01 0.3 3--5 0.3 0.227814790
#> 14: 1.879610e-01 0.4 2--5 0.4 0.074797218
#> 15: -1.108046e+00 0.2 6--7 0.2 -0.774490595
#> 16: -6.426480e-01 0.2 1--7 0.2 -0.449191643
#> 17: 0.000000e+00 1.0 1--1 1.0 0.000000000
#> 18: -5.103167e-01 0.4 5--1 0.4 -0.203075434
#> 19: -5.315170e-02 0.4 3--1 0.4 -0.021151189
#> 20: -8.684297e-01 0.0 6--4 0.0 Inf
#> 21: 1.856575e-02 0.7 2--2 0.7 0.002875871
#> 22: 8.378658e-02 0.8 3--4 0.8 0.008119758
#> 23: -2.264757e-01 0.2 1--3 0.2 -0.158299738
#> 24: -9.367519e-01 0.0 1--5 0.0 -0.372771048
#> 25: 0.000000e+00 1.0 3--3 1.0 0.000000000
#> 26: -3.203427e-16 1.0 4--4 1.0 0.000000000
#> 27: -1.443599e+00 0.0 4--6 0.0 Inf
#> 28: -2.213054e+00 0.7 1--2 0.7 -0.342806471
#> 29: -3.648638e+00 0.6 2--1 0.6 -0.809445798
#> 30: -3.132152e+00 0.4 2--6 0.4 -1.246408751
#> 31: -2.090958e+00 0.5 5--3 0.5 -0.629440967
#> 32: -5.643991e-01 0.9 4--5 0.9 -0.025825487
#> 33: -1.266802e+00 0.8 5--4 0.8 -0.122765760
#> 34: -2.807601e+00 0.7 1--4 0.7 -0.434902922
#> 35: -2.640994e+00 0.2 3--6 0.2 -1.845975399
#> 36: -1.436298e+00 0.6 4--3 0.6 -0.318640847
#> 37: -4.082903e+00 0.0 7--6 0.0 -2.853826696
#> log2fc pvalue LR_cell_comb p.adj PI