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:
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?
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.
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.
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)
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 ?
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.
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.
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’"
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)
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’
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.