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 = NULL,
  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")
)

specificCellCellcommunicationScores(
  gobject,
  feat_type = NULL,
  spat_unit = NULL,
  spatial_network_name = "Delaunay_network",
  cluster_column = NULL,
  random_iter = 100,
  cell_type_1 = NULL,
  cell_type_2 = NULL,
  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"),
  set_seed = FALSE,
  seed_number = 1234,
  verbose = TRUE
)

Arguments

gobject

giotto object to use

feat_type

feature type

spat_unit

spatial unit

spatial_network_name

spatial network to use for identifying interacting cells

cluster_column

cluster column with cell type information

random_iter

number of iterations

feat_set_1

first specific feature set from feature pairs

feat_set_2

second specific feature set from feature pairs

gene_set_1

deprecated, use feat_set_1

gene_set_2

deprecated, use feat_set_2

log2FC_addendum

addendum to add when calculating log2FC

min_observations

minimum number of interactions needed to be considered

detailed

provide more detailed information (random variance and z-score)

adjust_method

which method to adjust p-values

adjust_target

adjust multiple hypotheses at the cell or feature level

do_parallel

run calculations in parallel with mclapply

cores

number of cores to use if do_parallel = TRUE

set_seed

set a seed for reproducibility

seed_number

seed number

verbose

verbose

cell_type_1

character. First cell type

cell_type_2

character. Second cell type

Value

Cell-Cell communication scores for feature pairs based on spatial interaction

Details

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)\)

Examples

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"

res1 <- spatCellCellcom(
    gobject = g,
    cluster_column = "leiden_clus",
    feat_set_1 = "Gm19935",
    feat_set_2 = "9630013A20Rik",
    verbose = "a lot",
    random_iter = 10
)
#> Error: package 'future' is not yet installed
#> 
#>  To install:
#> install.packages(c("future"))
force(res1)
#> Error: object 'res1' not found

res2 <- specificCellCellcommunicationScores(g,
    cluster_column = "leiden_clus",
    cell_type_1 = 1,
    cell_type_2 = 2,
    feat_set_1 = "Gm19935",
    feat_set_2 = "9630013A20Rik"
)
#> simulations: 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99  100 

force(res2)
#> Key: <LR_comb>
#>                  LR_comb lig_cell_type lig_expr  ligand rec_cell_type rec_expr
#>                   <char>        <fctr>    <num>  <char>        <fctr>    <num>
#> 1: Gm19935-9630013A20Rik             1        0 Gm19935             2        0
#> 2: Gm19935-9630013A20Rik             2        0 Gm19935             1        0
#>         receptor LR_expr lig_nr rec_nr rand_expr    av_diff    log2fc pvalue
#>           <char>   <num>  <int>  <int>     <num>      <num>     <num>  <num>
#> 1: 9630013A20Rik       0      3      1 0.4297780 -0.4297780 -2.405388   0.81
#> 2: 9630013A20Rik       0      1      3 0.3369074 -0.3369074 -2.127328   0.83
#>    LR_cell_comb p.adj         PI
#>          <char> <num>      <num>
#> 1:         1--2  0.81 -0.2201290
#> 2:         2--1  0.83 -0.1721474