SummarizedExperiment
ObjectsR/HermesData-methods.R
, R/dplyr_compatibility.R
rename.Rd
This method renames columns of the rowData
and colData
, as well as assays, of
SummarizedExperiment::SummarizedExperiment
objects. This increases the flexibility
since renaming can be done before conversion to a HermesData
object.
(SummarizedExperiment
)
object to rename contents in.
(named character
)
mapping from existing (right-hand side values)
to new (left-hand side names) column names of rowData
.
(named character
)
mapping from existing (right-hand side values)
to new (left-hand side names) column names of colData
.
(named character
)
mapping from existing (right-hand side values)
to new (left-hand side names) assay names.
additional arguments (not used here).
The SummarizedExperiment::SummarizedExperiment
object with renamed contents.
x <- summarized_experiment
# Rename `HGNC` to `symbol` in the `rowData`.
x <- rename(x, row_data = c(symbol = "HGNC"))
head(names(rowData(x)))
#> [1] "symbol" "HGNCGeneName" "GeneID" "Chromosome" "StartBP"
#> [6] "EndBP"
# Rename `LowDepthFlag` to `low_depth_flag` in `colData`.
x <- rename(x, col_data = c(low_depth_flag = "LowDepthFlag"))
tail(names(colData(x)))
#> [1] "ALIVDT" "COHORT" "TTYPE"
#> [4] "STDSSDY" "low_depth_flag" "TechnicalFailureFlag"
# Rename assay `counts` to `count`.
x <- rename(x, assays = c(count = "counts"))
assayNames(x)
#> [1] "count"