rename_rows: Smartly/easily rename the rows of an object.

Description Usage Arguments Details Examples

View source: R/rename_rows.R

Description

The most common usecase for this is when you have a SummarizedExperiment, DGEList, matrix, etc. that is "rownamed" by some gene idnetifiers (ensembl, entrez, etc) that you want to "easily" convert to be rownamed by symbols. And perhaps the most common use-case for this, again, would be able to easily change rownames of a heatmap to symbols.

Usage

1
rename_rows(x, xref, ...)

Arguments

x

an object to whose rows need renaming

xref

an object to help with the renaming.

  • A character vector where length(xref) == nrow(x). Every row in x should correspond to the renamed value in the same position in xref

  • If x is a DGEList, SummarizedExperiment, etc. this can be a string. In this case, the string must name a column in the data container's fData-like data.frame. The values in that column will be the new candidate rownames for the object.

  • A two column data.frame. The first column has entries in rownames(x), and the second column is the value to rename it to.

rename.duplicates

The policy used to deal with duplicates in the renamed values. If Multiple elements in the source can be renamed to the same elements in the target (think of microarray probes to gene symbols), what to do? By deafult ("original"), one of the original elements will be renamed to the new name, and the rest will keep their original (unique) names. When set to "make.unique", the new name will be kept, but *.1, *.2, etc. will be appended to all but the first multimapper.

Details

The rownames that can't successfully remapped will keep their old names. This function should also guarantee that the rows of the incoming matrix are the same as the outgoing one.

Examples

1
2
3
4
5
eset <- exampleExpressionSet(do.voom = FALSE)
ess <- rename_rows(eset, "symbol")

vm <- exampleExpressionSet(do.voom = TRUE)
vms <- rename_rows(vm, "symbol")

lianos/multiGSEA documentation built on Nov. 17, 2020, 1:26 p.m.