map_identifiers: Map identifiers to a species master namespace

View source: R/identifier-mappings.R

map_identifiersR Documentation

Map identifiers to a species master namespace

Description

Apply a mapping loaded by load_id_mappings() without network access. Mapping is deliberately explicit: callers select the input namespace and policies for ambiguous and unmapped identifiers before importing or preparing analytical objects. This public helper is also useful for mapping an identifier vector independently of an import operation.

Usage

map_identifiers(
  ids,
  mappings,
  from,
  ambiguous = c("error", "drop", "first", "expand"),
  unmapped = c("keep", "drop", "error"),
  case_sensitive = TRUE
)

Arguments

ids

Character vector of source identifiers.

mappings

A nearender_id_mappings object returned by load_id_mappings().

from

Source identifier format listed by available_id_formats().

ambiguous

Policy for source IDs with several master IDs: error, drop, keep the first sorted match, or expand to all matches.

unmapped

Policy for source IDs without a mapping: keep, drop, or error.

case_sensitive

Match source identifiers with case sensitivity.

Value

A character vector in the master namespace. With ambiguous = "expand", one input may yield several output values. A mapping_info attribute records mapping counts and policies.

See Also

prepare_id_mappings(), load_id_mappings()

Examples

example_mappings <- structure(list(
  mappings = data.frame(id_format = "ensembl_gene_id",
    source_id = c("ENSG1", "ENSG2"), master_id = c("TP53", "MDM2")),
  manifest = list(id_formats = "ensembl_gene_id")),
  class = "nearender_id_mappings")
map_identifiers(c("ENSG1", "ENSG2"), example_mappings,
  from = "ensembl_gene_id")

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.