[Rflptools-commits] r3 - in pkg/RFLPtools: . R inst/doc man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 17 11:40:04 CET 2010


Author: stamats
Date: 2010-03-17 11:40:04 +0100 (Wed, 17 Mar 2010)
New Revision: 3

Modified:
   pkg/RFLPtools/DESCRIPTION
   pkg/RFLPtools/NEWS
   pkg/RFLPtools/R/RFLPplot.R
   pkg/RFLPtools/R/RFLPrefplot.R
   pkg/RFLPtools/inst/doc/RFLPtools.pdf
   pkg/RFLPtools/man/0RFLP-package.Rd
   pkg/RFLPtools/man/RFLPplot.Rd
   pkg/RFLPtools/man/RFLPrefplot.Rd
Log:
increased version number to 1.2 and added argument "colBands" to functions RFLPplot and RFLPrefplot. Now it's possible for the user to specify her/his own color(s) for the bands.

Modified: pkg/RFLPtools/DESCRIPTION
===================================================================
--- pkg/RFLPtools/DESCRIPTION	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/DESCRIPTION	2010-03-17 10:40:04 UTC (rev 3)
@@ -1,13 +1,13 @@
 Package: RFLPtools
 Type: Package
 Title: Tools to analyse RFLP data
-Version: 1.1
-Date: 2010-02-21
+Version: 1.2
+Date: 2010-03-17
 Author: Fabienne Flessa, Alexandra Kehl, Matthias Kohl
 Maintainer: Matthias Kohl <Matthias.Kohl at stamats.de>
 Description: RFLPtools provides functions to analyse DNA fragment samples 
   (i.e. derived from RFLP-analysis) and standalone BLAST report files 
   (i.e. DNA sequence analysis).
-Depends: R(>= 2.9.0), stats, utils, graphics, grDevices, RColorBrewer
+Depends: R(>= 2.10.0), stats, utils, graphics, grDevices, RColorBrewer
 Suggests: lattice, MKmisc
 License: LGPL-3

Modified: pkg/RFLPtools/NEWS
===================================================================
--- pkg/RFLPtools/NEWS	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/NEWS	2010-03-17 10:40:04 UTC (rev 3)
@@ -16,3 +16,8 @@
   which do not occur as query.ids
 - extended vignette and package Rd-file by RFLPplot and RFLPrefplot examples
 
+###########################################################
+## Version 1.2
+###########################################################
+- RFLPplot and RFLPrefplot gained argument "colBands" to specify color(s) for 
+  the plotted bands.

Modified: pkg/RFLPtools/R/RFLPplot.R
===================================================================
--- pkg/RFLPtools/R/RFLPplot.R	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/R/RFLPplot.R	2010-03-17 10:40:04 UTC (rev 3)
@@ -4,8 +4,10 @@
 
 ## x: data.frame with RFLP data
 ## distfun: function to compute distance (cf. ?dist)
-RFLPplot <- function(x, nrBands, nrMissing, distfun = dist, hclust.method = "complete", 
-                     mar.bottom = 5, cex.axis = 0.5){
+RFLPplot <- function(x, nrBands, nrMissing, distfun = dist, 
+		     hclust.method = "complete", 
+                     mar.bottom = 5, cex.axis = 0.5,
+		     colBands){
     stopifnot(is.data.frame(x))
     stopifnot(is.function(dist))
     if(missing(nrBands))
@@ -54,11 +56,21 @@
         }
     }
     rm(temp1)
