[Picante-commits] r237 - pkg pkg/R pkg/man www
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 21 18:28:07 CEST 2012
Author: skembel
Date: 2012-09-21 18:28:07 +0200 (Fri, 21 Sep 2012)
New Revision: 237
Removed:
pkg/R/pic.circular.R
pkg/man/pic.circular.Rd
Modified:
pkg/DESCRIPTION
pkg/R/pic3.R
pkg/man/picante-package.Rd
www/index.php
Log:
Fix foreign function call in pic3, remove pic.circular function.
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2012-09-04 17:21:41 UTC (rev 236)
+++ pkg/DESCRIPTION 2012-09-21 16:28:07 UTC (rev 237)
@@ -1,8 +1,8 @@
Package: picante
Type: Package
Title: R tools for integrating phylogenies and ecology
-Version: 1.4-0
-Date: 2012-8-28
+Version: 1.4-2
+Date: 2012-9-21
Author: Steven W. Kembel <skembel at uoregon.edu>, David D. Ackerly <dackerly at berkeley.edu>, Simon P. Blomberg <s.blomberg1 at uq.edu.au>, Will K. Cornwell <cornwell at zoology.ubc.ca>, Peter D. Cowan <pdc at berkeley.edu>, Matthew R. Helmus <mrhelmus at wisc.edu>, Helene Morlon <morlon.helene at gmail.com>, Campbell O. Webb <cwebb at oeb.harvard.edu>
Maintainer: Steven W. Kembel <skembel at uoregon.edu>
Depends: ape, vegan, nlme
Deleted: pkg/R/pic.circular.R
===================================================================
--- pkg/R/pic.circular.R 2012-09-04 17:21:41 UTC (rev 236)
+++ pkg/R/pic.circular.R 2012-09-21 16:28:07 UTC (rev 237)
@@ -1,110 +0,0 @@
-### pic.R (2008-02-02)
-###
-### Phylogenetically Independent Contrasts on circular data
-### an extension of the ape pic function
-###
-### Copyright 2008 Peter Cowan
-###
-### This file is *NOT* part of the R-package `ape'.
-
-### Orginal copyright
-### pic.R (2006-10-29)
-###
-### Phylogenetically Independent Contrasts
-###
-### Copyright 2002-2006 Emmanuel Paradis
-###
-### This file is part of the R-package `ape'.
-### See the file ../COPYING for licensing issues.
-
-`pic.circular` <-
-function(x, phy, scaled = TRUE, var.contrasts = FALSE)
-{
- if (!require(circular)) {stop("The 'circular' package is required for this function")}
- if (class(phy) != "phylo")
- stop("object 'phy' is not of class \"phylo\"")
- if (is.null(phy$edge.length))
- stop("your tree has no branch lengths: you may consider setting them equal
- to one, or using the function `compute.brlen'.")
- nb.tip <- length(phy$tip.label)
- nb.node <- phy$Nnode
- if (nb.node != nb.tip - 1)
- stop("'phy' is not rooted and fully dichotomous")
- if (length(x) != nb.tip)
- stop("length of phenotypic and of phylogenetic data do not match")
- if (any(is.na(x)))
- stop("the present method cannot (yet) be used directly with missing data:
- you may consider removing the species with missing data from your
- tree with the function `drop.tip'.")
- if(!is.circular(x))
- stop("This version for circular data only")
- phy <- reorder(phy, "pruningwise")
- phenotype <- as.circular(rep(NA, nb.tip + nb.node),
- units = 'radians', modulo = '2pi',
- rotation = 'counter', zero = 0, type = 'angles',
- template = 'none'
- )
- if (!is.null(names(x)) & all(names(x) %in% phy$tip.label)) {
- phenotype[1:nb.tip] <- x[phy$tip.label]
- } else {
- phenotype[1:nb.tip] <- x
- warning('the names of argument "x" and the names of the tip labels
- did not match: the former were ignored in the analysis.')
- }
-
- contr <- var.con <- numeric(nb.node)
-
- bl=phy$edge.length
-
- for (i in seq(from = 1, by = 2, length.out = nb.node)) {
- j <- i + 1
- anc <- phy$edge[i, 1]
- des1 <- phy$edge[i, 2]
- des2 <- phy$edge[j, 2]
- sumbl <- bl[i] + bl[j]
- ic <- anc - nb.tip
- ## get the differences between the decendant nodes
- tempcontr <- phenotype[des1] - phenotype[des2]
- abtemp <- abs(tempcontr)
- ## sanity check on the difference
- if(abtemp > (2 * pi)) {
- stop("ERROR. contrast between ", substitute(phenotype[des1] ),
- ' and ', substitute(phenotype[des2]), "is", substitute(tempcontr))
- }
- ## ensure that contrasts record the short distance
- ## if the diff is greater than pi recalculate
- ## then shorter side, while retaining directionality
- if(abtemp > pi) {
- if(phenotype[des1] > phenotype[des2]) {
- tempcontr <- tempcontr - (2 * pi)
- } else if(phenotype[des1] < phenotype[des2]) {
- tempcontr <- tempcontr + (2 * pi)
- } else {
- stop("Fatal Error", substitute(phenotype[des1] ),
- ' and ', substitute(phenotype[des2]), " is ", substitute(tempcontr))}
- }
- contr[ic] <- tempcontr
- if (scaled) contr[ic] <- contr[ic]/sqrt(sumbl)
- if (var.contrasts) var.con[ic] <- sumbl
-
- ## get vector components and weight by the branch lengths
- sin_des1 <- sin(as.numeric(phenotype[des1])) * bl[j]
- cos_des1 <- cos(as.numeric(phenotype[des1])) * bl[j]
-
- sin_des2 <- sin(as.numeric(phenotype[des2])) * bl[i]
- cos_des2 <- cos(as.numeric(phenotype[des2])) * bl[i]
-
- ## calculate the ancestral node value
- phenotype[anc] <- as.circular(atan2(sin_des1 + sin_des2, cos_des1 + cos_des2),
- type = "angles", units = "radians", template = "none",
- rotation = "counter", zero = 0, modulo = "2pi"
- )
- k <- which(phy$edge[, 2] == anc)
- bl[k] <- bl[k] + bl[i]*bl[j]/sumbl
-
- }
-
- # TODO check that the var.contrasts = T results are as expected
- names(contr) <- 1:nb.node + nb.tip
- contr
-}
Modified: pkg/R/pic3.R
===================================================================
--- pkg/R/pic3.R 2012-09-04 17:21:41 UTC (rev 236)
+++ pkg/R/pic3.R 2012-09-21 16:28:07 UTC (rev 237)
@@ -33,7 +33,7 @@
ans <- .C("pic", as.integer(nb.tip), as.integer(nb.node),
as.integer(phy$edge[, 1]), as.integer(phy$edge[, 2]),
as.double(phy$edge.length), as.double(phenotype), as.double(contr),
- as.double(var.con), as.integer(var.contrasts), as.integer(scaled),
+ as.double(var.con), as.integer(var.contrasts), as.integer(scaled),
PACKAGE = "ape")
contr <- ans[[7]]
if (var.contrasts) {
Deleted: pkg/man/pic.circular.Rd
===================================================================
--- pkg/man/pic.circular.Rd 2012-09-04 17:21:41 UTC (rev 236)
+++ pkg/man/pic.circular.Rd 2012-09-21 16:28:07 UTC (rev 237)
@@ -1,23 +0,0 @@
-\name{pic.circular}
-\alias{pic.circular}
-\title{Phylogenetic independent contrasts for circular data}
-\description{
- Computes the phylogenetic independent contrasts for traits with circular distributions}
-\usage{
-pic.circular(x, phy, scaled = TRUE, var.contrasts = FALSE)}
-\arguments{
- \item{x}{ A vector of class \code{circular, modulo = "2pi"} with length equal to \code{length(phy$edge.lable)} }
- \item{phy}{ An object of class \code{phylo} }
- \item{scaled}{ logical, indicates whether the contrasts should be scaled with their expected variance (default to \code{TRUE}). }
- \item{var.contrasts}{ logical, indicates whether the expected variance of the contrasts should be returned (default to \code{FALSE}) }
-}
-\details{
- If x has names, these are matched to the dataframe, otherwise values are expected to be in the same order and an error is issued.
-}
-\value{
- Vector of contrasts for trait \code{x} on phylogeny \code{phy}
-}
-
-\author{ Peter Cowan <pdc at berkeley.edu> based on the \code{ape} package \code{pic} function by Emmanuel Paradis}
-\keyword{univar}
-
Modified: pkg/man/picante-package.Rd
===================================================================
--- pkg/man/picante-package.Rd 2012-09-04 17:21:41 UTC (rev 236)
+++ pkg/man/picante-package.Rd 2012-09-21 16:28:07 UTC (rev 237)
@@ -12,8 +12,8 @@
\tabular{ll}{
Package: \tab picante\cr
Type: \tab Package\cr
-Version: \tab 1.4-0\cr
-Date: \tab 2012-8-28\cr
+Version: \tab 1.4-2\cr
+Date: \tab 2012-9-21\cr
License: \tab GPL-2\cr
}
}
Modified: www/index.php
===================================================================
--- www/index.php 2012-09-04 17:21:41 UTC (rev 236)
+++ www/index.php 2012-09-21 16:28:07 UTC (rev 237)
@@ -44,6 +44,7 @@
<li>Picante 1.4 has been released
<ul>
<li>The phylogenetic generalized linear mixed models of Ives and Helmus (2011) are now included in function pglmm</li>
+<li>The function <code>pic.circular<code> has been deprecated until further testing can be performed.</li>
</ul>
</li>
<li>Lots of changes and new features since version 1.0
@@ -91,7 +92,7 @@
<h2>Obtaining picante</h2>
<ul>
-<li>Version 1.4-0 is available on <a href="http://cran.r-project.org/">CRAN</a>. Simply type <strong><code>install.packages("picante")</code></strong> from within R.</li>
+<li>Version 1.4-2 is available on <a href="http://cran.r-project.org/">CRAN</a>. Simply type <strong><code>install.packages("picante")</code></strong> from within R.</li>
<li>You can grab the latest nightly build <a href="http://r-forge.r-project.org/R/?group_id=134">here</a>, or by typing <strong><code>install.packages("picante",repos="http://R-Forge.R-project.org")</code></strong> from within R.</li>
</ul>
@@ -108,7 +109,7 @@
<h2>Release history</h2>
<p><ul>
-<li>Version 1.4: Add pglmm methods from Ives & Helmus (2011). Correct typos in vignette and documentation.</li>
+<li>Version 1.4: Add pglmm methods from Ives & Helmus (2011). Correct typos in vignette and documentation. Remove pic.circular function until further testing can be performed.</li>
<li>Version 1.3: Add function pcd. Fix single-community error in pse.</li>
<li>Version 1.2: Bugfix release. Fix to evol.distinct function. Kcalc now behaves better with non-ultrametric trees.</li>
<li>Version 1.1-1: Minor update to address deprecation of evolve.phylo function in ape package; deleted evolve.brownian function and changed example code.</li>
More information about the Picante-commits
mailing list