AnnotateFeatures Annotate features in a Seurat object with additional metadata from databases or a GTF file.
Source:R/SCP-feature_annotation.R
      AnnotateFeatures.RdAnnotateFeatures Annotate features in a Seurat object with additional metadata from databases or a GTF file.
Usage
AnnotateFeatures(
  srt,
  species = "Homo_sapiens",
  IDtype = c("symbol", "ensembl_id", "entrez_id"),
  db = NULL,
  db_update = FALSE,
  db_version = "latest",
  convert_species = TRUE,
  Ensembl_version = 103,
  mirror = NULL,
  gtf = NULL,
  merge_gtf_by = "gene_name",
  columns = c("seqname", "feature", "start", "end", "strand", "gene_id", "gene_name",
    "gene_type"),
  assays = "RNA",
  overwrite = FALSE
)Arguments
- srt
- Seurat object to be annotated. 
- species
- Name of the species to be used for annotation. Default is "Homo_sapiens". 
- IDtype
- Type of identifier to use for annotation. Default is "symbol" with options "symbol", "ensembl_id", and "entrez_id". 
- db
- Vector of database names to be used for annotation. Default is NULL. 
- db_update
- Logical value indicating whether to update the database. Default is FALSE. 
- db_version
- Version of the database to use. Default is "latest". 
- convert_species
- A logical value indicating whether to use a species-converted database when the annotation is missing for the specified species. The default value is TRUE. 
- Ensembl_version
- Version of the Ensembl database to use. Default is 103. 
- mirror
- URL of the mirror to use for Ensembl database. Default is NULL. 
- gtf
- Path to the GTF file to be used for annotation. Default is NULL. 
- merge_gtf_by
- Column name to merge the GTF file by. Default is "gene_name". 
- columns
- Vector of column names to be used from the GTF file. Default is "seqname", "feature", "start", "end", "strand", "gene_id", "gene_name", "gene_type". 
- assays
- Character vector of assay names to be annotated. Default is "RNA". 
- overwrite
- Logical value indicating whether to overwrite existing metadata. Default is FALSE. 
Examples
data("pancreas_sub")
pancreas_sub <- AnnotateFeatures(pancreas_sub,
  species = "Mus_musculus", IDtype = "symbol",
  db = c("Chromosome", "GeneType", "Enzyme", "TF", "CSPA", "VerSeDa")
)
#> Species: Mus_musculus
#> Warning: Annotation package org.Mm.eg.db does not exist.
#> Warning: Use the human annotation to create the Chromosome,GeneType,Enzyme database for Mus_musculus
#> Preparing database: Chromosome
#> Preparing database: GeneType
#> Preparing database: Enzyme
#> Error in download(url = "https://ftp.expasy.org/databases/enzyme/enzclass.txt",     destfile = temp): could not find function "download"
head(FetchData(pancreas_sub, vars = NULL, layer = "meta.features"))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': could not find function "FetchData"
## Annotate features using a GTF file
# pancreas_sub <- AnnotateFeatures(pancreas_sub, gtf = "/data/reference/CellRanger/refdata-gex-mm10-2020-A/genes/genes.gtf")
# head(FetchData(pancreas_sub, vars = NULL, layer = "meta.features"))