registration_stats_enrichment: Spatial registration: compute enrichment statistics

View source: R/registration_stats_enrichment.R

registration_stats_enrichmentR Documentation

Spatial registration: compute enrichment statistics

Description

This function computes the gene enrichment t-statistics (one group > the rest). These t-statistics are the ones typically used for spatial registration with layer_stat_cor() and related functions.

Usage

registration_stats_enrichment(
  sce_pseudo,
  block_cor,
  covars = NULL,
  var_registration = "registration_variable",
  var_sample_id = "registration_sample_id",
  gene_ensembl = NULL,
  gene_name = NULL
)

Arguments

sce_pseudo

The output of registration_pseudobulk().

block_cor

A numeric(1) computed with registration_block_cor().

covars

A character() with names of sample-level covariates.

var_registration

A character(1) specifying the colData(sce_pseudo) variable of interest against which will be used for computing the relevant statistics.

var_sample_id

A character(1) specifying the colData(sce_pseudo) variable with the sample ID.

gene_ensembl

A character(1) specifying the rowData(sce_pseudo) column with the ENSEMBL gene IDs. This will be used by layer_stat_cor().

gene_name

A character(1) specifying the rowData(sce_pseudo) column with the gene names (symbols).

Value

A data.frame() with the enrichment statistical results. This is similar to fetch_data("modeling_results")$enrichment.

See Also

Other spatial registration and statistical modeling functions: registration_block_cor(), registration_model(), registration_pseudobulk(), registration_stats_anova(), registration_stats_pairwise(), registration_wrapper()

Examples

example("registration_block_cor", package = "spatialLIBD")
results_enrichment <- registration_stats_enrichment(sce_pseudo,
    block_cor, "age",
    gene_ensembl = "ensembl", gene_name = "gene_name"
)
head(results_enrichment)

## Specifying `block_cor = NaN` then ignores the correlation structure
results_enrichment_nan <- registration_stats_enrichment(sce_pseudo,
    block_cor = NaN, "age",
    gene_ensembl = "ensembl", gene_name = "gene_name"
)
head(results_enrichment_nan)

LieberInstitute/spatialLIBD documentation built on Dec. 19, 2024, 7:12 p.m.