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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 2 15:16:11 CET 2014


Author: stamats
Date: 2014-03-02 15:16:11 +0100 (Sun, 02 Mar 2014)
New Revision: 15

Added:
   pkg/RFLPtools/R/FragMatch.R
   pkg/RFLPtools/R/germ.R
   pkg/RFLPtools/R/simulateRFLPData.R
   pkg/RFLPtools/data/newDataGerm.RData
   pkg/RFLPtools/data/refDataGerm.RData
   pkg/RFLPtools/man/FragMatch.Rd
   pkg/RFLPtools/man/RFLPcombine.Rd
   pkg/RFLPtools/man/RFLPlod.Rd
   pkg/RFLPtools/man/germ.Rd
   pkg/RFLPtools/man/newDataGerm.Rd
   pkg/RFLPtools/man/refDataGerm.Rd
   pkg/RFLPtools/man/simulateRFLPdata.Rd
Modified:
   pkg/RFLPtools/DESCRIPTION
   pkg/RFLPtools/NAMESPACE
   pkg/RFLPtools/NEWS
   pkg/RFLPtools/R/RFLPdist.R
   pkg/RFLPtools/R/RFLPdist2.R
   pkg/RFLPtools/R/RFLPdist2ref.R
   pkg/RFLPtools/inst/doc/RFLPtools.pdf
   pkg/RFLPtools/man/0RFLP-package.Rd
   pkg/RFLPtools/man/BLASTdata.Rd
   pkg/RFLPtools/man/RFLPdata.Rd
   pkg/RFLPtools/man/RFLPdist.Rd
   pkg/RFLPtools/man/RFLPdist2.Rd
   pkg/RFLPtools/man/RFLPdist2ref.Rd
   pkg/RFLPtools/man/RFLPplot.Rd
   pkg/RFLPtools/man/RFLPqc.Rd
   pkg/RFLPtools/man/RFLPref.Rd
   pkg/RFLPtools/man/RFLPrefplot.Rd
   pkg/RFLPtools/man/diffDist.Rd
   pkg/RFLPtools/man/linCombDist.Rd
   pkg/RFLPtools/man/nrBands.Rd
   pkg/RFLPtools/man/read.blast.Rd
   pkg/RFLPtools/man/read.rflp.Rd
   pkg/RFLPtools/man/sim2dist.Rd
   pkg/RFLPtools/man/simMatrix.Rd
   pkg/RFLPtools/man/write.hclust.Rd
Log:
several extensions of version 1.5; see NEWS file

Modified: pkg/RFLPtools/DESCRIPTION
===================================================================
--- pkg/RFLPtools/DESCRIPTION	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/DESCRIPTION	2014-03-02 14:16:11 UTC (rev 15)
@@ -1,13 +1,13 @@
 Package: RFLPtools
 Type: Package
 Title: Tools to analyse RFLP data
-Version: 1.5
-Date: 2013-01-04
+Version: 1.6
+Date: 2014-03-02
 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.10.0), stats, utils, graphics, grDevices, RColorBrewer
+Depends: R(>= 3.0.0), stats, utils, graphics, grDevices, RColorBrewer
 Suggests: lattice, MKmisc(>= 0.8)
 License: LGPL-3

