scPlant have implemented several different solutions for automatic cell-type annotation that are based on popular tools, including SingleR, Garnett, scCATCH, Celaref and CellAssign.
Reference based tools
SingleR
, Celaref
and
CellFunTopic
need reference data to perform automatic
cell-type annotation.
Please see the following examples. Take seuratObj_ref
as
the reference scRNA-seq data, and take SeuratObj
as the
query un-annotated scRNA-seq data.
Using SingleR
seuratObj_ref$label <- seuratObj_ref$cell_type
SCE_ref <- Seurat::as.SingleCellExperiment(seuratObj_ref)
SeuratObj <- AutoAnnotate_SingleR(SeuratObj, SCE_ref, ref_type = "single-cell")
# The predicted cell type label is stored in SeuratObj$predicted_label.
Using Celaref
cellinfo_ref <- seuratObj_ref$cell_type %>% tibble::enframe(name = "CellId", value = "Cluster") %>% as.data.frame
result <- AutoAnnotate_Celaref(SeuratObj, counts_ref = seuratObj_ref@assays$RNA@data,
cellinfo_ref = cellinfo_ref, plot = TRUE)
Using CellFunTopic
We suggest performing GSEA analysis on the reference dataset before transferring annotation to query dataset using CellFunTopic.
seuratObj_ref <- RunGSEA_plant(seuratObj_ref, by = 'GO', GeneIDtype = 'TAIR')
result <- CellFunTopic::predictFun(
query_SeuratObj = SeuratObj,
seuratObj_ref,
group_by = "cell_type",
cluster_by = "seurat_clusters",
species = "Arabidopsis thaliana"
)
Marker based tools
scCATCH
, Garnett
and
CellAssign
need marker genes to perform automatic cell-type
annotation.
To run the following codes, a data frame with two columns
(celltype
, gene
) is needed, containing the
markers of each cell type. It is named markerDF
here.
Using scCATCH
First, we need to build a data frame of marker genes with the required format.
marker_custom <- get_marker_scCATCH(markerDF, species = 'Arabidopsis thaliana', tissue = 'root')
Then, you can perform automatic annotation with scCATCH.
result <- AutoAnnotate_scCATCH(SeuratObj, marker_custom)
Using Garnett
You can build a marker file by referring to the document, or just run the following code.
get_marker_file(markerDF, SeuratObj, file = "markers.txt")
# A marker file named markers.txt will be generated in your working directory.
Then, you can perform automatic annotation with Garnett.
SeuratObj <- AutoAnnotate_Garnett(SeuratObj, marker_file_path = "markers.txt")
# The predicted cell type label is stored in SeuratObj$predicted_label.
You may run into some errors prompting format problem of the marker file while running Garnett. If so, we recommend checking the format of the marker file using check_markers function and modify the format beforehand, which will reduce useless effort and save time.
Using CellAssign
SeuratObj <- AutoAnnotate_CellAssign(SeuratObj, markerDF)
# The predicted cell type label is stored in SeuratObj$predicted_label.