Converts cluster results into a user provided annotation.
annotateGiotto(
gobject,
annotation_vector = NULL,
cluster_column = NULL,
name = "cell_types"
)
giotto object
You need to specifify which (cluster) column you want to annotate and you need to provide an annotation vector like this:
1. identify the cell type of each cluster
2. create a vector of these cell types, e.g. cell_types = c('T-cell', 'B-cell', 'Stromal')
3. provide original cluster names to previous vector, e.g. names(cell_types) = c(2, 1, 3)
data(mini_giotto_single_cell)
#> Warning: data set ‘mini_giotto_single_cell’ not found
# show leiden clustering results
cell_metadata = pDataDT(mini_giotto_single_cell)
#> Warning: restarting interrupted promise evaluation
#> Warning: restarting interrupted promise evaluation
#> Error: object 'mini_giotto_single_cell' not found
cell_metadata[['leiden_clus']]
#> Error: object 'cell_metadata' not found
# create vector with cell type names as names of the vector
clusters_cell_types = c('cell_type_1', 'cell_type_2', 'cell_type_3')
names(clusters_cell_types) = 1:3
# convert cluster results into annotations and add to cell metadata
mini_giotto_single_cell = annotateGiotto(gobject = mini_giotto_single_cell,
annotation_vector = clusters_cell_types,
cluster_column = 'leiden_clus', name = 'cell_types2')
#> Warning: restarting interrupted promise evaluation
#> Warning: restarting interrupted promise evaluation
#> Error: object 'mini_giotto_single_cell' not found
# visualize annotation results
spatDimPlot(gobject = mini_giotto_single_cell,
cell_color = 'cell_types2',
spat_point_size = 3, dim_point_size = 3)
#> Warning: restarting interrupted promise evaluation
#> Warning: restarting interrupted promise evaluation
#> Warning: restarting interrupted promise evaluation
#> Error: object 'mini_giotto_single_cell' not found