Skip to contents

Convert one HGNC identifier to another

Usage

hgnc_convert(
  x,
  from = "hgnc_id",
  to = "symbol",
  one_to_many = FALSE,
  file = get_hgnc_file()
)

Arguments

x

A vector of values to convert from

from

The HGNC identifier to convert from, must be a column name in the HGNC dataset.

to

The HGNC identifier to convert to, must be a column name in the HGNC dataset.

one_to_many

A boolean value indicating whether cases where the 'from' identifier maps to multiple 'to' values should be returned. If set to FALSE (the default), such one-to-many cases will yield NA. If set to TRUE, the returned value will be a list of vectors of varying length.

file

A file or URL of the complete HGNC data set (in TSV format), as used by import_hgnc_dataset().

Value

A list or vector of converted values

Examples

if (FALSE) {
# convert a set of hgnc_ids to symbols
hgnc_ids <- c("HGNC:44948", "HGNC:43240", "HGNC:23357", "HGNC:1855", "HGNC:39400")
hgnc_convert(hgnc_ids, from = 'hgnc_id', to = 'symbol')
# convert a set of entrez_ids to ensembl_gene_ids
entrez_ids <- c(79933, 109623458, 158471, 54987, 81631)
hgnc_convert(entrez_ids, from = 'entrez_id', to = 'ensembl_gene_id')
}