The editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: Gviz: Multiple BiomartGeneRegionTrack one object for Composite plots
gravatar for stephen.williams
8 months ago by
stephen.williams10 wrote:

I'm trying to make a Composite plot of multiple gene regions. I've read the vignette, Chapter 6 on doing this. I'm able to plot my data but not the GeneRegionTrack using.

chroms <- c("chr2", "chr17")             
ncols <- 1
nrows <- length(chroms)%/%ncols

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(mdTrack),chromosome = chroms[i], type= "histogram", showId = TRUE, stacking = "dense", lty.grid="dashed", add = TRUE)

Is there a way to have multiple genes regions stored in in a single object? Right now I'm using the BiomartGeneRegionTrack to pull my gene region data

geneTrack <-BiomartGeneRegionTrack(genome = "hg38",
              symbol = c("DNMT3A","RAI1"),
              cex = 2,
              fontsize = 15,
              stacking = "squish",
              name = "Ensembl Genes v92",
              background.title = "grey",
              biomart=biomaRt::useMart(biomart="ensembl", dataset="hsapiens_gene_ensembl"))

However, this only stores the last gene. In this case RAI1

Is it possible to plot two (or more) gene regions at the same time?

gviz gviz-package • 165 views
ADD COMMENTlink modified 8 months ago • written 8 months ago by stephen.williams10

For anyone interested I got this to work by ultimately plotting my tracks as per below. This method should be able to take any number of tracks and combine as many loci as you'd like.

pushViewport(viewport(layout = grid.layout(2,1)))

pushViewport(viewport(layout.pos.col = ((1 -1)%%1) + 1, layout.pos.row = (((1) -1)%/%1) + 1))
    plotTracks(list(rai1_gtrack, rai1_ht), type= "histogram", showId = TRUE, stacking = "dense", lty.grid="dashed", add = TRUE, fontsize = 13, title.width=1)

pushViewport(viewport(layout.pos.col = ((2 -1)%%1) + 1, layout.pos.row = (((2) -1)%/%1) + 1))
    plotTracks(list(dnmt3a_gtrack, dnmt3a_ht), type= "histogram", showId = TRUE, stacking = "dense", lty.grid="dashed", add = TRUE, reverseStrand=TRUE, fontsize = 13, title.width=1)
ADD REPLYlink written 8 months ago by stephen.williams10
Please log in to add an answer.


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