Convert row names to metadata identifiers
Examples
expression <- matrix(1:12, nrow = 3,
dimnames = list(c("ENSG1", "ENSG2", "ENSG3"), paste0("s", 1:4)))
coldata <- data.frame(
condition = rep(c("treated", "control"), each = 2),
row.names = paste0("s", 1:4)
)
annotation <- data.frame(
gene_id = c("ENSG1", "ENSG2", "ENSG3"),
gene_name = c("GeneA", "GeneB", "GeneC"),
row.names = c("ENSG1", "ENSG2", "ENSG3")
)
ese <- ExploratorySummarizedExperiment(
assays = list(expression = expression),
colData = coldata,
annotation = annotation,
idfield = "gene_id",
labelfield = "gene_name"
)
convert_ids(c("ENSG1", "ENSG2"), ese, "gene_name")
#> [1] "GeneA" "GeneB"
