Previously: calculate_spatial_genes_python. This method computes a silhouette score per gene based on the spatial distribution of two partitions of cells (expressed L1, and non-expressed L0). Here, rather than L2 Euclidean norm, it uses a rank-transformed, exponentially weighted function to represent the local physical distance between two cells. New multi aggregator implementation can be found at silhouetteRankTest

silhouetteRank(
  gobject,
  expression_values = c("normalized", "scaled", "custom"),
  metric = "euclidean",
  subset_genes = NULL,
  rbp_p = 0.95,
  examine_top = 0.3,
  python_path = NULL
)

Arguments

gobject

giotto object

expression_values

expression values to use

metric

distance metric to use

subset_genes

only run on this subset of genes

rbp_p

fractional binarization threshold

examine_top

top fraction to evaluate with silhouette

python_path

specify specific path to python if required

Value

data.table with spatial scores

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"

silhouetteRank(g)
#> Error in py_run_file_impl(file, local, convert): ModuleNotFoundError: No module named 'scipy'
#> Run `reticulate::py_last_error()` for details.