addGeneNames: addGeneNames

Description Usage Arguments Details Value See Also Examples

View source: R/genes.R

Description

Adds the gene names (defaults to symbols) to a GenesData object to be used by kpPlotGenes

Usage

1
addGeneNames(genes.data, orgDb="auto", keys=NULL, keytype="ENTREZID", names="SYMBOL")

Arguments

genes.data

(GenesData object) A valid genes.dat object like the ones obtained by makeGenesDataFromTxDb

orgDb

The orgDb object to use to extract the gene symbols. If "auto" the function will try to determine automatically the correct organism. See available obects at https://bioconductor.org/packages/release/BiocViews.html#___OrgDb (defaults to "auto")

keys

(character vector ) The keys to be used in the internal select statement to get the names. If NULL, the first column of mcols(GenesData$genes) will be used. (defaults to NULL)

keytype

(character) The keytype used in the internal select statement. (defaults to "ENTREZID", that is, gene_id)

names

The column to extract from orgDb to use as gene names. (deafults to "SYMBOL")

Details

This function takes a valid data object and uses an OrgDb object to find the gene names (symbols by default) and add them. Names are added as a column named names to the genes element of GenesData and they replace anything that was present there before. If no ObjDb object is given, the function will try to identify the correct organism using the data in GenesData$metadata and select the OrgDb object if available. If it cannot identify the organism or there's no valid OrgDb for that organism it will fail with an error. Internally, the function uses a call to AnnotationDbi::select on the OrgDb. It is possible to specify the keys and keytypes as well as the column we want to use as names (defaults to SYMBOL for gene symbols).

Value

The original GenesData object with one additional column named "names" in GenesData$genes$names.

See Also

kpPlotGenes, makeGenesDataFromTxDb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 

library(TxDb.Hsapiens.UCSC.hg19.knownGene)

zoom <- toGRanges("chr17:29e6-30e6")
kp <- plotKaryotype(genome="hg19", zoom=zoom)
genes.data <- makeGenesDataFromTxDb(TxDb.Hsapiens.UCSC.hg19.knownGene, 
                 karyoplot=kp, plot.transcripts=FALSE,
                 plot.transcripts.structure=FALSE)
genes.data <- addGeneNames(genes.data)
kpPlotGenes(kp, data=genes.data, r1=0.5, plot.transcripts=FALSE,
            gene.name.position = "left")
 
  

karyoploteR documentation built on Nov. 8, 2020, 5:52 p.m.