Function to calculate gene signature enrichment scores per spatial position using PAGE.
runPAGEEnrich(
gobject,
spat_unit = NULL,
feat_type = NULL,
sign_matrix,
expression_values = c("normalized", "scaled", "custom"),
min_overlap_genes = 5,
reverse_log_scale = TRUE,
logbase = 2,
output_enrichment = c("original", "zscore"),
p_value = FALSE,
include_depletion = FALSE,
n_times = 1000,
max_block = 2e+07,
name = NULL,
verbose = TRUE,
return_gobject = TRUE
)
Giotto object
spatial unit
feature type
Matrix of signature genes for each cell type / process
expression values to use
minimum number of overlapping genes in sign_matrix required to calculate enrichment
reverse expression values from log scale
log base to use if reverse_log_scale = TRUE
how to return enrichment output
calculate p-values (boolean, default = FALSE)
calculate both enrichment and depletion
number of permutations to calculate for p_value
number of lines to process together (default = 20e6)
to give to spatial enrichment results, default = PAGE
be verbose
return giotto object
data.table with enrichment results
sign_matrix: a binary matrix with genes as row names and cell-types as
column names.
Alternatively a list of signature genes can be provided to
makeSignMatrixPAGE, which will create the matrix for you.
The enrichment Z score is calculated by using method (PAGE) from Kim SY et al., BMC bioinformatics, 2005 as \(Z = ((Sm – mu)*m^(1/2)) / delta\). For each gene in each spot, mu is the fold change values versus the mean expression and delta is the standard deviation. Sm is the mean fold change value of a specific marker gene set and m is the size of a given marker gene set.
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
#>
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
sign_gene <- c(
"Bcl11b", "Lmo1", "F3", "Cnih3", "Ppp1r3c", "Rims2", "Gfap",
"Gjc3", "Chrna4", "Prkcd", "Prr18", "Grb14", "Tprn", "Clic1", "Olig2",
"Hrh3", "Tmbim1", "Carhsp1", "Tmem88b", "Ugt8a", "Arpp19", "Lamp5",
"Galnt6", "Hlf", "Hs3st2", "Tbr1", "Myl4", "Cygb", "Ttc9b", "Ipcef1"
)
sign_matrix <- matrix(rnorm(length(sign_gene) * 3, mean = 10),
nrow = length(sign_gene)
)
rownames(sign_matrix) <- sign_gene
colnames(sign_matrix) <- c("cell_type1", "cell_type2", "cell_type3")
runPAGEEnrich(gobject = g, sign_matrix = sign_matrix)
#> An object of class giotto
#> >Active spat_unit: cell
#> >Active feat_type: rna
#> [SUBCELLULAR INFO]
#> polygons : cell
#> [AGGREGATE INFO]
#> expression -----------------------
#> [cell][rna] raw normalized scaled
#> spatial locations ----------------
#> [cell] raw
#> spatial networks -----------------
#> [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#> [cell][rna] cluster_metagene DWLS PAGE
#> dim reduction --------------------
#> [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#> [cell][rna] sNN.pca custom_NN
#> attached images ------------------
#> images : alignment image
#>
#>
#> Use objHistory() to see steps and params used