Browse code

adding reverseStacking parameter to reverse the horizontal ordering of stacked items

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Gviz@69403 bc3139a8-67e5-0310-9ffc-ced21a209358

Florian Hahne authored on 13/09/2012 08:25:34
Showing 9 changed files

... ...
@@ -11,7 +11,11 @@ NEW FEATURES
11 11
       by means of the feature property in combination with the
12 12
       thinBoxFeature display parameter.
13 13
 
14
-   
14
+    o StackedTracks now have a new display parameter 'reverseStacking'
15
+      which reverts the horizontal ordering of stacked items. If set
16
+      to TRUE, the lowest items are moved to the top of the stack, and
17
+      vice versa.
18
+
15 19
 
16 20
 SIGNIFICANT USER-VISIBLE CHANGES
17 21
 
... ...
@@ -406,7 +406,7 @@ setClass("StackedTrack",
406 406
          prototype=prototype(name="StackedTrack",
407 407
                              stacking="squish",
408 408
                              stackingValues=c("hide", "dense", "squish", "pack", "full"),
409
-                             dp=DisplayPars()),					  
409
+                             dp=DisplayPars(reverseStacking=FALSE)),					  
410 410
          contains="RangeTrack")
411 411
 
412 412
 ## Need to fill the stacks slot here, don't want to recompute all the time
