Skip to contents

crosswalk() will convert values found in one of the columns of an HGNC gene data set to values in another.

Usage

crosswalk(value, from, to = from, hgnc_dataset = import_hgnc_dataset())

Arguments

value

A character vector of values to be matched in the from column. These values must match once and only once in the from column values, otherwise NA is returned.

from

The name of the column in the HGNC gene data set (hgnc_dataset) where values passed in value are used as queries.

to

The name of the column whose values are to be returned, corresponding to matches in the from column.

hgnc_dataset

A data frame corresponding to a HGNC gene data set. Typically, you'd get hold of a HGNC gene data set with import_hgnc_dataset(). For testing purposes and an offline solution, you may use alternatively the function hgnc_dataset_example() providing a subset.

Examples

if (FALSE) { # \dontrun{
# Map a gene symbol to its HUGO identifier.
crosswalk(value = "A1BG", from = "symbol", to = "hgnc_id")

# If `from` and `to` refer to the same column, `crosswalk()` will filter
# out unmatched values by converting them to `NA`.
crosswalk(value = c("A1BG", "Not a gene"), from = "symbol", to = "symbol")

# This is the default behavior, so you can simply call:
crosswalk(value = c("A1BG", "Not a gene"), from = "symbol")
} # }