Modified: pkg/RFLPtools/NAMESPACE
===================================================================
--- pkg/RFLPtools/NAMESPACE	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/NAMESPACE	2014-03-02 14:16:11 UTC (rev 15)
@@ -1,5 +1,6 @@
-export(read.rflp,
-       diffDist,
+export(diffDist,
+       FragMatch,
+       germ,
        linCombDist,
        RFLPqc,
        RFLPdist,
@@ -11,6 +12,8 @@
        RFLPlod,
        nrBands,
        read.blast,
+       read.rflp,
        simMatrix,
        sim2dist,
+       simulateRFLPdata,
        write.hclust)

Modified: pkg/RFLPtools/NEWS
===================================================================
--- pkg/RFLPtools/NEWS	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/NEWS	2014-03-02 14:16:11 UTC (rev 15)
@@ -3,6 +3,22 @@
 ###############################################################################
 
 ###########################################################
+## Version 1.6
+###########################################################
+- added reference Flessa et al. (2013) to man files.
+- added some further checks for function input.
+- functions RFLPdist and RFLPdist2ref obtained an argument LOD for handling 
+  values below some given limit of detection (LOD).
+- new example datasets refDataGerm and newDataGerm taken from the GERM
+  software
+- added function germ which represents an implementation of the Good-Enough 
+  RFLP Matcher (GERM) program.
+- added function FragMatch which represents an implementation of the FragMatch
+  program.
+- added function simulateRFLPdata to simulate RFLP data.
+
+
+###########################################################
 ## Version 1.5
 ###########################################################
 - update of vignette

Added: pkg/RFLPtools/R/FragMatch.R
===================================================================
--- pkg/RFLPtools/R/FragMatch.R	                        (rev 0)
+++ pkg/RFLPtools/R/FragMatch.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,77 @@
+FragMatch <- function(newData, refData, maxValue = 1000, errorBound = 25,
+                      weight = 1, na.rm = TRUE){
+  if(length(maxValue) != length(errorBound))
+    stop("'maxValue' and 'errorBound' must have identical lengths.")
+  if(any(maxValue <= 0))
+    stop("'maxValue' has to be a vector of positive values.")
+  if(any(errorBound <= 0))
+    stop("'errorBound' has to be a vector of positive values.")
+  if(length(weight) > 1){
+    weight <- weight[1]
+    warning("Only first element of 'weight' is used.")
+  }
+  if(weight < 0)
+    stop("'weight' has to be a non-negative real.")
+  
+  errorBound <- errorBound[order(maxValue)]
+  maxValue <- sort(maxValue)
+  
+  refNames <- unique(refData$Sample)
+  newNames <- unique(newData$Sample)
+  
+  res <- matrix("", nrow = length(newNames), ncol = length(refNames))
+  rownames(res) <- newNames
+  colnames(res) <- refNames
+  
+  for(i in 1:length(newNames)){
+    for(j in 1:length(refNames)){
+      New <- newData[newData$Sample == newNames[i],]      
+      Ref <- refData[refData$Sample == refNames[j],]
+      nrEnz <- length(unique(Ref$Enzyme))
+      res.enz.match <- max.pos.match <- numeric(nrEnz)
+      refenzNames <- unique(Ref$Enzyme)
+      newenzNames <- unique(New$Enzyme)
+      
+      if(length(refenzNames) != length(newenzNames))
+        stop("Number of enzymes is different for new data and reference data!")
+      if(!all(refenzNames == newenzNames))
+        stop("Names of enzymes are different for new data and reference data!")
+      
+      for(k in 1:nrEnz){
+        Newk <- New[New$Enzyme == newenzNames[k],]
+        Refk <- Ref[Ref$Enzyme == newenzNames[k],]
+        ## number of matches
+        max.pos.match[k] <- nrow(Refk)
+        res.enz.match[k] <- .countMatches(abs(Newk$MW), abs(Refk$MW), 
+                                          maxValue = maxValue, 
+                                          errorBound = errorBound)
+      }
+      
+      ind.weights <- max.pos.match == res.enz.match
+      max.match <- sum(weight*max.pos.match)
+      res.match <- sum(ifelse(ind.weights, weight*res.enz.match, res.enz.match))
+      res[i,j] <- paste(res.match, "_", max.match, sep = "")
+    }
+  }
+  res
+}
+
+.countMatches <- function(x, y, maxValue, errorBound){
+  nrMatch <- 0
+  if(any(y > max(maxValue)) | any(x > max(maxValue))){
+    errorBound <- c(errorBound, errorBound[which.max(maxValue)])
+    maxValue <- c(maxValue, max(y,x))
+  }
+  for(i in 1:length(maxValue)){
+    yi <- y[y < maxValue[i]]
+    xi <- x[x < (maxValue[i]+errorBound[i])]
+    for(j in 1:length(yi)){
+      ind <- (xi > (yi[j]-errorBound[i])) & (xi < (yi[j]+errorBound[i]))
+      if(any(ind)){
+        nrMatch <- nrMatch + 1
+        xi <- xi[-which(ind)[1]]
+      }
+    }
+  }
+  nrMatch
+}

Modified: pkg/RFLPtools/R/RFLPdist.R
===================================================================
--- pkg/RFLPtools/R/RFLPdist.R	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/R/RFLPdist.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -4,10 +4,20 @@
 
 ## x: data.frame with RFLP data
 ## distfun: function to compute distance (cf. ?dist)
-RFLPdist <- function(x, distfun = dist, nrBands){
+RFLPdist <- function(x, distfun = dist, nrBands, LOD = 0){
     stopifnot(is.data.frame(x))
     stopifnot(is.function(distfun))
+    if(!missing(nrBands)){
+        if(nrBands <= 0)
+            stop("'nrBands' has to be a positive interger!")
+    }
+    if(LOD < 0)
+        stop("'LOD' has to be non-negative!")
 
+    if(LOD > 0){
+        x <- x[x$MW >= LOD,]
+    }
+
     x1 <- split(x, x$Sample)
     nrbands <- sort(unique(sapply(x1, nrow)))
     x1.bands <- sapply(x1, nrow)

Modified: pkg/RFLPtools/R/RFLPdist2.R
===================================================================
--- pkg/RFLPtools/R/RFLPdist2.R	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/R/RFLPdist2.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -14,15 +14,23 @@
 ## diag: see ?dist
 ## upper: see ?dist
 ## compares samples with number of bands in: nrBands, nrBands + 1, ..., nrBands + nrMissing
-RFLPdist2 <- function(x, distfun = dist, nrBands, nrMissing, LOD, diag = FALSE, upper = FALSE){
+RFLPdist2 <- function(x, distfun = dist, nrBands, nrMissing, LOD = 0, diag = FALSE, upper = FALSE){
     stopifnot(is.data.frame(x))
     stopifnot(is.function(distfun))
     if(missing(nrMissing))
         stop("'nrMissing' is not specified!")
     if(nrMissing == 0)
         stop("'nrMissing == 0', please use function 'RFLPdist'!")
+    if(nrMissing <= 0)
+        stop("'nrMissing' has to be a positive interger!")    
+    if(missing(nrBands))
+        stop("'nrBands' is not specified!")
+    if(nrBands <= 0)
+        stop("'nrBands' has to be a positive interger!")
+    if(LOD < 0)
+        stop("'LOD' has to be non-negative!")
 
-    if(missing(LOD)){
+    if(LOD == 0){
         x1 <- split(x, x$Sample)
         x1.bands <- sapply(x1, nrow)
 

Modified: pkg/RFLPtools/R/RFLPdist2ref.R
===================================================================
--- pkg/RFLPtools/R/RFLPdist2ref.R	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/R/RFLPdist2ref.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -5,13 +5,19 @@
 ## x: data.frame with RFLP data
 ## ref: data.frame with RFLP reference data
 ## distfun: function to compute distance (cf. ?dist)
-RFLPdist2ref <- function(x, ref, distfun = dist, nrBands){
+RFLPdist2ref <- function(x, ref, distfun = dist, nrBands, LOD = 0){
     stopifnot(is.data.frame(x))
     stopifnot(is.data.frame(ref))
     stopifnot(is.function(distfun))
     
     if(missing(nrBands))
         stop("Number of Bands 'nrBands' is missing.")
+    if(nrBands <= 0)
+        stop("'nrBands' has to be a positive interger!")
+    if(LOD > 0){
+        x <- x[x$MW >= LOD,]
+        ref <- ref[ref$MW >= LOD,]
+    }
         
     x1 <- split(x, x$Sample)
     ref1 <- split(ref, ref$Sample)

Added: pkg/RFLPtools/R/germ.R
===================================================================
--- pkg/RFLPtools/R/germ.R	                        (rev 0)
+++ pkg/RFLPtools/R/germ.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,95 @@
+germ <- function(newData, refData, 
+                 parameters = list("Max forward error" = 25,
+                                   "Max backward error" = 25,
+                                   "Max sum error" = 100,
+                                   "Lower measurement limit" = 100), 
+                 method = "joint", na.rm = TRUE){
+  if(!is.na(pmatch(method, "joint"))) method <- "joint"
+  METHODS <- c("joint", "forward", "backward", "sum")
+  method <- pmatch(method, METHODS)
+  if(is.na(method)) stop("invalid ranking method")
+  if (method == -1) stop("ambiguous ranking method")
+  
+  newNames <- unique(newData$Sample)
+  refNames <- unique(refData$Sample)
+  
+  res <- array(NA, dim = c(length(refNames), 4, length(newNames)))
+  rownames(res) <- refNames
+  colnames(res) <- c("Forward Max", "Backward Max", "Sum of Bands", "Joint")
+  dimnames(res)[[3]] <- newNames
+  
+  if(na.rm){
+    newData <- newData[!is.na(newData$MW),]
+    refData <- refData[!is.na(refData$MW),]
+  }
+  
+  for(i in 1:length(newNames)){
+    for(j in 1:length(refNames)){
+      New <- newData[newData$Sample == newNames[i],]
+      Ref <- refData[refData$Sample == refNames[j],]
+      nrEnz <- length(unique(Ref$Enzyme))
+      res.enz.sum <- res.enz.bw <- res.enz.fw <- numeric(nrEnz)
+      refenzNames <- unique(Ref$Enzyme)
+      newenzNames <- unique(New$Enzyme)
+      
+      if(length(refenzNames) != length(newenzNames))
+        stop("Number of enzymes is different for new data and reference data!")
+      if(!all(refenzNames == newenzNames))
+        stop("Names of enzymes are different for new data and reference data!")
+      
+      for(k in 1:nrEnz){
+        Newk <- New[New$Enzyme == newenzNames[k],]
+        Refk <- Ref[Ref$Enzyme == newenzNames[k],]
+        ## forward
+        ind.fw <- Newk$MW > (parameters$"Max forward error" +
+                               parameters$"Lower measurement limit")
+        res.enz.fw[k] <- .forward(abs(Newk$MW[ind.fw]), abs(Refk$MW))
+        ## backward
+        ind.bw <- Refk$MW > (parameters$"Max backward error" + 
+                             parameters$"Lower measurement limit")
+        res.enz.bw[k] <- .backward(abs(Newk$MW), abs(Refk$MW[ind.bw]))
+        ## sum
+        res.enz.sum[k] <- abs(sum(abs(Newk$MW)) - sum(abs(Refk$MW)))
+      }
+#      cat(Ref$Sample[1], ":\t", res.enz.sum, "\n")
+      res[j,1,i] <- max(res.enz.fw, na.rm = TRUE)
+      res[j,2,i] <- max(res.enz.bw, na.rm = TRUE)
+      res[j,3,i] <- max(res.enz.sum, na.rm = TRUE)
+      res[j,4,i] <- res[j,1,i]+res[j,2,i]
+    }
+  }
+  res.ord <- vector("list", length = length(newNames))
+  names(res.ord) <- newNames
+  if(method == 1){
+    for(i in 1:length(newNames)){
+      res.ord[[i]] <- res[order(res[,4,i]),,i]
+    }
+  }
+  if(method == 2){
+    for(i in 1:length(newNames)){
+      res.ord[[i]] <- res[order(res[,1,i]),,i]
+    }
+  }
+  if(method == 3){
+    for(i in 1:length(newNames)){
+      res.ord[[i]] <- res[order(res[,2,i]),,i]
+    }
+  }
+  if(method == 4){
+    for(i in 1:length(newNames)){
+      res.ord[[i]] <- res[order(res[,3,i]),,i]
+    }
+  }
+  res.ord
+}
+.backward <- function(x, y){
+  res <- numeric(length(y))
+  ## zero padding of x
+  if(length(x) < length(y))
+    x <- c(x, rep(0, length(y)-length(x)))
+  for(i in 1:length(y)){
+    res[i] <- min(abs(y[i]-x))
+  }
+  max(res)
+}
+.forward <- function(x, y){ .backward(x = y, y = x) }

Added: pkg/RFLPtools/R/simulateRFLPData.R
===================================================================
--- pkg/RFLPtools/R/simulateRFLPData.R	                        (rev 0)
+++ pkg/RFLPtools/R/simulateRFLPData.R	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,56 @@
+###############################################################################
+## R Code to simulate reference data
+###############################################################################
+
+## N: number of samples for each of the number of bands
+## nrBands: number of bands for which data is simulated
+##          total number of samples: N*length(nrBands)
+## BandCenters: molecular weights are randomly generated around "band centers"
+## delta: use uniform distribution with +/- delta around the band centers
+## refData: if TRUE also Taxonname and Accession are added
+simulateRFLPdata <- function(N = 10, nrBands = 3:12, 
+                             bandCenters = seq(100, 800, by = 100),
+                             delta = 50, refData = FALSE){
+  if(length(N) > 1){
+    N <- N[1]
+    warning("Only the first element of 'N' is used.")
+  }
+  if(N <= 0) stop("'N' has to be a positive integer!")
+  N <- trunc(N)
+  
+  if(any(nrBands <= 0)) stop("'nrBands' has to be a vector of positive integer!")
+  if(any(bandCenters <= 0)) stop("'bandCenters' has to be a vector of positive reals!")
+  if(length(delta) > 1){
+    delta <- delta[1]
+    warning("Only the first element of 'delta' is used.")
+  }
+  if(delta <= 0) stop("'delta' has to be a positive real!")
+  
+  ## data matrix
+  simData <- matrix(NA, nrow = sum(N*nrBands), ncol = 3)
+  colnames(simData) <- c("Sample", "Band", "MW")
+  
+  row.count <- 0
+  sample.count <- 1
+  for(i in nrBands){
+    for(j in 1:N){
+      ## randomly select "band centers" (with replacement!)
+      Bcent <- sample(bandCenters, i, replace = TRUE)
+      ## simulate molecular weights
+      simData[row.count+(1:i),] <- c(rep(sample.count, i),
+                                     1:i,
+                                     sort(runif(i, min = Bcent-delta, max = Bcent+delta)))
+      row.count <- row.count + i
+      sample.count <- sample.count + 1
+    }
+  }
+  
+  ## Generate data.frame and add column Enzyme 
+  simData <- data.frame(simData, Enzyme = "Enzyme 1")
+  simData$Sample <- paste("Sample", simData$Sample)
+  if(refData){
+    simData$Taxonname <- simData$Sample
+    simData$Accession <- simData$Sample
+  }
+  simData
+}

Added: pkg/RFLPtools/data/newDataGerm.RData
===================================================================
(Binary files differ)


Property changes on: pkg/RFLPtools/data/newDataGerm.RData
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/RFLPtools/data/refDataGerm.RData
===================================================================
(Binary files differ)


Property changes on: pkg/RFLPtools/data/refDataGerm.RData
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

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

Modified: pkg/RFLPtools/man/0RFLP-package.Rd
===================================================================
--- pkg/RFLPtools/man/0RFLP-package.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/0RFLP-package.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -14,9 +14,9 @@
 \details{
 \tabular{ll}{
 Package: \tab RFLPtools\cr
-Version: \tab 1.5 \cr
-Date: \tab 2013-01-04 \cr
-Depends: \tab R(>= 2.10.0), stats, utils, grDevices, RColorBrewer\cr
+Version: \tab 1.6 \cr
+Date: \tab 2014-03-02 \cr
+Depends: \tab R(>= 3.0.0), stats, utils, grDevices, RColorBrewer\cr
 Suggests: \tab lattice, MKmisc(>= 0.8)\cr
 License: \tab LGPL-3\cr
 }}
@@ -34,19 +34,31 @@
   Local Blast download: \url{ftp://ftp.ncbi.nih.gov/blast/executables/release/}
   
   Blast News: \url{http://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastNews}
+  
+  Ian A. Dickie, Peter G. Avis, David J. McLaughlin, Peter B. Reich. 
+  Good-Enough RFLP Matcher (GERM) program.
+  Mycorrhiza 2003, 13:171-172.
 
-  Poussier, Stephane; Trigalet-Demery, Danielle; Vandewalle, Peggy; Goffinet, Bruno; Luisetti, Jacques; Trigalet, Andre.
-  Genetic diversity of Ralstonia solanacearum as assessed by PCR-RFLP of the hrp gene region, AFLP and 16S rRNA sequence 
-  analysis, and identification of an African subdivision.
-  Microbiology 2000 146:1679-1692 
-  
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+
   Matsumoto, Masaru; Furuya, Naruto; Takanami, Yoichi; Matsuyama, Nobuaki.  
   RFLP analysis of the PCR-amplified 28S rDNA in Rhizoctonia solani. 
-  Mycoscience 1996 37:351 - 356
+  Mycoscience 1996 37:351-356.
 
   Persoh, D., Melcher, M., Flessa, F., Rambold, G.: 
   First fungal community analyses of endophytic ascomycetes associated with Viscum album ssp. austriacum 
   and itshost Pinus sylvestris. Fungal Biology 2010 Jul;114(7):585-96.
+
+  Poussier, Stephane; Trigalet-Demery, Danielle; Vandewalle, Peggy; Goffinet, Bruno; Luisetti, Jacques; Trigalet, Andre.
+  Genetic diversity of Ralstonia solanacearum as assessed by PCR-RFLP of the hrp gene region, AFLP and 16S rRNA sequence 
+  analysis, and identification of an African subdivision.
+  Microbiology 2000 146:1679-1692.
+  
+  T. A. Saari,  S. K. Saari, C. D. Campbell, I. J Alexander, I. C. Anderson.
+  FragMatch - a program for the analysis of DNA fragment data.
+  Mycorrhiza 2007, 17:133-136
 }
 \examples{
 data(RFLPdata)

Modified: pkg/RFLPtools/man/BLASTdata.Rd
===================================================================
--- pkg/RFLPtools/man/BLASTdata.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/BLASTdata.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -41,6 +41,10 @@
   Blast News: http://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastNews
   
   BioEdit v7.0.9: Tom Hall, Ibis Biosciences; http://www.mbio.ncsu.edu/BioEdit/bioedit.html
+  
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
 }
 \examples{
 data(BLASTdata)

Added: pkg/RFLPtools/man/FragMatch.Rd
===================================================================
--- pkg/RFLPtools/man/FragMatch.Rd	                        (rev 0)
+++ pkg/RFLPtools/man/FragMatch.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,52 @@
+\name{FragMatch}
+\alias{FragMatch}
+\title{
+  Compute matches for RFLP data via FragMatch.
+}
+\description{
+  Compute matches for RFLP data using FragMatch - a program for the analysis of DNA 
+  fragment data.
+}
+\usage{
+FragMatch(newData, refData, maxValue = 1000, errorBound = 25,
+          weight = 1, na.rm = TRUE)
+}
+\arguments{
+  \item{newData}{ data.frame with new RFLP data; see \code{\link{newDataGerm}}.}
+  \item{refData}{ data.frame with reference RFLP data; see \code{\link{refDataGerm}}.}
+  \item{maxValue}{ numeric: maximum value for which the error bound is applied. 
+                   Can be a vector of length larger than 1.}
+  \item{errorBound}{ numeric: error bound corresponding to \code{maxValue}. 
+                     Can be a vector of length larger than 1.}
+  \item{weight}{ numeric: weight for weighting partial matches; see details section.}
+  \item{na.rm}{ logical: indicating whether NA values should be stripped before the 
+                computation proceeds.}
+}
+\details{
+  A rather simple algorithm which consists of counting the number of matches where
+  it is considered a match if the value is inside a range of +/- \code{errorBound}.
+  
+  If there is more than one enzyme, one can use weights to give the partial perfect 
+  matches for a certain enzyme a higher (or also smaller) weight.
+}
+\value{
+  A character matrix with entries of the form \code{"a_b"} which means that there
+  were \code{a} out of \code{b} possible matches.
+}
+\references{
+  T. A. Saari,  S. K. Saari, C. D. Campbell, I. J Alexander, I. C. Anderson.
+  FragMatch - a program for the analysis of DNA fragment data.
+  Mycorrhiza 2007, 17:133-136
+}
+\author{ 
+  Matthias Kohl \email{Matthias.Kohl at stamats.de} 
+}
+%\note{}
+\seealso{ \code{\link{newDataGerm}}, \code{\link{refDataGerm}} }
+\examples{
+  data(refDataGerm)
+  data(newDataGerm)
+  
+  res <- FragMatch(newDataGerm, refDataGerm)
+}
+\keyword{multivariate}

Added: pkg/RFLPtools/man/RFLPcombine.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPcombine.Rd	                        (rev 0)
+++ pkg/RFLPtools/man/RFLPcombine.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,47 @@
+\name{RFLPcombine}
+\alias{RFLPcombine}
+\title{
+  Combine RFLP data sets
+}
+\description{
+  Function to combine an arbitrary number of RFLP data sets.
+}
+\usage{
+RFLPcombine(\dots)
+}
+\arguments{
+  \item{\dots}{ two or more data.frames with RFLP data.}
+}
+\details{
+  The data sets are combined using \code{\link{rbind}}.
+  
+  If data sets with identical sample identifiers are given, the
+  identifiers are made unique using \code{\link{make.unique}}.
+}
+\value{
+  A \code{data.frame} with variables
+  \describe{
+    \item{\code{Sample}}{character: sample identifier. }
+    \item{\code{Band}}{integer: band number. }
+    \item{\code{MW}}{integer: molecular weight. }
+    \item{\code{Gel}}{character: gel identifier. }
+  }
+}
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
+\author{ 
+  Fabienne Flessa \email{Fabienne.Flessa at uni-bayreuth.de},\cr
+  Alexandra Kehl \email{Alexandra.Kehl at botgarten.uni-tuebingen.de},\cr
+  Matthias Kohl \email{Matthias.Kohl at stamats.de} 
+}
+%\note{}
+\seealso{ \code{\link{RFLPdata}} }
+\examples{
+data(RFLPdata)
+res <- RFLPcombine(RFLPdata, RFLPdata, RFLPdata)
+RFLPplot(res, nrBands = 4)
+}
+\keyword{manip}

Modified: pkg/RFLPtools/man/RFLPdata.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPdata.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPdata.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -23,7 +23,11 @@
 \source{
   The data set was generated by F. Flessa.
 }
-%\references{ ??? }
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
 \examples{
 data(RFLPdata)
 str(RFLPdata)

Modified: pkg/RFLPtools/man/RFLPdist.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPdist.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPdist.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -8,7 +8,7 @@
   the distance between the molecular weights is computed.
 }
 \usage{
-RFLPdist(x, distfun = dist, nrBands)
+RFLPdist(x, distfun = dist, nrBands, LOD = 0)
 }
 \arguments{
   \item{x}{ data.frame with RFLP data; see \code{\link{RFLPdata}}.}
@@ -16,6 +16,7 @@
   cf. \code{\link[stats]{dist}}.}
   \item{nrBands}{ if not missing, then only samples with the specified number
   of bands are considered. }
+  \item{LOD}{ threshold for low-bp bands. }
 }
 \details{
   For each number of bands the given distance between the molecular weights is computed. 
@@ -23,6 +24,9 @@
   bands which occur in each group.
   
   If \code{nrBands} is specified only samples with this number of bands are considered.
+  
+  If \code{LOD > 0} is specified, all values below \code{LOD} are removed before the 
+  distances are calculated.
 }
 \value{
   A named list with the distances; see \code{\link[stats]{dist}}.
@@ -30,6 +34,10 @@
   In case \code{nrBands} is not missing, an object of S3 class \code{dist}.
 }
 \references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+  
   Poussier, Stephane; Trigalet-Demery, Danielle; Vandewalle, Peggy; Goffinet, Bruno; Luisetti, Jacques; Trigalet, Andre.
   Genetic diversity of Ralstonia solanacearum as assessed by PCR-RFLP of the hrp gene region, AFLP and 16S rRNA sequence 
   analysis, and identification of an African subdivision.

Modified: pkg/RFLPtools/man/RFLPdist2.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPdist2.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPdist2.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -13,7 +13,7 @@
   argument \code{nrMissing}.
 }
 \usage{
-RFLPdist2(x, distfun = dist, nrBands, nrMissing, LOD,
+RFLPdist2(x, distfun = dist, nrBands, nrMissing, LOD = 0,
           diag = FALSE, upper = FALSE)
 }
 \arguments{
@@ -32,7 +32,7 @@
   all samples with number of bands in nrBands, nrBands+1, ..., nrBands+nrMissing
   are compared. 
 
-  If \code{LOD} is specified, it is assumed that missing bands can only occur for
+  If \code{LOD > 0} is specified, it is assumed that missing bands can only occur for
   molecular weights smaller than \code{LOD}. As a consequence only samples which 
   have \code{nrBands} bands with molecular weight larger or equal to \code{LOD} are
   selected.
@@ -42,7 +42,7 @@
   and the molecular weight of all possible subsets of S2 with x bands are computed.
   The distance between S1 and S2 is then defined as the minimum of all these distances.
   
-  If \code{LOD} is specified, only all combinations of values below \code{LOD} are 
+  If \code{LOD > 0} is specified, only all combinations of values below \code{LOD} are 
   considered.
   
   This option may be useful, if gel image quality is low, and the detection of bands 
@@ -52,6 +52,10 @@
   An object of class \code{"dist"} returned; cf. \code{\link[stats]{dist}}.
 }
 \references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+  
   Ian A. Dickie, Peter G. Avis, David J. McLaughlin, Peter B. Reich. 
   Good-Enough RFLP Matcher (GERM) program.
   Mycorrhiza 2003, 13:171-172.

Modified: pkg/RFLPtools/man/RFLPdist2ref.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPdist2ref.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPdist2ref.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -7,7 +7,7 @@
   Function to compute distance between RFLP data and RFLP reference data.
 }
 \usage{
-RFLPdist2ref(x, ref, distfun = dist, nrBands)
+RFLPdist2ref(x, ref, distfun = dist, nrBands, LOD = 0)
 }
 \arguments{
   \item{x}{ data.frame with RFLP data; e.g. \code{\link{RFLPdata}}.}
@@ -16,17 +16,25 @@
   cf. \code{\link[stats]{dist}}.}
   \item{nrBands}{ only samples and reference samples with this number
   of bands are considered. }
+  \item{LOD}{ threshold for low-bp bands. }
 }
 \details{
   For each sample with \code{nrBands} bands the distance to each reference 
   sample with \code{nrBands} bands is computed. The result is a matrix with 
   the corresponding distances where rows represent the samples and columns
   the reference samples.
+  
+  If \code{LOD > 0} is specified, all values below \code{LOD} are removed before the 
+  distances are calculated. This applies to \code{x} and \code{ref}.
 }
 \value{
   A matrix with distances.
 }
-%\references{ ??? }
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
 \author{ 
   Fabienne Flessa \email{Fabienne.Flessa at uni-bayreuth.de},\cr
   Alexandra Kehl \email{Alexandra.Kehl at botgarten.uni-tuebingen.de},\cr

Added: pkg/RFLPtools/man/RFLPlod.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPlod.Rd	                        (rev 0)
+++ pkg/RFLPtools/man/RFLPlod.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -0,0 +1,52 @@
+\name{RFLPlod}
+\alias{RFLPlod}
+\title{
+  Remove bands below LOD
+}
+\description{
+  Function to exclude bands below a given LOD.
+}
+\usage{
+RFLPlod(x, LOD)
+}
+\arguments{
+  \item{x}{ data.frame with RFLP data.}
+  \item{LOD}{ threshold for low-bp bands.}
+}
+\details{
+  Low-bp bands may be regarded as unreliable. Function 
+  \code{RFLPlod} can be used to exclude such bands, which
+  are likely to be absent in some other samples, before
+  further analyses.
+}
+\value{
+  A \code{data.frame} with variables
+  \describe{
+    \item{\code{Sample}}{character: sample identifier. }
+    \item{\code{Band}}{integer: band number. }
+    \item{\code{MW}}{integer: molecular weight. }
+    \item{\code{Gel}}{character: gel identifier. }
+  }
+}
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
+\author{ 
+  Fabienne Flessa \email{Fabienne.Flessa at uni-bayreuth.de},\cr
+  Alexandra Kehl \email{Alexandra.Kehl at botgarten.uni-tuebingen.de},\cr
+  Matthias Kohl \email{Matthias.Kohl at stamats.de} 
+}
+%\note{}
+\seealso{ \code{\link{RFLPdata}} }
+\examples{
+data(RFLPdata)
+## remove bands with MW smaller than 60
+RFLPdata.lod <- RFLPlod(RFLPdata, LOD = 60)
+par(mfrow = c(1, 2))
+RFLPplot(RFLPdata, nrBands = 4, ylim = c(40, 670))
+RFLPplot(RFLPdata.lod, nrBands = 4, ylim = c(40, 670))
+title(sub = "After applying RFLPlod")
+}
+\keyword{manip}

Modified: pkg/RFLPtools/man/RFLPplot.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPplot.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPplot.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -28,7 +28,7 @@
   \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}}. }
+  \code{\link[RColorBrewer]{ColorBrewer}}. }
   \item{xlab}{ passed to function \code{\link[graphics]{plot}}. }
   \item{ylab}{ passed to function \code{\link[graphics]{plot}}. }
   \item{ylim}{ passed to function \code{\link[graphics]{plot}}. If missing an appropriate
@@ -44,7 +44,11 @@
   and the detection of bands is doubtful.
 }
 \value{invisible}
-%\references{ ??? }
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
 \author{ 
   Fabienne Flessa \email{Fabienne.Flessa at uni-bayreuth.de},\cr
   Alexandra Kehl \email{Alexandra.Kehl at botgarten.uni-tuebingen.de},\cr

Modified: pkg/RFLPtools/man/RFLPqc.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPqc.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPqc.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -46,7 +46,11 @@
     \item{\code{Gel}}{character: gel identifier. }
   }
 }
-%\references{ ??? }
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
 \author{ 
   Fabienne Flessa \email{Fabienne.Flessa at uni-bayreuth.de},\cr
   Alexandra Kehl \email{Alexandra.Kehl at botgarten.uni-tuebingen.de},\cr

Modified: pkg/RFLPtools/man/RFLPref.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPref.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPref.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -5,7 +5,7 @@
 \description{
   This is an example data set for RFLP reference.
 }
-\usage{data(RFLPdata)}
+\usage{data(RFLPref)}
 \format{
   A data frame with 35 observations on the following five variables
   \describe{
@@ -25,7 +25,11 @@
 \source{
   The data set was generated by F. Flessa.
 }
-%\references{ ??? }
+\references{
+  Flessa, F., Kehl, A., Kohl, M.
+  Analysing diversity and community structures using PCR-RFLP: a new software application.
+  Molecular Ecology Resources 2013 Jul; 13(4):726-33. 
+}
 \examples{
 data(RFLPref)
 str(RFLPref)

Modified: pkg/RFLPtools/man/RFLPrefplot.Rd
===================================================================
--- pkg/RFLPtools/man/RFLPrefplot.Rd	2013-01-04 16:42:46 UTC (rev 14)
+++ pkg/RFLPtools/man/RFLPrefplot.Rd	2014-03-02 14:16:11 UTC (rev 15)
@@ -26,7 +26,7 @@
   \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}}. }
+  \code{\link[RColorBrewer]{ColorBrewer}}. }
   \item{xlab}{ passed to function \code{\link[graphics]{plot}}. }
   \item{ylab}{ passed to function \code{\link[graphics]{plot}}. }
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rflptools -r 15


More information about the Rflptools-commits mailing list