vignettes/tut6_giotto_annotation.Rmd
tut6_giotto_annotation.Rmd
Clustering results or other type of metadata information can be further annotated by the user by providing a named vector. Cell or gene metadata can also be removed from the Giotto object if required.
\(~\)
# show leiden clustering results
cell_metadata = pDataDT(mini_giotto_single_cell)
cell_metadata[['leiden_clus']]
# 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 # leiden clustering results
# 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')
# inspect new annotation column
pDataDT(mini_giotto_single_cell)
# visualize annotation results
# annotation name is cell_types2 as provided in the previous command
spatDimPlot(gobject = mini_giotto_single_cell,
cell_color = 'cell_types2',
spat_point_size = 3, dim_point_size = 3)
\(~\)
#' # show cell metadata
pDataDT(mini_giotto_single_cell)
# remove cell_types column
mini_giotto_single_cell = removeCellAnnotation(mini_giotto_single_cell,
columns = 'cell_types')
\(~\)
# show gene metadata
fDataDT(mini_giotto_single_cell)
# remove nr_cells column
mini_giotto_single_cell = removeGeneAnnotation(mini_giotto_single_cell,
columns = 'nr_cells')