Convert genes to symbols

convertGenesToSymbols(object, ...)

convertSymbolsToGenes(object, ...)

# S4 method for character
convertGenesToSymbols(object, gene2symbol)

# S4 method for matrix
convertGenesToSymbols(object, gene2symbol)

# S4 method for sparseMatrix
convertGenesToSymbols(object, gene2symbol)

# S4 method for SummarizedExperiment
convertGenesToSymbols(object)

# S4 method for SummarizedExperiment
convertSymbolsToGenes(object)

Arguments

object

Object.

gene2symbol

Gene2Symbol. Gene-to-symbol mappings. Must contain geneID and geneName columns. See Gene2Symbol for more information.

...

Additional arguments.

Value

Modified object of same class.

Examples

data(rse, package = "acidtest") object <- rse g2s <- Gene2Symbol(object) print(g2s)
#> Gene2Symbol with 500 rows and 2 columns #> geneID geneName #> <character> <character> #> gene001 ENSG00000000003 TSPAN6 #> gene002 ENSG00000000005 TNMD #> gene003 ENSG00000000419 DPM1 #> gene004 ENSG00000000457 SCYL3 #> gene005 ENSG00000000460 C1orf112 #> ... ... ... #> gene496 ENSG00000032742 IFT88 #> gene497 ENSG00000033011 ALG1 #> gene498 ENSG00000033030 ZCCHC8 #> gene499 ENSG00000033050 ABCF2 #> gene500 ENSG00000033100 CHPF2
genes <- head(g2s[["geneID"]]) print(genes)
#> [1] "ENSG00000000003" "ENSG00000000005" "ENSG00000000419" "ENSG00000000457" #> [5] "ENSG00000000460" "ENSG00000000938"
## character ==== x <- convertGenesToSymbols(genes, gene2symbol = g2s) print(x)
#> ENSG00000000003 ENSG00000000005 ENSG00000000419 ENSG00000000457 ENSG00000000460 #> "TSPAN6" "TNMD" "DPM1" "SCYL3" "C1orf112" #> ENSG00000000938 #> "FGR"
## matrix ==== samples <- head(colnames(object)) counts <- matrix( data = seq_len(length(genes) * length(samples)), byrow = TRUE, nrow = length(genes), ncol = length(samples), dimnames = list(genes, samples) ) print(counts)
#> sample01 sample02 sample03 sample04 sample05 sample06 #> ENSG00000000003 1 2 3 4 5 6 #> ENSG00000000005 7 8 9 10 11 12 #> ENSG00000000419 13 14 15 16 17 18 #> ENSG00000000457 19 20 21 22 23 24 #> ENSG00000000460 25 26 27 28 29 30 #> ENSG00000000938 31 32 33 34 35 36
x <- convertGenesToSymbols(counts, gene2symbol = g2s) print(x)
#> sample01 sample02 sample03 sample04 sample05 sample06 #> TSPAN6 1 2 3 4 5 6 #> TNMD 7 8 9 10 11 12 #> DPM1 13 14 15 16 17 18 #> SCYL3 19 20 21 22 23 24 #> C1orf112 25 26 27 28 29 30 #> FGR 31 32 33 34 35 36
## SummarizedExperiment ==== x <- convertGenesToSymbols(rse) print(x)
#> class: RangedSummarizedExperiment #> dim: 500 12 #> metadata(3): version date interestingGroups #> assays(1): counts #> rownames(500): TSPAN6 TNMD ... ABCF2 CHPF2 #> rowData names(5): geneID geneName geneBiotype broadClass entrezID #> colnames(12): sample01 sample02 ... sample11 sample12 #> colData names(1): condition
## Interconvert back to gene IDs. y <- convertSymbolsToGenes(x) print(y)
#> class: RangedSummarizedExperiment #> dim: 500 12 #> metadata(3): version date interestingGroups #> assays(1): counts #> rownames(500): ENSG00000000003 ENSG00000000005 ... ENSG00000033050 #> ENSG00000033100 #> rowData names(5): geneID geneName geneBiotype broadClass entrezID #> colnames(12): sample01 sample02 ... sample11 sample12 #> colData names(1): condition