In Gviz, when using plotTracks() to plot a DataTrack with type="boxplot", a dashed line is plotted around the first two boxplots:
Is it possible to turn that off? How?
Thanks,
In Gviz, when using plotTracks() to plot a DataTrack with type="boxplot", a dashed line is plotted around the first two boxplots:
Is it possible to turn that off? How?
Thanks,
Hi Enrico,
just got around fixing this. Should become available shortly with Gviz 1.16.1. and 1.17.1
Thanks for reporting,
Florian
Can you give a reproducible example with code and data. This looks like a bug to me, but hard to do anything about it without an example.
Here we go:
library(Gviz) # generate random data set.seed(16) seqnames <- paste0(sample(1:22, 100, replace=TRUE)) start <- sample(1000:10000, 100) end <- start + sample(100:1000, 100) values <- matrix(rexp(1700), 100) colnames(values) <- paste(sample(c("Low", "Medium", "High"), 17, replace=TRUE), 1:17, sep=".") # create GRanges dataset <- cbind.data.frame(seqnames, start, end, values) dataset <- GRanges(dataset) # define some variables for plotting gen <- "hg38" chr <- "16" from <- 5000 to <- 10000 groups <- factor(sub("(Low|Medium|High)\\.[0-9]+", "\\1", names(mcols(dataset))), levels=c("Low", "Medium", "High")) # create DataTrack dataset <- dataset[seqnames(dataset)==chr & start(dataset) >= from & end(dataset) <= to] datatrack <- DataTrack(dataset, name="dataset", genome=gen, chromosome=chr, start=from, end=to, groups=groups, type="boxplot", legend=TRUE) png("mwe.png", res=150, width=10*150, height=12*150) plotTracks(datatrack, chromosome=chr, from=from, to=to, background.title="grey70") dev.off()
You can see that in all cases the boxplots appear shifted to the right with some blank space on the left and the rightmost boxplot on the dashed boundary or beyond.
How can I fix this? I'm guessing this is due to how my GRanges object is built and/or the way groups in my DataTrack are defined?
Thank you.
OK, I've got a better, real-world example:
library(TxDb.Hsapiens.UCSC.hg38.knownGene) library(Gviz) set.seed(16) # create GRanges with one range corresponding to a gene gen <- "hg38" chr <- "chr12" start <- 121429097 end <- 121581015 values <- matrix(rexp(17), 1) colnames(values) <- paste(sample(c("Low", "Medium", "High"), 17, replace=TRUE), 1:17, sep=".") dataset <- cbind.data.frame(chr, start, end, values) dataset <- GRanges(dataset) # define groups groups <- factor(sub("(Low|Medium|High)\\.[0-9]+", "\\1", names(mcols(dataset))), levels=c("Low", "Medium", "High")) # create tracks grtrack <- GeneRegionTrack(TxDb.Hsapiens.UCSC.hg38.knownGene, genome=gen, chromosome=chr, start=start, end=end, collapseTranscripts="meta") dtrack <- DataTrack(dataset, name="dataset", genome=gen, chromosome=chr, start=start, end=end, groups=groups, type="boxplot", legend=TRUE) # plot png("mwe.png", res=150, width=10*150, height=12*150) plotTracks(list(grtrack, dtrack), chromosome=chr, from=start-25000, to=end+25000) dev.off()
From what I can see, the dashed frame is correctly aligned to the gene, but the boxplots are clearly shifted to the right for some reason.
Interestingly, I also get this warning message when calling plotTracks():
Warning message: In min(diff(unique(sort(x)))) : no non-missing arguments to min; returning Inf
Any idea on how to fix this?
Thanks!
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Actually, I'm realising the real problem here is that the boxplots are shifted to the right, which is why the third boxplot is outside of the dashed box... Any idea what might be causing that?