Question: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Dear all,

would appreciate the help with an answer to the question (probably it was asked before) :

how could I display the GENE NAME SYMBOLS in Gviz ? The code I use is :

gen <- "hg19"
chr <- "chr21"
start <- 45000000
end <- 46000000

 

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb_hg19 <- TxDb.Hsapiens.UCSC.hg19.knownGene
txTranscripts_v1 <- GeneRegionTrack(txdb_hg19, genome="hg19", chromosome="chr21", showId=TRUE, geneSymbol=TRUE, name="UCSC")

plotTracks(txTranscripts_v1, from=start, to=end)

 

 

gviz • 2.7k views
ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by Bogdan530
Answer: gene symbols in Gviz
3
gravatar for florian.hahne@novartis.com
3.5 years ago by
Switzerland

Hi Bogdan,

the main issue here is really that TXDb objects do not store gene symbols. James' suggested solution is not too bad. You could use the official symbol<- replacement method to swap out the stored values, which makes it look a bit nicer:

symbols <- unlist(mapIds(org.Hs.eg.db, gene(txTranscripts_v1), "SYMBOL", "ENTREZID", multiVals = "first"))
symbol(txTranscripts_v1) <- symbols[gene(txTranscripts_v1)]

I guess that a more formal link between TXDb objects and additional annotation data would help here. Back in the days when I implemented that constructor there was no way to get symbols from TXDb objects. Maybe there is one now that I am not aware of?

Florian

ADD COMMENTlink written 3.5 years ago by florian.hahne@novartis.com1.6k
1

If you were to use the Homo.sapiens (or Mus.musculus) packages, there is a formal interface that allows you to do a select() call using a TXNAME and return a SYMBOL.

> keytypes(Homo.sapiens)
 [1] "GOID"         "TERM"         "ONTOLOGY"     "DEFINITION"   "ENTREZID"    
 [6] "PFAM"         "IPI"          "PROSITE"      "ACCNUM"       "ALIAS"       
[11] "ENZYME"       "MAP"          "PATH"         "PMID"         "REFSEQ"      
[16] "SYMBOL"       "UNIGENE"      "ENSEMBL"      "ENSEMBLPROT"  "ENSEMBLTRANS"
[21] "GENENAME"     "UNIPROT"      "GO"           "EVIDENCE"     "GOALL"       
[26] "EVIDENCEALL"  "ONTOLOGYALL"  "OMIM"         "UCSCKG"       "GENEID"      
[31] "TXID"         "TXNAME"       "EXONID"       "EXONNAME"     "CDSID"       
[36] "CDSNAME"     
> columns(Homo.sapiens)
 [1] "GOID"         "TERM"         "ONTOLOGY"     "DEFINITION"   "ENTREZID"    
 [6] "PFAM"         "IPI"          "PROSITE"      "ACCNUM"       "ALIAS"       
[11] "CHR"          "CHRLOC"       "CHRLOCEND"    "ENZYME"       "MAP"         
[16] "PATH"         "PMID"         "REFSEQ"       "SYMBOL"       "UNIGENE"     
[21] "ENSEMBL"      "ENSEMBLPROT"  "ENSEMBLTRANS" "GENENAME"     "UNIPROT"     
[26] "GO"           "EVIDENCE"     "GOALL"        "EVIDENCEALL"  "ONTOLOGYALL"
[31] "OMIM"         "UCSCKG"       "CDSID"        "CDSNAME"      "CDSCHROM"    
[36] "CDSSTRAND"    "CDSSTART"     "CDSEND"       "EXONID"       "EXONNAME"    
[41] "EXONCHROM"    "EXONSTRAND"   "EXONSTART"    "EXONEND"      "GENEID"      
[46] "TXID"         "EXONRANK"     "TXNAME"       "TXTYPE"       "TXCHROM"     
[51] "TXSTRAND"     "TXSTART"      "TXEND"       

 

ADD REPLYlink written 3.5 years ago by James W. MacDonald49k
Answer: gene symbols in Gviz
1
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

HI Martin, thanks again ! I know that this is a little trivia, so .. my apologies, but hmmm ... with R3.2.1 , the BioC does not update to the version 3.1 (at least not on my PC). will try again after restarting and removing some files.

 

> source("http://bioconductor.org/biocLite.R")
Bioconductor version 3.0 (BiocInstaller 1.16.5), ?biocLite for help
BiocInstaller version 3.0 is too old for R version 3.2.1;
  remove.packages("BiocInstaller") then
  source("http://bioconductor.org/biocLite.R")
A new version of Bioconductor is available after installing the most recent
  version of R; see http://bioconductor.org/install
> biocLite()                  ## R version 3.0 or later
BioC_mirror: http://bioconductor.org
Using Bioconductor version 3.0 (BiocInstaller 1.16.5), R version 3.2.1.

 

 

 

