Skip to contents

[Stable]

Utility function to calculate the physical xy coordinates of each seurat cluster based on a dimensional reduction already present in the object. The results are returned in a list with the length of the number of distinct seurat clusters based on the seurat_obj meta.data.

Usage

getReductionCentroids(seurat_obj, reduction)

Arguments

seurat_obj

input seurat object with the dimensional reduction of choice already present, and seurat clusters computed.

reduction

character. The reduction that the centroid calculation should be based on.

Value

A list of the length of the number of distinct clusters in the seurat object metadata, where each element of the list is a numeric vector of length 2, with the numbers corresponding to the x and y coordinate respectively of the seurat cluster with the corresponding index.

Examples

data("combined_pbmc")
getReductionCentroids(combined_pbmc, reduction = "umap")
#> [[1]]
#> [1] -0.5520761  1.5759817
#> 
#> [[2]]
#> [1] -3.574884  3.540254
#> 
#> [[3]]
#> [1]  0.01797853 -2.58801380
#> 
#> [[4]]
#> [1]  2.286141 -3.725952
#> 
#> [[5]]
#> [1]  2.8382880 -0.4037927
#> 
#> [[6]]
#> [1] -4.0363226 -0.4305999
#> 
#> [[7]]
#> [1] -2.70084443  0.07299683
#> 
#> [[8]]
#> [1] -5.458845  1.368534
#> 
#> [[9]]
#> [1] -0.3310686 -7.3980698
#> 
#> [[10]]
#> [1] 6.462779 2.676704
#> 
#> [[11]]
#> [1] 4.331663 6.469934
#> 
#> [[12]]
#> [1]  7.412756 -1.077086
#> 
#> [[13]]
#> [1]  6.016761 -4.398412
#> 
#> [[14]]
#> [1] 3.936158 5.156336
#> 
#> [[15]]
#> [1] 1.701154 2.805537
#> 
#> [[16]]
#> [1]  1.087608 -6.011758
#> 
#> [[17]]
#> [1] 6.244391 5.224249
#>