-    if(length(temp) <= 9){
-        mycol <- brewer.pal(max(3, length(temp)), "Set1")
+    if(missing(colBands)){
+	if(length(temp) <= 9){
+	    mycol <- brewer.pal(max(3, length(temp)), "Set1")
+	}else{
+	    mycol1 <- brewer.pal(9, "Set1")
+	    mycol <- colorRampPalette(mycol1)(length(temp))
+	}
     }else{
-        mycol1 <- brewer.pal(9, "Set1")
-        mycol <- colorRampPalette(mycol1)(length(temp))
+	if((length(colBands) != 1) && (length(colBands) != length(temp)))
+	    stop("Length of 'colBands' is", length(colBands), "and should be 1 or", length(temp))
+	if(length(colBands) == 1){ 
+	    mycol <- rep(colBands, length(temp))
+        }else{
+            mycol <- colBands
+        }
     }
 
     temp.o <- temp[dend.ord]

Modified: pkg/RFLPtools/R/RFLPrefplot.R
===================================================================
--- pkg/RFLPtools/R/RFLPrefplot.R	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/R/RFLPrefplot.R	2010-03-17 10:40:04 UTC (rev 3)
@@ -5,7 +5,8 @@
 ## x: data.frame with RFLP data
 ## distfun: function to compute distance (cf. ?dist)
 RFLPrefplot <- function(x, ref, distfun = dist, nrBands, mar.bottom = 5, 
-                        cex.main = 1.2, cex.axis = 0.5, devNew = FALSE){
+                        cex.main = 1.2, cex.axis = 0.5, devNew = FALSE,
+                        colBands){
     res <- RFLPdist2ref(x, ref, distfun, nrBands)
         
     x1 <- split(x, x$Sample)
@@ -47,11 +48,21 @@
         abline(h = temp.mw, col = "black", lty = 1)
         box()
         title(paste("Reference sample:", colnames(res)[i]), cex.main = cex.main)
-        if(length(temp) <= 9){
-            mycol <- brewer.pal(max(3, length(temp)), "Set1")
+        if(missing(colBands)){
+            if(length(temp) <= 9){
+                mycol <- brewer.pal(max(3, length(temp)), "Set1")
+            }else{
+                mycol1 <- brewer.pal(9, "Set1")
+                mycol <- colorRampPalette(mycol1)(length(temp))
+            }
         }else{
-            mycol1 <- brewer.pal(9, "Set1")
-            mycol <- colorRampPalette(mycol1)(length(temp))
+            if((length(colBands) != 1) && (length(colBands) != length(temp)))
+                stop("Length of 'colBands' is", length(colBands), "and should be 1 or", length(temp))
+            if(length(colBands) == 1){ 
+                mycol <- rep(colBands, length(temp))
+            }else{
+                mycol <- colBands
+            }
         }
 
         matlines(rbind(rep(0.75, reps), rep(1.25, reps)), 

Modified: pkg/RFLPtools/inst/doc/RFLPtools.pdf
===================================================================
(Binary files differ)

Modified: pkg/RFLPtools/man/0RFLP-package.Rd
===================================================================
--- pkg/RFLPtools/man/0RFLP-package.Rd	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/man/0RFLP-package.Rd	2010-03-17 10:40:04 UTC (rev 3)
@@ -14,9 +14,9 @@
 \details{
 \tabular{ll}{
 Package: \tab RFLPtools\cr
-Version: \tab 1.0 \cr
-Date: \tab 2010-02-21 \cr
-Depends: \tab R(>= 2.9.0), stats, utils, grDevices, RColorBrewer\cr
+Version: \tab 1.2 \cr
+Date: \tab 2010-03-17 \cr
+Depends: \tab R(>= 2.10.0), stats, utils, grDevices, RColorBrewer\cr
 Suggests: \tab lattice, MKmisc\cr
 License: \tab LGPL-3\cr
 }}

Modified: pkg/RFLPtools/man/RFLPplot.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPplot.Rd	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/man/RFLPplot.Rd	2010-03-17 10:40:04 UTC (rev 3)
@@ -9,7 +9,8 @@
 }
 \usage{
 RFLPplot(x, nrBands, nrMissing, distfun = dist, 
-         hclust.method = "complete", mar.bottom = 5, cex.axis = 0.5)
+         hclust.method = "complete", mar.bottom = 5, 
+         cex.axis = 0.5, colBands)
 }
 \arguments{
   \item{x}{ data.frame with RFLP data; see \code{\link{RFLPdata}}.}
@@ -24,6 +25,9 @@
   see \code{\link[stats]{hclust}}.}
   \item{mar.bottom}{ bottom margin of the plot; see \code{\link[graphics]{par}}. }
   \item{cex.axis}{ size of the x-axis annotation. }
+  \item{colBands}{ color for the bands. Has to be of length 1 or number of samples. 
+  If missing, \code{"Set1"} of \pkg{RColorBrewer} is used; see
+  \code{\link[RColorBrewer]{brewer.pal}}. }
 }
 \details{
   RFLP data is plotted. The samples are sorted according to the corresponding

Modified: pkg/RFLPtools/man/RFLPrefplot.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPrefplot.Rd	2010-02-24 18:50:56 UTC (rev 2)
+++ pkg/RFLPtools/man/RFLPrefplot.Rd	2010-03-17 10:40:04 UTC (rev 3)
@@ -9,7 +9,8 @@
 }
 \usage{
 RFLPrefplot(x, ref, distfun = dist, nrBands, mar.bottom = 5, 
-            cex.main = 1.2, cex.axis = 0.5, devNew = FALSE)
+            cex.main = 1.2, cex.axis = 0.5, devNew = FALSE, 
+            colBands)
 }
 \arguments{
   \item{x}{ data.frame with RFLP data; e.g. \code{\link{RFLPdata}}.}
@@ -22,6 +23,9 @@
   \item{cex.main}{ size of the plot title. }
   \item{cex.axis}{ size of the x-axis annotation. }
   \item{devNew}{ logical. Open new graphics device for each plot. }
+  \item{colBands}{ color for the bands. Has to be of length 1 or number of samples. 
+  If missing, \code{"Set1"} of \pkg{RColorBrewer} is used; see
+  \code{\link[RColorBrewer]{brewer.pal}}. }
 }
 \details{
   Given RFLP samples are plotted together with reference samples and



More information about the Rflptools-commits mailing list