First, let me say thanks for such an excellent genome visualization package. I simply couldn't find anything comparable when it came to producing publication quality genome plots.

I've run what seems like a bug to me, and I've attempted to provide a suitable patch. The bug is in the coverage portion of an AnnotationTrack. It seems that if one supplies a `ylim` value, the printed scale will be adjusted as requested, but the graph will still be plotted in the automatically determined scale.

Example plotting graphs without setting ylim (not the scales for each are different): http://i.imgur.com/68xObgx.png Example of graphs with ylim set (but not properly honored): http://i.imgur.com/MBvO2wA.png Example of patched code with ylim set (now the ylim is used properly): http://i.imgur.com/EXlrkqa.png

I hope this helps to resolve what I think is an unintended bug.

--
Lance Parsons - Scientific Programmer
134 Carl C. Icahn Laboratory
Lewis-Sigler Institute for Integrative Genomics
Princeton University

# HG changeset patch
# User Lance Parsons <lpars...@princeton.edu>
# Date 1398796857 14400
#      Tue Apr 29 14:40:57 2014 -0400
# Node ID 9bbc6f96091b858d235556b7f91f191deabfe463
# Parent  d21ec38ccc414476d50100201649bd9ca322ccbd
imported patch AlignmentsTrack_ylim_fix

diff --git a/R/Gviz-methods.R b/R/Gviz-methods.R
--- a/R/Gviz-methods.R
+++ b/R/Gviz-methods.R
@@ -1834,6 +1834,7 @@
     revs <- !.dpOrDefault(GdObject, "reverseStacking", FALSE)
     vSpacing <- as.numeric(convertHeight(unit(3, "points"), "npc"))
     type <- match.arg(.dpOrDefault(GdObject, "type", .ALIGNMENT_TYPES), 
.ALIGNMENT_TYPES, several.ok=TRUE)
+    ylim <- .dpOrDefault(GdObject, "ylim")
     ## In prepare mode we need to make sure that the stacking information is 
updated from the optional display parameter (by calling
     ## the StackedTrack drawGD method), and compute the coverage vector which 
will be needed for the axis
     if(prepare){
@@ -1898,8 +1899,12 @@
     covSpace <- .dpOrDefault(GdObject, ".__coverageSpace", 0)
     if("coverage" %in% type){
         cov <- .dpOrDefault(GdObject, ".__coverage", Rle(lengths=maxBase, 
values=as.integer(0)))
+        yscale=c(0, max(cov) + diff(range(cov)) * 0.05)
+        if (!is.null(ylim)) {
+            yscale=ylim
+        }
         vp <- viewport(height=covHeight["npc"], y=1-(covHeight["npc"] + 
covSpace), just=c(0.5, 0), xscale=xscale,
-                       yscale=c(0, max(cov) + diff(range(cov)) * 0.05), 
clip=TRUE)
+                       yscale=yscale, clip=TRUE)
         pushViewport(vp)
         res <- .pxResolution(coord="x")
         gp <- gpar(col=.dpOrDefault(GdObject, c("col.coverage", "col"), 
.DEFAULT_SHADED_COL),
_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to