Skip to contents

This function translates the values in a column using a provided Human Metabolome Database (HMDB) mapper vector. It modifies the input values by replacing certain prefixes and suffixes according to specific rules.

Usage

translate_column_HMDB(my_column, HMDB_mapper_vec)

Arguments

my_column

A vector of values to be translated.

HMDB_mapper_vec

A named vector where the names are the original identifiers and the values are the corresponding HMDB identifiers.

Value

A vector with the translated values.

Examples

# Create a sample column and HMDB mapper vector
my_column <- c("Metab__1234_a", "Gene5678_b", "Metab__91011_c")
HMDB_mapper_vec <- c("1234" = "HMDB00001", "5678" = "HMDB00002", "91011" = "HMDB00003")

# Translate the column
translated_column <- translate_column_HMDB(my_column, HMDB_mapper_vec)