Gviz question
0
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.6 years ago
Switzerland
Hi Alex, The missing rtracklayer import should be fixed now, please install the latest Gviz version (0.99.2). Thanks for the hint. In the devel branch the other packages and their name spaces are a bit of a moving target and it is sometimes hard to keep up with changes... For showing multiple chromosomes in one plot you would have to make use of the 'add' argument of the plotTracks function, and create the necessary trellis yourself. You'd have to use grid's viewport functionality, though. Base graphics layout or mfcol/mfrow will not work here. Here is a little dummy example: chroms <- c("chr1", "chr2", "chr3", "chr4") maTrack <- AnnotationTrack(range=GRanges(seqnames=chroms, ranges=IRanges(start=1, width=c(100,400,200,1000)), strand=c("+", "+", "-", "+")), genome="mm9", chromosome="chr1", name="foo") mdTrack <- DataTrack(range=GRanges(seqnames=rep(chroms, c(10, 40, 20, 100)), ranges=IRanges(start=c(seq(1,100,len=10), seq(1,400,len=40), seq(1, 200, len=20), seq(1,1000, len=100)), width=9), values=runif(170)), data="values", chromosome="chr1", genome="mm9", name="bar") mgTrack <- GenomeAxisTrack() midTrack <- IdeogramTrack(genome="mm9", chromosome="chr1") ncols <- 2 nrows <- length(chroms)%/%ncols grid.newpage() pushViewport(viewport(layout=grid.layout(nrows, ncols))) for(i in seq_along(chroms)){ pushViewport(viewport(layout.pos.col=((i-1)%%ncols)+1, layout.pos.row=(((i)-1)%/%ncols)+1)) plotTracks(list(midTrack, mgTrack, maTrack, mdTrack), chromosome=chroms[i], add=TRUE) popViewport(1) } I added a section to the vignette explaining how to do this. It may become useful at some point to add a high-level function that does all of this automatically, but at this stage I think it is best to keep the package as flexible as possible. Florian Florian Hahne Novartis Institute For Biomedical Research Translational Sciences / Preclinical Safety / PCS Informatics Expert Data Integration and Modeling Bioinformatics CHBS, WKL-135.2.26 Novartis Institute For Biomedical Research, Werk Klybeck Klybeckstrasse 141 CH-4057 Basel Switzerland Phone: +41 61 6967127 Email : florian.hahne at novartis.com On 3/6/12 4:56 AM, "Alexandre Kuhn" <alexandre.m.kuhn at="" gmail.com=""> wrote: >Hello Florian, > >thank you for providing Gviz, a geat visualization tool that seems to >nicely integrate with existing R objects (GenomicRanges, etc). > >I had to load rtracklayer separately for the ideogramTrack function to >work. Is that expected? (see copy of my session below) > >Also, since a single chromosomes provides the genomic coordinates for >all tracks in a plot, how could I use Gviz to display all chromosomes >in a single plot (along with their respective AnnotationTrack for >instance)? > >Best regards, >Alex > >-- >R version 2.15.0 alpha (2012-03-03 r58572) >Copyright (C) 2012 The R Foundation for Statistical Computing >ISBN 3-900051-07-0 >Platform: x86_64-unknown-linux-gnu (64-bit) > >R is free software and comes with ABSOLUTELY NO WARRANTY. >You are welcome to redistribute it under certain conditions. >Type 'license()' or 'licence()' for distribution details. > > Natural language support but running in an English locale > >R is a collaborative project with many contributors. >Type 'contributors()' for more information and >'citation()' on how to cite R or R packages in publications. > >Type 'demo()' for some demos, 'help()' for on-line help, or >'help.start()' for an HTML browser interface to help. >Type 'q()' to quit R. > >> library("Gviz") >Loading required package: grid >> itrack <- IdeogramTrack(genome="hg19",chromosome="chr1") >Error in eval(expr, envir, enclos) : > could not find function "ucscGenomes" >> library("rtracklayer") >Loading required package: GenomicRanges >Loading required package: BiocGenerics > >Attaching package: ?BiocGenerics? > >The following object(s) are masked from ?package:stats?: > > xtabs > >The following object(s) are masked from ?package:base?: > > anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find, > intersect, lapply, Map, mapply, order, paste, pmax, pmax.int, pmin, > pmin.int, Position, rbind, Reduce, rep.int, rownames, sapply, > setdiff, table, tapply, union, unique > >Loading required package: IRanges >> itrack <- IdeogramTrack(genome="hg19",chromosome="chr1") >> sessionInfo() >R version 2.15.0 alpha (2012-03-03 r58572) >Platform: x86_64-unknown-linux-gnu (64-bit) > >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=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C >[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > >attached base packages: >[1] grid stats graphics grDevices utils datasets methods >[8] base > >other attached packages: >[1] rtracklayer_1.15.7 GenomicRanges_1.7.30 IRanges_1.13.28 >[4] BiocGenerics_0.1.11 Gviz_0.99.0 > >loaded via a namespace (and not attached): > [1] AnnotationDbi_1.17.23 Biobase_2.15.4 biomaRt_2.11.1 > [4] Biostrings_2.23.6 bitops_1.0-4.1 BSgenome_1.23.4 > [7] DBI_0.2-5 lattice_0.20-0 RColorBrewer_1.0-5 >[10] RCurl_1.91-1 Rsamtools_1.7.37 RSQLite_0.11.1 >[13] stats4_2.15.0 tools_2.15.0 XML_3.9-4 >[16] zlibbioc_1.1.1 >--
Visualization rtracklayer Gviz Visualization rtracklayer Gviz • 1.9k views
ADD COMMENT

Login before adding your answer.

Traffic: 897 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6