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.

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.

Value

A data.frame with 3 columns. Your clusters, the layer_confidence

which depends on confidence_threshold, and the layer_label.

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.

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")
}
#> 2024-05-03 14:23:02.214292 loading file /github/home/.cache/R/BiocFileCache/d0b17ec1af6_Human_DLPFC_Visium_modeling_results.Rdata%3Fdl%3D1

## 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)
#>    cluster layer_confidence layer_label
#> 1   22 (3)             good          WM
#> 2    3 (3)             good          WM
#> 3   23 (3)             good          WM
#> 4   17 (3)             good          WM
#> 5   21 (3)             good          WM
#> 6    7 (4)             good          L1
#> 7    5 (4)             good          L1
#> 8    9 (5)             poor      L1/WM*
#> 9   26 (5)             poor         L1*
#> 10   1 (4)             poor      L1/WM*
#> 11  24 (6)             poor         L6*
#> 12  13 (1)             good          L6
#> 13  10 (1)             good          L6
#> 14  27 (1)             good          L6
#> 15  29 (2)             poor         L4*
#> 16  14 (2)             good          L4
#> 17  15 (2)             poor       L5/4*
#> 18  18 (2)             poor         L4*
#> 19   2 (1)             poor         L5*
#> 20  31 (1)             good          L5
#> 21   8 (1)             poor         L2*
#> 22  16 (2)             poor         L2*
#> 23  28 (2)             poor         L2*
#> 24  30 (2)             poor         L2*
#> 25  20 (2)             poor     L3/5/4*
#> 26  11 (2)             poor       L4/3*
#> 27  25 (2)             poor     L2/4/3*
#> 28   4 (1)             good        L3/4
#> 29  12 (1)             good          L4
#> 30   6 (1)             good          L2
#> 31  19 (1)             good          L3

## More relaxed merging threshold
annotate_registered_clusters(cor_stats_layer, cutoff_merge_ratio = 1)
#>    cluster layer_confidence layer_label
#> 1   22 (3)             good          WM
#> 2    3 (3)             good          WM
#> 3   23 (3)             good          WM
#> 4   17 (3)             good          WM
#> 5   21 (3)             good          WM
#> 6    7 (4)             good          L1
#> 7    5 (4)             good          L1
#> 8    9 (5)             poor      L1/WM*
#> 9   26 (5)             poor      L1/WM*
#> 10   1 (4)             poor      L1/WM*
#> 11  24 (6)             poor    L6/WM/1*
#> 12  13 (1)             good          L6
#> 13  10 (1)             good          L6
#> 14  27 (1)             good          L6
#> 15  29 (2)             poor       L4/3*
#> 16  14 (2)             good      L4/5/3
#> 17  15 (2)             poor       L5/4*
#> 18  18 (2)             poor     L4/5/3*
#> 19   2 (1)             poor         L5*
#> 20  31 (1)             good          L5
#> 21   8 (1)             poor       L2/3*
#> 22  16 (2)             poor       L2/3*
#> 23  28 (2)             poor       L2/3*
#> 24  30 (2)             poor L2/3/4/5/1*
#> 25  20 (2)             poor     L3/5/4*
#> 26  11 (2)             poor   L4/3/2/5*
#> 27  25 (2)             poor   L2/4/3/5*
#> 28   4 (1)             good        L3/4
#> 29  12 (1)             good      L4/5/3
#> 30   6 (1)             good        L2/3
#> 31  19 (1)             good      L3/2/4