mapping_element {BiocSet} | R Documentation

## Functions for mapping elements in the element tibble to different id types

### Description

Functions for dealing with unique mapping and multiple mapping. `map_add_element` will add the mapping as a new column instead of overwriting the current one used for the mapping.

### Usage

    map_unique(es, org, from, to)

    map_multiple(
      es,
      org,
      from,
      to,
      multi = c("list", "filter", "asNA", "CharacterList")
    )

    map_add_element(es, org, from, add)

### Arguments

`es` | The BiocSet objec to map the elements on.
`org` | The AnnotationDbi object to identify keys/mappings from.
`from` | A character to indicate which identifier to map from.
`to` | A character to indicate which identifier to map to.
`multi` | How should multiple values be returned? Options include: list: This will just return a list object to the end user. filter: This will remove all elements that contain multiple matches and will therefore return a shorter vector than what came in whenever some of the keys match more than one value. asNA: This will return an NA value whenever there are multiple matches. CharacterList: This just returns a SimpleCharacterList object. FUN: A function can be supplied to the 'multiVals' argument for custom behaviors.
`add` | The id to add to the `BiocSet` object.

### Value

For `map_unique`, a `BiocSet` object with unique elements.

For `map_multiple`, a `BiocSet` object with multiple mappings for certain elements.

For `map_add_element`, a `BiocSet` object with a new column in the element tibble with the mapping of the new id type.

### Examples

    library(org.Hs.eg.db)
    es <- BiocSet(set1 = c("C5", "GANC"), set2 = c("AFM", "CGB1", "ADAM32"))
    map_unique(es, org.Hs.eg.db, "SYMBOL", "ENTREZID")

    map_multiple(es, org.Hs.eg.db, "SYMBOL", "ENSEMBLTRANS", "asNA")

    map <- map_add_element(es, org.Hs.eg.db, "SYMBOL", "ENTREZID")
    es %>% mutate_element(entrez = map)

[Package BiocSet version 1.1.2 Index]