Title: | Aligning Ontology Annotation Across Single Cell Datasets with 'scOntoMatch' |
---|---|
Description: | Unequal granularity of cell type annotation makes it difficult to compare scRNA-seq datasets at scale. Leveraging the ontology system for defining cell type hierarchy, 'scOntoMatch' aims to align cell type annotations to make them comparable across studies. The alignment involves two core steps: first is to trim the cell type tree within each dataset so each cell type does not have descendants, and then map cell type labels cross-studies by direct matching and mapping descendants to ancestors. Various functions for plotting cell type trees and manipulating ontology terms are also provided. In the Single Cell Expression Atlas hosted at EBI, a compendium of datasets with curated ontology labels are great inputs to this package. |
Authors: | Yuyao Song [aut, cre, ctb], Irene Papatheodorou [aut, ths] |
Maintainer: | Yuyao Song <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2025-03-02 04:34:50 UTC |
Source: | https://github.com/papatheodorou-group/scontomatch |
make sure ontology names are all translated to ontology ids while warning, consider manual reannotation
check_ontology_translate(obj, onts, ont, anno_col)
check_ontology_translate(obj, onts, ont, anno_col)
obj |
seurat rds object |
onts |
ontology ids from translate |
ont |
ontologyIndex object |
anno_col |
annotation column in [email protected] that is translated to onts ids |
do not return a value but output messages
Get a names list of ontology and id by id
fill_query(all, query)
fill_query(all, query)
all |
all ontology id to plot tree |
query |
query ontology id to fill |
a color object to fill query in onto_plot
## Not run: fill_query(all = c("CL0000548", "CL:0000066", "CL:0000082"), query = c("CL:0000082")) ## End(Not run)
## Not run: fill_query(all = c("CL0000548", "CL:0000066", "CL:0000082"), query = c("CL:0000082")) ## End(Not run)
Get a names list of ontology and id by name
getOntologyId(ont, onto_name)
getOntologyId(ont, onto_name)
ont |
ontology object |
onto_name |
character vector of ontology names |
a named list mapping ontology id and ontology name
## Not run: getOntologyId(onto_name = "epithelial cell of lung", ont = ont) ## End(Not run)
## Not run: getOntologyId(onto_name = "epithelial cell of lung", ont = ont) ## End(Not run)
Get a names list of ontology and id by id
getOntologyName(ont, onto_id)
getOntologyName(ont, onto_id)
ont |
ontology object |
onto_id |
character vector of ontology ids |
a named list mapping ontology id and ontology name
## Not run: getOntologyName(onto_id = "epithelial cell of lung", ont = ont) ## End(Not run)
## Not run: getOntologyName(onto_id = "epithelial cell of lung", ont = ont) ## End(Not run)
match ontology terms by direct mapping and mapping descendants to ancestors
getOntoMapping(ont, onts1, onts2)
getOntoMapping(ont, onts1, onts2)
ont |
the ontology object from get_OBO |
onts1 |
a character vector of ontology id |
onts2 |
a character vector of ontology id |
a named list for ontology id mapping looks like ontology_id:ontology_id
## Not run: getOntoMapping(ont = ont, onts1 = "CL:0000548", onts2 = c("CL0000548", "CL:0000066")) ## End(Not run)
## Not run: getOntoMapping(ont = ont, onts1 = "CL:0000548", onts2 = c("CL0000548", "CL:0000066")) ## End(Not run)
match descendant terms to ancestor terms within a dataset
getOntoMinimal(ont, onts)
getOntoMinimal(ont, onts)
ont |
the ontology object from get_OBO |
onts |
a character vector of ontology id |
a named list for ontology id mapping looks like ontology_id:ontology_id
## Not run: getOntoMinimal(ont = ont, onts = c("CL0000548", "CL:0000066", "CL:0000082")) ## End(Not run)
## Not run: getOntoMinimal(ont = ont, onts = c("CL0000548", "CL:0000066", "CL:0000082")) ## End(Not run)
Match descendants to ancestors in multiple ontology id lists
getOntoMultiMapping(ont, onts)
getOntoMultiMapping(ont, onts)
ont |
ontologyIndex object |
onts |
named list of ontology ids |
a named character of mapping from:mapping to
## Not run: getOntoMultiMapping(ont = ont, onts = c("CL0000548", "CL:0000066", "CL:0000082")) ## End(Not run)
## Not run: getOntoMultiMapping(ont = ont, onts = c("CL0000548", "CL:0000066", "CL:0000082")) ## End(Not run)
read in seurat object .rds files as a named list of seurat object
getSeuratRds(metadata, sep)
getSeuratRds(metadata, sep)
metadata |
a metadata file indicating name, path to 'seurat' rds file |
sep |
sep of the metadata file |
a named list contains data name and the corresponding 'seurat' object
## Not run: getSeuratRds(metadata = 'metadata.tsv', sep = '\t') ## End(Not run)
## Not run: getSeuratRds(metadata = 'metadata.tsv', sep = '\t') ## End(Not run)
get the minimal ontology tree of a dataset by reducing descendant terms to ancestor terms return obj meta.data[["cell_ontology_base"]] storing the reduced ontology annotation
ontoMinimal(obj, ont, anno_col, onto_id_col)
ontoMinimal(obj, ont, anno_col, onto_id_col)
obj |
the seurat object |
ont |
ontologyIndex object |
anno_col |
the cell ontology text annotation column name |
onto_id_col |
if also have ontology id column for direct mapping |
an seurat object with meta.data[["cell_ontology_base"]]
## Not run: ontoMinimal(obj = seurat_obj, ont = ont, anno_col = 'ontology_name', onto_id_col = 'ontology_id') ## End(Not run)
## Not run: ontoMinimal(obj = seurat_obj, ont = ont, anno_col = 'ontology_name', onto_id_col = 'ontology_id') ## End(Not run)
Core function of scOntoMatch Match the ontology annotation of multiple seurat objects
ontoMultiMatch(obj_list, anno_col, onto_id_col, ont)
ontoMultiMatch(obj_list, anno_col, onto_id_col, ont)
obj_list |
a namesd list of seurat objects to match |
anno_col |
the cell ontology text annotation column name |
onto_id_col |
if also have ontology id column for direct mapping |
ont |
ontologyIndex object |
a list of seurat objects with annotation ontology mapped to each-other in obs[['cell_ontology_mapped']]
## Not run: ontoMultiMatch(seurat_obj_list, ont, "ontology_name", 'ontology_id') ## End(Not run)
## Not run: ontoMultiMatch(seurat_obj_list, ont, "ontology_name", 'ontology_id') ## End(Not run)
get the minimal ontology tree of a list of seurat objects by reducing descendant terms to ancestor terms return a named list of seurat objects with meta.data[["cell_ontology_base"]] storing the reduced ontology annotation
ontoMultiMinimal(obj_list, ont, anno_col = "cell_ontology_base", onto_id_col)
ontoMultiMinimal(obj_list, ont, anno_col = "cell_ontology_base", onto_id_col)
obj_list |
a named list of seurat objects |
ont |
ontologyIndex object |
anno_col |
the cell ontology text annotation column name |
onto_id_col |
if also have ontology id column for direct mapping |
a named list of seurat objects with meta.data[["cell_ontology_base"]]
## Not run: ontoMultiMinimal(seurat_obj_list, ont, "cell_ontology_base", 'ontology_id') ## End(Not run)
## Not run: ontoMultiMinimal(seurat_obj_list, ont, "cell_ontology_base", 'ontology_id') ## End(Not run)
translate named list of obj_list to named list of cell ontology ids per obj
ontoTranslate(obj_list, ont, onto_id_col, anno_col)
ontoTranslate(obj_list, ont, onto_id_col, anno_col)
obj_list |
a named list of seurat object |
ont |
ontologyIndex object |
onto_id_col |
if also have ontology id column for direct mapping |
anno_col |
the cell ontology text annotation column name |
a named list of cell ontology ids
## Not run: ontoTranslate(seurat_obj_list, ont, 'ontology_name', 'ontology_id') ## End(Not run)
## Not run: ontoTranslate(seurat_obj_list, ont, 'ontology_name', 'ontology_id') ## End(Not run)
Plot a ontology tree with matched ontology from ontoMatch
plotMatchedOntoTree( obj_list, ont, anno_col = "cell_ontology_mapped", onto_id_col, roots = c("CL:0000548"), ... )
plotMatchedOntoTree( obj_list, ont, anno_col = "cell_ontology_mapped", onto_id_col, roots = c("CL:0000548"), ... )
obj_list |
a list of seurat obj files as the output of ontoMatch |
ont |
ontology object |
anno_col |
the cell ontology text annotation column name |
onto_id_col |
if also have ontology id column for direct mapping |
roots |
root ontology in tree to plot, default "animal cells" in cell ontology |
... |
additional parameters for ontologyPlot::onto_plot |
a lit of matched ontology tree plot
## Not run: plotMatchedOntoTree(seurat_obj_list, ont, 'cell_ontology_mapped', 'ontology_id') ## End(Not run)
## Not run: plotMatchedOntoTree(seurat_obj_list, ont, 'cell_ontology_mapped', 'ontology_id') ## End(Not run)
Plot a tree representation of ontology terms
plotOntoTree( ont, onts, plot_ancestors = TRUE, ont_query = NULL, roots = c("CL:0000548"), ... )
plotOntoTree( ont, onts, plot_ancestors = TRUE, ont_query = NULL, roots = c("CL:0000548"), ... )
ont |
ontology object |
onts |
ontology ids to plot |
plot_ancestors |
if plot ancestors or not |
ont_query |
query ontology to highlight in the tree |
roots |
root ontology in tree, default "animal cells" in cell ontology |
... |
additional parameters for ontologyPlot::onto_plot |
an ontology tree plot
## Not run: plotOntoTree(ont = ont, onts = c("CL:0000066", "CL:0000082"), ont_query = c("CL:0000082")) ## End(Not run)
## Not run: plotOntoTree(ont = ont, onts = c("CL:0000066", "CL:0000082"), ont_query = c("CL:0000082")) ## End(Not run)