R/miscFunctions.R
setRowNames.Rd
Users can set rownames of an SCE object with either a character
vector where the length equals to nrow(x)
, or a single character
specifying a column in rowData(x)
. Also applicable to matrix like
object where rownames<-
method works, but only allows full size name
vector. Users can set dedup = TRUE
to remove duplicated entries in the
specification, by adding -1, -2, ..., -i
suffix to the duplication of
the same identifier.
setRowNames(x, rowNames, dedup = TRUE)
Input object where the rownames will be modified.
Character vector of the rownames. If x
is an
SingleCellExperiment object, a single character specifying a
column in rowData(x)
.
Logical. Whether to deduplicate the specified rowNames. Default
TRUE
The input SCE object with rownames updated.
data("scExample", package = "singleCellTK")
head(rownames(sce))
#> [1] "ENSG00000251562" "ENSG00000205542" "ENSG00000177954" "ENSG00000166710"
#> [5] "ENSG00000156508" "ENSG00000147403"
sce <- setRowNames(sce, "feature_name")
head(rownames(sce))
#> [1] "MALAT1" "TMSB4X" "RPS27" "B2M" "EEF1A1" "RPL10"