annotate_registered_clusters: Annotated spatially-registered clusters

View source: R/annotate_registered_clusters.R

annotate_registered_clustersR Documentation

Annotated spatially-registered clusters

Description

Once you have computed the enrichment t-statistics for your sc/snRNA-seq data using registration_wrapper() and related functions, you can then use layer_stat_cor() and layer_stat_cor_plot() to perform the spatial registartion of your sc/snRNA-seq data. This function helps interpret that matrix and assign layer labels to your clusters.

Usage

annotate_registered_clusters(
  cor_stats_layer,
  confidence_threshold = 0.25,
  cutoff_merge_ratio = 0.25
)

Arguments

cor_stats_layer

The output of layer_stat_cor().

confidence_threshold

A numeric(1) specifying the minimum correlation that a given cluster must have against any of the layers (by default) to be considered as having a 'good' assignment. Otherwise, the confidence will be 'poor' and the final label will have an asterisk.

cutoff_merge_ratio

A numeric(1) specifying the threshold for merging or not layer assignments (by default). This is a proportion of the difference between the current correlation and the next highest given the units of the next highest correlation. Defaults to a difference of 25% of the next highest correlation: if the observed difference is lower than this threshold, then we keep merging. Higher values will lead to more layers (by default) being merged.

Details

If you change the input modeling_results to layer_stat_cor() then the interpretation of this function could change. For example, maybe you have your own spatially-resolved transcriptomics data that doesn't have to be about DLPFC layers.

Value

A data.frame with 3 columns. Your clusters, the layer_confidence which depends on confidence_threshold, and the layer_label.

See Also

Other Layer correlation functions: layer_stat_cor(), layer_stat_cor_plot()

Examples

## Obtain the necessary data
if (!exists("modeling_results")) {
    modeling_results <- fetch_data(type = "modeling_results")
}

## Compute the correlations
cor_stats_layer <- layer_stat_cor(
    tstats_Human_DLPFC_snRNAseq_Nguyen_topLayer,
    modeling_results,
    model_type = "enrichment"
)

## Obtain labels
annotate_registered_clusters(cor_stats_layer)

## More relaxed merging threshold
annotate_registered_clusters(cor_stats_layer, cutoff_merge_ratio = 1)

LieberInstitute/spatialLIBD documentation built on Nov. 4, 2024, 11:57 a.m.