map_ontology_code {mskcc.oncotree} | R Documentation |
Map tumor types across ontologies
Description
This function maps codes (identifiers) across tumor classification systems.
Use the arguments from
and to
to choose the source and target ontologies.
Available options are: 'oncotree_code'
, 'nci_code'
, 'umls_code'
,
'icdo_topography_code'
, 'icdo_morphology_code'
, and 'hemeonc_code'
.
Note that you can also use the functions oncotree_to_nci()
,
nci_to_oncotree()
, oncotree_to_umls()
and umls_to_oncotree()
to map
between OncoTree and NCIt systems. The difference is that these functions use
the OncoTree API, and the output can be made to depend on older versions of
OncoTree. map_ontology_code()
relies on a static file provided by the
OncoTree team that is not as up to date as the data provided by the web API.
Nevetheless, the scope of the mappings provided by map_ontology_code()
is
broader. The file used by map_ontology_code()
can be directly imported into
R using the function read_ontology_mappings()
.
Usage
map_ontology_code(code, from, to, collapse = NULL)
Arguments
code |
A character vector with identifier codes of the |
from |
The source ontology. One of: |
to |
The target ontology. One of: |
collapse |
A function that expects one argument, it will be the character vector of codes in the |
Value
A tibble of two variables: first column is
corresponds to the from
variable and the second is the to
variable.
Source
The mappings here provided are based on the file https://github.com/cBioPortal/oncotree/blob/master/scripts/ontology_to_ontology_mapping_tool/ontology_mappings.txt.
See Also
oncotree_to_nci()
, nci_to_oncotree()
, oncotree_to_umls()
and umls_to_oncotree()
.
Examples
## Not run:
# Omit the `code` argument to get all possible mappings. Note that
# one-to-many mappings will generate more than one row per `from` code.
map_ontology_code(from = 'oncotree_code', to = 'nci_code')
# Simple example
map_ontology_code('MMB', from = 'oncotree_code', to = 'nci_code')
# Some mappings are one-to-many, e.g. "SRCCR", which means repeated rows for
# the same input code.
map_ontology_code('SRCCR', from = 'oncotree_code', to = 'nci_code')
# Using the `collapse` argument to "collapse" one-to-many mappings makes sure
# that the output has as many rows as the `from` vector.
map_ontology_code('SRCCR',
from = 'oncotree_code',
to = 'nci_code',
collapse = toString)
map_ontology_code('SRCCR',
from = 'oncotree_code',
to = 'nci_code',
collapse = list)
map_ontology_code(
'SRCCR',
from = 'oncotree_code',
to = 'nci_code',
collapse = \(x) paste(x, collapse = ' ')
)
# `map_ontology_code()` is vectorized over `code`
map_ontology_code(
c('AASTR', 'MDEP'),
from = 'oncotree_code',
to = 'nci_code'
)
# Map from ICDO topography to ICDO morphology codes
map_ontology_code(
'C72.9',
from = 'icdo_topography_code',
to = 'icdo_morphology_code'
)
## End(Not run)