... ...
@@ -1290,8 +1290,8 @@ setMethod("drawGD", signature("AnnotationTrack"), function(GdObject, minBase, ma
1290 1290
     ## If there are too many stacks for the available device resolution we cast an error
1291 1291
     bins <- stacks(GdObject)
1292 1292
     stacks <- max(bins)
1293
-    pushViewport(dataViewport(xData=c(minBase, maxBase), extension=0,
1294
-                              yscale=c(1, stacks+1), clip=TRUE))
1293
+    yscale <- if(.dpOrDefault(GdObject, "reverseStacking", FALSE)) c(1, stacks+1) else c(stacks+1, 1)
1294
+    pushViewport(dataViewport(xData=c(minBase, maxBase), extension=0, yscale=yscale, clip=TRUE))
1295 1295
     res <- .pxResolution(coord="x")
1296 1296
     curVp <- vpLocation()
1297 1297
     if(curVp$size["height"]/stacks < .dpOrDefault(GdObject, "min.height", 3))
... ...
@@ -346,7 +346,8 @@ details <- list(
346 346
                             fontfamily.legend="Integer or character scalar. The font family for the legend text.",
347 347
                             lineheight.legend="Numeric scalar. The line height for the legend text.",
348 348
                             fontcolor.legend="Integer or character scalar. The font color for the legend text."),
349
-                
349
+
350
+                StackedTrack=c(reverseStacking="Logical flag. Reverse the y-ordering of stacked items. I.e., features that are plotted on the bottom-most stacks will be moved to the top-most stack and vice versa."),
350 351
                 
351 352
                 GdObject=c(fontsize="Numeric scalar. The font size for all text.",
352 353
                            fontface="Integer or character scalar. The font face for all text.",
... ...
@@ -1090,7 +1090,20 @@ stacking="squish", name="AlignedReadTrack", coverageOnly=FALSE, ...)
1090 1090
   parent classes. Note that not all of them may have an effect on the
1091 1091
   plotting of \code{AlignedReadTrack} objects. 
1092 1092
 
1093
-    \describe{ 
1093
+  \describe{
1094
+
1095
+    \item{}{\code{\linkS4class{StackedTrack}}:
1096
+      
1097
+      \describe{ 
1098
+
1099
+	\item{}{\code{reverseStacking=FALSE}: Logical flag. Reverse the
1100
+	  y-ordering of stacked items. I.e., features that are plotted on
1101
+	  the bottom-most stacks will be moved to the top-most stack and
1102
+	  vice versa.}
1103
+
1104
+      }
1105
+      
1106
+    }
1094 1107
 
1095 1108
     \item{}{\code{\linkS4class{GdObject}}: 
1096 1109
 
... ...
@@ -1439,8 +1439,21 @@ AnnotationTrack(range=NULL, start=NULL, end=NULL, width=NULL, feature, group,
1439 1439
   parent classes. Note that not all of them may have an effect on the
1440 1440
   plotting of \code{AnnotationTrack} \code{DetailsAnnotationTrack} objects. 
1441 1441
 
1442
-    \describe{ 
1442
+  \describe{
1443
+
1444
+    \item{}{\code{\linkS4class{StackedTrack}}:
1445
+      
1446
+      \describe{ 
1447
+
1448
+	\item{}{\code{reverseStacking=FALSE}: Logical flag. Reverse the
1449
+	  y-ordering of stacked items. I.e., features that are plotted on
1450
+	  the bottom-most stacks will be moved to the top-most stack and
1451
+	  vice versa.}
1443 1452
 
1453
+      }
1454
+      
1455
+    }
1456
+    
1444 1457
     \item{}{\code{\linkS4class{GdObject}}: 
1445 1458
 
1446 1459
       \describe{ 
... ...
@@ -1398,7 +1398,20 @@ genome=NULL, stacking="squish", filters=list(), name="BiomartGeneRegionTrack", .
1398 1398
 
1399 1399
       } 
1400 1400
 
1401
-    } 
1401
+    }
1402
+
1403
+    \item{}{\code{\linkS4class{StackedTrack}}:
1404
+      
1405
+      \describe{ 
1406
+	
1407
+	\item{}{\code{reverseStacking=FALSE}: Logical flag. Reverse the
1408
+	  y-ordering of stacked items. I.e., features that are plotted on
1409
+	  the bottom-most stacks will be moved to the top-most stack and
1410
+	  vice versa.}
1411
+	
1412
+      }
1413
+      
1414
+    }
1402 1415
 
1403 1416
     \item{}{\code{\linkS4class{GdObject}}: 
1404 1417
 
... ...
@@ -1540,7 +1540,20 @@ GeneRegionTrack(range=NULL, rstarts=NULL, rends=NULL, rwidths=NULL, strand="*",
1540 1540
 
1541 1541
       } 
1542 1542
 
1543
-    } 
1543
+    }
1544
+
1545
+    \item{}{\code{\linkS4class{StackedTrack}}:
1546
+      
1547
+      \describe{ 
1548
+	
1549
+	\item{}{\code{reverseStacking=FALSE}: Logical flag. Reverse the
1550
+	  y-ordering of stacked items. I.e., features that are plotted on
1551
+	  the bottom-most stacks will be moved to the top-most stack and
1552
+	  vice versa.}
1553
+
1554
+      }
1555
+      
1556
+    }
1544 1557
 
1545 1558
     \item{}{\code{\linkS4class{GdObject}}: 
1546 1559
 
... ...
@@ -857,10 +857,23 @@
857 857
 }
858 858
 
859 859
 
860
-\section{Display Parameters}{ 
860
+\section{Display Parameters}{
861 861
 
862
-  No formal display parameters are defined for objects of class
863
-  \code{StackedTrack}. 
862
+  The following display parameters are set for objects of class
863
+  \code{AnnotationTrack} upon instantiation, unless one or more of them
864
+  have already been set by one of the optional sub-class initializers,
865
+  which always get precedence over these global defaults. See
866
+  \code{\link{settings}} for details on setting graphical parameters
867
+  for tracks.
868
+
869
+  \describe{ 
870
+
871
+    \item{}{\code{reverseStacking=FALSE}: Logical flag. Reverse the
872
+      y-ordering of stacked items. I.e., features that are plotted on
873
+      the bottom-most stacks will be moved to the top-most stack and
874
+      vice versa.}
875
+
876
+  }
864 877
 
865 878
   Additional display parameters are being inherited from the respective
866 879
   parent classes. Note that not all of them may have an effect on the