ADD COMMENTlink written 3.5 years ago by Bogdan530

Follow the instructions in the message after 'source':

BiocInstaller version 3.0 is too old for R version 3.2.1;
  remove.packages("BiocInstaller") then
  source("http://bioconductor.org/biocLite.R")
ADD REPLYlink written 3.5 years ago by Martin Morgan ♦♦ 22k
Answer: gene symbols in Gviz
0
gravatar for James W. MacDonald
3.5 years ago by
United States
James W. MacDonald49k wrote:

If there is a 'regular' way to do this, Florian will be along with the correct method. But do note that you can extract the range() data from your GeneRegionTrack, change the symbols and stuff it back in:

library(org.Hs.eg.db)
z <- mapIds(org.Hs.eg.db, gene(txTranscripts_v1), "SYMBOL", "ENTREZID", multiVals = "first")
zz <- sapply(z, is.null)
z[zz] <- gene(txTranscripts_v1)[zz]
gr <- ranges(txTranscripts_v1)
mcols(gr)$symbol <- z
txTranscripts_v1@range <- gr  ## this right here is cheating - don't do this at home!
plotTracks(txTranscripts_v1, from=start, to=end)

 

ADD COMMENTlink written 3.5 years ago by James W. MacDonald49k
Answer: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Dear James,

thank you for your help and reply. There is a little issue though : for some reason, my BioC platform, mapIds function can not be found (Bioconductor version 3.0 (BiocInstaller 1.16.5), R version 3.1.2). Shall I install any additional package ?

thank you very much again,

 

-- bogdan

 

 

ADD COMMENTlink written 3.5 years ago by Bogdan530

Unless you have a compelling reason not to, you should always use the current version of BioC, which as of this writing is 3.1, using R-3.2.1. As is usually the case, if you cannot find some function that I (or others) point out, it's because you are living in the past.
 

ADD REPLYlink written 3.5 years ago by James W. MacDonald49k
Answer: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Thank you gentlemen for precious help ! very much appreciate it !

Florian, if I may, I will get back to you soon with on old question regarding the use of DataTrack vs AnnotationTrack for a set of ~100 000 ChIP-seq peaks. Thanks again.

 

ADD COMMENTlink written 3.5 years ago by Bogdan530
Answer: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Thanks James, for your kind help. I have updated the R and BioC on my linux machine, and hmmm ... when I install a series of packages, like ggplot, Gviz, etc, I am getting a frustrating error (below); Possibly there is a quick fix ? thanks ;)

 

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
  there is no package called ‘stringi’
Error: package or namespace load failed for ‘ggplot2’

"Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
  there is no package called ‘stringi’
Error: package or namespace load failed for ‘Gviz’"

 

ADD COMMENTlink written 3.5 years ago by Bogdan530

maybe you have an .RData or other R startup file that loads stringi, either directly or indirectly? Try starting R from a command-line prompt with

R --vanilla

The output of sessionInfo() might help, too.

ADD REPLYlink written 3.5 years ago by Martin Morgan ♦♦ 22k
Answer: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Thanks Martin ! Oh well, the message I am getting is "package ‘Gviz’ is not available (for R version 3.2.1)" :

> install.packages("Gviz",dependencies=TRUE)
Installing package into ‘/home/bogdan/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
Warning message:
package ‘Gviz’ is not available (for R version 3.2.1)

Regrading the sessionInfo (), the output is :

 

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.1 tcltk_3.2.1

 

 

ADD COMMENTlink written 3.5 years ago by Bogdan530

You should be following the standard directions for installing Bioconductor (and other!) packages, e.g., on the Gviz home page.

source("http://bioconductor.org/biocLite.R")
biocLite("Gviz")

!!!! Afterward, make sure that your installation is valid with

BiocInstaller::biocValid()

Maybe update any 'out-of-date' packages with biocLite().

ADD REPLYlink modified 3.5 years ago • written 3.5 years ago by Martin Morgan ♦♦ 22k
Answer: gene symbols in Gviz
0
gravatar for Bogdan
3.5 years ago by
Bogdan530
Palo Alto, CA, USA
Bogdan530 wrote:

Thanks, Martin ! oh, well, guess that something is not correct on my system :

 

> remove.packages("BiocInstaller")
Removing package from ‘/home/bogdan/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
Error in find.package(pkgs, lib) :
  there is no package called ‘BiocInstaller’

 

ADD COMMENTlink written 3.5 years ago by Bogdan530
source("http://bioconductor.org/biocLite.R")

should install BiocInstaller for you. No need to uninstall anything. 

ADD REPLYlink written 3.5 years ago by florian.hahne@novartis.com1.6k
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 16.09
Traffic: 359 users visited in the last hour