Browse code

plotRegion did not respect explicitely specified col/lty/lwd arguments. Reported by Karen Conneely <kconnee@emory.edu>.

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

Kasper D. Hansen authored on 17/12/2013 19:25:23
Showing3 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: bsseq
2
-Version: 0.11.1
2
+Version: 0.11.2
3 3
 Title: Analyze, manage and store bisulfite sequencing data
4 4
 Description: Tools for analyzing and visualizing bisulfite sequencing data
5 5
 Authors@R: c(person(c("Kasper", "Daniel"), "Hansen", role = c("aut", "cre"),
... ...
@@ -82,24 +82,36 @@ plotManyRegions <- function(BSseq, regions = NULL, extend = 0, main = "", addReg
82 82
 
83 83
 .bsGetCol <- function(object, col, lty, lwd) {
84 84
     ## Assumes that object has pData and sampleNames methods
85
-    if(is.null(col) && "col" %in% names(pData(object)))
86
-        col <- pData(object)[["col"]]
87
-    else
88
-        col <- rep("black", nrow(pData(object)))
85
+    if(is.null(col)) {
86
+        if("col" %in% names(pData(object)))
87
+            col <- pData(object)[["col"]]
88
+        else
89
+            col <- rep("black", nrow(pData(object)))
90
+    }
91
+    if(length(col) != nrow(object))
92
+        col <- rep(col, length.out = nrow(object))
89 93
     if(is.null(names(col)))
90 94
         names(col) <- sampleNames(object)
91 95
     
92
-    if(is.null(lty) && "lty" %in% names(pData(object)))
93
-        lty <- pData(object)[["lty"]]
94
-    else
95
-        lty <- rep(1, nrow(pData(object)))
96
+    if(is.null(lty)) {
97
+        if("lty" %in% names(pData(object)))
98
+            lty <- pData(object)[["lty"]]
99
+        else
100
+            lty <- rep(1, nrow(pData(object)))
101
+    }
102
+    if(length(lty) != nrow(object))
103
+        lty <- rep(lty, length.out = nrow(object))
96 104
     if(is.null(names(lty)))
97 105
         names(lty) <- sampleNames(object)
98 106
     
99
-    if(is.null(lwd) && "lwd" %in% names(pData(object)))
100
-        lwd <- pData(object)[["lwd"]]
101
-    else
102
-        lwd <- rep(1, nrow(pData(object)))
107
+    if(is.null(lwd)) {
108
+        if("lwd" %in% names(pData(object)))
109
+            lwd <- pData(object)[["lwd"]]
110
+        else
111
+            lwd <- rep(1, nrow(pData(object)))
112
+    }
113
+    if(length(lty) != nrow(object))
114
+        lty <- rep(lty, length.out = nrow(object))
103 115
     if(is.null(names(lwd)))
104 116
         names(lwd) <- sampleNames(object)
105 117
                    
... ...
@@ -5,6 +5,9 @@
5 5
 \section{Version 0.11.x}{
6 6
   \itemize{
7 7
     \item Converted to using Authors@R in the DESCRIPTIOn file.
8
+    \item plotRegion did not respect the col/lty/lwd argument if given
9
+    explicitely as opposed to through pData().  Reported by Karen
10
+    Conneely <kconnee@emory.edu>. 
8 11
   }
9 12
 }
10 13