Rename miRNA features in a matrix or named vector
Source:R/singlesample-mirna-name-resolver.R
apply_mirna_aliases.RdConvenience wrapper around resolve_mirna_aliases that accepts
a samples × features matrix or a named numeric vector and renames the
features (column names of the matrix, or names() of the vector) to
the target namespace. Unresolved features are either dropped
(keep_unresolved = FALSE) or retained with their original name
(keep_unresolved = TRUE, default).
Usage
apply_mirna_aliases(
x,
target_namespace = c("mirna_name", "mimat"),
table = mirna_alias_table(),
keep_unresolved = TRUE,
verbose = FALSE,
...
)Arguments
- x
A samples × features
matrixwith column names, or a named numeric vector.- target_namespace
One of
"mirna_name"(default) or"mimat". Passed toresolve_mirna_aliases.- table
Alias table. Defaults to
mirna_alias_table().- keep_unresolved
Logical. If
TRUE(default), features whose names cannot be resolved are kept with their original name. IfFALSE, unresolved features are dropped from the output.- verbose
Logical. Passed to
resolve_mirna_aliases.- ...
Additional arguments passed to
resolve_mirna_aliases.
Value
An object of the same class and structure as x with feature
names mapped to the target namespace. When keep_unresolved = FALSE
and some features are unresolved, those columns / elements are removed.
References
Kozomara A., Birgaoanu M., Griffiths-Jones S. (2019) miRBase: from microRNA sequences to function. Nucleic Acids Research 47(D1): D155–D162. DOI: doi:10.1093/nar/gky1141
Examples
# Named numeric vector
v <- c(MIMAT0001631 = 12.3, MIMAT0000062 = 4.1, unknown_probe = 0.9)
apply_mirna_aliases(v)
#> hsa-miR-451a hsa-let-7a-5p unknown_probe
#> 12.3 4.1 0.9
# Matrix
M <- matrix(runif(6), nrow = 2,
dimnames = list(c("S1", "S2"),
c("MIMAT0001631", "MIMAT0000062", "junk")))
apply_mirna_aliases(M, keep_unresolved = FALSE)
#> hsa-miR-451a hsa-let-7a-5p
#> S1 0.0539110 0.02560094
#> S2 0.9550958 0.92076314