convertGeneIdentifiers {cTRAP} | R Documentation

## Convert gene identifiers

### Description

Convert gene identifiers

### Usage

    convertGeneIdentifiers(
      genes,
      annotation = "Homo sapiens",
      key = "ENSEMBL",
      target = "SYMBOL",
      ignoreDuplicatedTargets = TRUE
    )

### Arguments

`genes` | Character: genes to be converted
`annotation` | `OrgDb` with genome wide annotation for an organism or `character` with species name to query `OrgDb`, e.g. `"Homo sapiens"`
`key` | Character: type of identifier used, e.g. `ENSEMBL`; read `?AnnotationDbi::columns`
`target` | Character: type of identifier to convert to; read `?AnnotationDbi::columns`
`ignoreDuplicatedTargets` | Boolean: if `TRUE`, identifiers that share targets with other identifiers will not be converted

### Value

Character vector of the respective targets of gene identifiers. The previous identifiers remain other identifiers have the same target (in case `ignoreDuplicatedTargets = TRUE`) or if no target was found.

### Examples

    genes <- c("ENSG00000012048", "ENSG00000083093", "ENSG00000141510",
               "ENSG00000051180")
    convertGeneIdentifiers(genes)
    convertGeneIdentifiers(genes, key="ENSEMBL", target="UNIPROT")

    # Explicit species name to automatically look for its OrgDb database
    sp <- "Homo sapiens"
    genes <- c("ENSG00000012048", "ENSG00000083093", "ENSG00000141510",
               "ENSG00000051180")
    convertGeneIdentifiers(genes, sp)

    # Alternatively, set the annotation database directly
    ah <- AnnotationHub::AnnotationHub()
    sp <- AnnotationHub::query(ah, c("OrgDb", "Homo sapiens"))[[1]]
    columns(sp) # these attributes can be used to change the attributes

    convertGeneIdentifiers(genes, sp)

[Package cTRAP version 1.12.0 Index]