Search
Question: How to display gene symbols in UCSC Track in Gviz
0
gravatar for Greg G.
6 months ago by
Greg G.0
USA/Seattle
Greg G.0 wrote:

Hello everyone,

I am trying to get Gviz::UcscTrack to display HGNC symbols, or at least the default name from the gene() function. The piece of code I am using is pasted below. Any help is highly appreciated.

 

ucscGenes <- UcscTrack(genome="hg38", table="ncbiRefSeq", track = 'NCBI RefSeq', trackType="GeneRegionTrack", 
                                   chromosome="chr19", rstarts = "exonStarts", rends = "exonEnds", 
                                   gene = "name", symbol = 'name', transcript = "name", 
                                   strand = "strand", stacking = 'pack', showID = T, geneSymbol = T)

 

Thank you

 

ADD COMMENTlink modified 6 months ago by James W. MacDonald45k • written 6 months ago by Greg G.0
1
gravatar for James W. MacDonald
6 months ago by
United States
James W. MacDonald45k wrote:

The UCSC tables in general don't have the HUGO symbols, so you end up having to add those yourself. But it's really easy to do.

> ucscGenes <- UcscTrack(genome="hg38", table="ncbiRefSeq", track = 'NCBI RefSeq', trackType="GeneRegionTrack",
                                   chromosome="chr19", rstarts = "exonStarts", rends = "exonEnds",
                                   gene = "name", symbol = 'name', transcript = "name",
                                   strand = "strand", stacking = 'pack', showID = T, geneSymbol = T)

> z <- ranges(ucscGenes)

> library(org.Hs.eg.db)

> mcols(z)$symbol <- mapIds(org.Hs.eg.db, gsub("\\.[1-9]$", "", mcols(z)$symbol), "SYMBOL","REFSEQ")
> ucscGenes2 <- ucscGenes
> ranges(ucscGenes2) <- z

> plotTracks(list(ucscGenes, ucscGenes2), chromosome = "chr19", from = 1e6, to = 1.4e6, transcriptAnnotation = "symbol")
ADD COMMENTlink written 6 months ago by James W. MacDonald45k

Fantastic! It worked like a charm. I suppose with the mapping method I can assign any form of nomenclature to the genes. Right?

Thanks,
Greg

ADD REPLYlink written 6 months ago by Greg G.0

I don't know what you mean by 'with the mapping method I can assign any form of nomenclature to the genes'. Can you clarify?

ADD REPLYlink written 6 months ago by James W. MacDonald45k

It's OK. I meant the mapIds() function. Thanks again.

ADD REPLYlink written 6 months ago by Greg G.0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 188 users visited in the last hour