Gviz: Multiple BiomartGeneRegionTrack one object for Composite plots
0
0
Entering edit mode
@stephenwilliams-15198
Last seen 6.3 years ago

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

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 • 1.0k views
ADD COMMENT
0
Entering edit mode

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.

grid.newpage()
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)
popViewport(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)
popViewport(1)
ADD REPLY

Login before adding your answer.

Traffic: 446 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