[Picante-commits] r186 - / pkg pkg/R pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 21 20:47:42 CEST 2009


Author: skembel
Date: 2009-05-21 20:47:41 +0200 (Thu, 21 May 2009)
New Revision: 186

Added:
   www/picante.jpg
Modified:
   TODO
   pkg/DESCRIPTION
   pkg/R/phylodiversity.R
   pkg/R/traitgram.R
   pkg/man/comm.phylo.cor.Rd
   pkg/man/comm.phylo.qr.Rd
   pkg/man/pd.Rd
   pkg/man/pic3.Rd
   pkg/man/picante-package.Rd
   www/index.php
Log:
Numerous changes for 0.7-0: modify pd, add abundance weighting to mpd/mntd, change mnnd to mntd, bugfix in comm.phylo.corr, add quantile regression in comm.phylo.qr, update website

Modified: TODO
===================================================================
--- TODO	2009-04-24 23:19:24 UTC (rev 185)
+++ TODO	2009-05-21 18:47:41 UTC (rev 186)
@@ -1,22 +1,10 @@
 TODO list for picante package
-
-General notes: Many functions are untested. Do not use any of these functions for 'real' analysis without getting in touch with a project developer first.
-
-TODO
 ====
-For 0.1
--------
--improve documentation for public release
 -data name checking and matching - currently many functions expect data to have names that match e.g. phylo$tip.labels, should handle/check lack of names and warn. Write helper function.
-
-For 0.2 and beyond
--------
 -reinstate function to call out to phylocom executable and read results back in to R
--implement null model heavy lifting in C code - see BB's email for a start
 -allow trait data to be a vector or a data.frame (single or multiple columns)
--implement contrib index and similar
--move to phylobase format
--qr on com.phylo.corr as option
+-implement contribution index, nodesig, and similar node-based statistics from phylocom
+-work with phylobase/xml format trees/data
 -trait gradient analysis and contrast diagnostics functions from DDA
 -taxaShuffle and comstruct functions - rewrite to use indices in place of names for efficiency
 -vignettes

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/DESCRIPTION	2009-05-21 18:47:41 UTC (rev 186)
@@ -2,7 +2,7 @@
 Type: Package
 Title: R tools for integrating phylogenies and ecology
 Version: 0.7-0
-Date: 2009-4-3
+Date: 2009-5-18
 Author: Steven Kembel <skembel at uoregon.edu>, David Ackerly <dackerly at berkeley.edu>, Simon Blomberg <s.blomberg1 at uq.edu.au>, Peter Cowan <pdc at berkeley.edu>, Matthew Helmus <mrhelmus at wisc.edu>, Helene Morlon  <morlon.helene at gmail.com>, Campbell Webb <cwebb at oeb.harvard.edu>
 Maintainer: Steven Kembel <skembel at uoregon.edu>
 Depends: ape, vegan, nlme

Modified: pkg/R/phylodiversity.R
===================================================================
--- pkg/R/phylodiversity.R	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/R/phylodiversity.R	2009-05-21 18:47:41 UTC (rev 186)
@@ -36,7 +36,7 @@
 
 
 `comm.phylo.qr` <-
-function(samp,phylo,metric=c("cij","checkerboard","jaccard","roij"),
+function(samp,phylo,metric=c("cij","checkerboard","jaccard","doij"),
 		null.model=c("sample.taxa.labels","pool.taxa.labels",
 					"frequency","richness","independentswap","trialswap"),
 					quant=0.75, runs=999, show.plot=FALSE, ...)
@@ -532,76 +532,54 @@
   }
 }
 
-pd<-function(samp, tree, include.root=TRUE) {
-
-    #If phylo has no branch lengths
-    if(is.null(tree$edge.length)) {
+pd <- function (samp, tree, include.root = TRUE) 
+{
+    if (is.null(tree$edge.length)) {
         stop("Tree has no branch lengths, cannot compute pd")
     }
-    
-    # numbers of locations and species
-    species<-colnames(samp)
-    SR <- rowSums(ifelse(samp>0,1,0))
-    nlocations=dim(samp)[1]
-    nspecies=dim(samp)[2]
-    
-    ##################################
-    # calculate observed PDs
-    #
-    PDs=NULL
-    
-    for(i in 1:nlocations)
-    {  
-        
-        present<-species[samp[i,]>0]    #species in sample
-        treeabsent <- tree$tip.label[which(!(tree$tip.label %in% present))]    
-        
-        if(length(present)==0)
-        {
-            #no species present
-            PD<-0
+    species <- colnames(samp)
+    SR <- rowSums(ifelse(samp > 0, 1, 0))
+    nlocations = dim(samp)[1]
+    nspecies = dim(samp)[2]
+    PDs = NULL
+    for (i in 1:nlocations) {
+        present <- species[samp[i, ] > 0]
+        treeabsent <- tree$tip.label[which(!(tree$tip.label %in% 
+            present))]
+        if (length(present) == 0) {
+            PD <- 0
         }
-        else if(length(present)==1)
-        {
-        
-            #one species present - PD = length from root to that tip
+        else if (length(present) == 1) {
             if (!is.rooted(tree) || !include.root) {
                 warning("Rooted tree and include.root=TRUE argument required to calculate PD of single-species sampunities. Single species sampunity assigned PD value of NA.")
                 PD <- NA
             }
             else {
-                #one species present - PD = length from root to that tip        
-                PD <- node.age(tree)$ages[ which(tree$edge[,2] == 
-                                        which(tree$tip.label==present))]
+                PD <- node.age(tree)$ages[which(tree$edge[, 2] == 
+                  which(tree$tip.label == present))]
             }
         }
-        else if(length(treeabsent)==0)
-        {
-            #all species in tree present in sampunity
+        else if (length(treeabsent) == 0) {
             PD <- sum(tree$edge.length)
         }
-        else    
-        {
-            #subset of tree species present in sampunity
-            sub.tree<-drop.tip(tree,treeabsent) 
+        else {
+            sub.tree <- drop.tip(tree, treeabsent)
             if (include.root) {
-                if (!is.rooted(tree) || !is.ultrametric(tree)) {
-                    stop("Rooted ultrametric tree required to calculate PD with include.root=TRUE argument")
+                if (!is.rooted(tree)) {
+                  stop("Rooted tree required to calculate PD with include.root=TRUE argument")
                 }
                 sub.tree.depth <- max(node.age(sub.tree)$ages)
-                orig.tree.depth <- max(node.age(tree)$ages)
-                PD<-sum(sub.tree$edge.length) + (orig.tree.depth-sub.tree.depth)        
+                orig.tree.depth <- max(node.age(tree)$ages[which(tree$edge[,2] %in% which(tree$tip.label %in% present))])
+                PD <- sum(sub.tree$edge.length) + (orig.tree.depth - 
+                  sub.tree.depth)
             }
             else {
-                PD<-sum(sub.tree$edge.length)
+                PD <- sum(sub.tree$edge.length)
             }
         }
-        
-        PDs<-c(PDs,PD)
+        PDs <- c(PDs, PD)
     }
-    
-    PDout<-data.frame(PD=PDs,SR=SR)
-    rownames(PDout)<-rownames(samp) 
+    PDout <- data.frame(PD = PDs, SR = SR)
+    rownames(PDout) <- rownames(samp)
     return(PDout)
-
 }

Modified: pkg/R/traitgram.R
===================================================================
--- pkg/R/traitgram.R	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/R/traitgram.R	2009-05-21 18:47:41 UTC (rev 186)
@@ -7,7 +7,7 @@
 	xaxt='s',
 	underscore = FALSE,
 	show.names = TRUE,
-	show.xaxis.vals = TRUE,
+	show.xaxis.values = TRUE,
 	method = c('ace','pic'),
 	...) 
 	
@@ -35,7 +35,7 @@
 		} else umar = 0.1
 
 	lmar = 0.2
-	if (xaxt=='s') if (show.xaxis.vals) lmar = 1 else lmar = 0.5
+	if (xaxt=='s') if (show.xaxis.values) lmar = 1 else lmar = 0.5
 	if (method[1]=='ace') xanc = ace(xx,phy)$ace 
 		else xanc = pic3(xx,phy)[,3]
 	xall = c(xx,xanc)
@@ -54,7 +54,7 @@
 	plot(range(c(x0,x1)),range(c(a0,a1)),
 		type='n',xaxt='n',yaxt='n',
 		xlab='',ylab='',bty='n',ylim=ylim,cex.axis=0.8)
-	if (xaxt=='s') if (show.xaxis.vals) axis(1,labels=TRUE) 
+	if (xaxt=='s') if (show.xaxis.values) axis(1,labels=TRUE) 
 		else axis(1,labels=FALSE)
 	segments(x0,a0,x1,a1)
 	if (show.names) {

Modified: pkg/man/comm.phylo.cor.Rd
===================================================================
--- pkg/man/comm.phylo.cor.Rd	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/man/comm.phylo.cor.Rd	2009-05-21 18:47:41 UTC (rev 186)
@@ -6,7 +6,7 @@
   Calculates measures of community phylogenetic structure (correlation between co-occurrence and phylogenetic distance) to patterns expected under various null models
 }
 \usage{
-comm.phylo.cor(samp, phylo, metric = c("cij", "checkerboard", "jaccard", "roij"),
+comm.phylo.cor(samp, phylo, metric = c("cij", "checkerboard", "jaccard", "doij"),
     null.model = c("sample.taxa.labels", "pool.taxa.labels",
         "frequency", "richness", "independentswap","trialswap"), runs = 999, ...)
 }

Modified: pkg/man/comm.phylo.qr.Rd
===================================================================
--- pkg/man/comm.phylo.qr.Rd	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/man/comm.phylo.qr.Rd	2009-05-21 18:47:41 UTC (rev 186)
@@ -6,7 +6,7 @@
   Calculates measures of community phylogenetic structure (quantile regression  between co-occurrence and phylogenetic distance) to patterns expected under various null models
 }
 \usage{
-comm.phylo.qr(samp, phylo, metric = c("cij", "checkerboard", "jaccard", "roij"),
+comm.phylo.qr(samp, phylo, metric = c("cij", "checkerboard", "jaccard", "doij"),
     null.model = c("sample.taxa.labels", "pool.taxa.labels",
         "frequency", "richness", "independentswap","trialswap"), 
         quant = 0.75, runs = 999, show.plot = FALSE, ...)
@@ -51,6 +51,5 @@
 \seealso{ \code{\link{randomizeSample}} }
 \examples{
 data(phylocom)
-comm.phylo.qr(phylocom$sample, phylocom$phylo, metric="cij",null.model="sample.taxa.labels",
-show.plot=TRUE)}
+comm.phylo.qr(phylocom$sample, phylocom$phylo, metric="cij",null.model="sample.taxa.labels")}
 \keyword{univar}

Modified: pkg/man/pd.Rd
===================================================================
--- pkg/man/pd.Rd	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/man/pd.Rd	2009-05-21 18:47:41 UTC (rev 186)
@@ -22,13 +22,13 @@
 \note{
 The data sets need not be species-community data sets but may be any sample data set with an associated phylogeny. PD is not statistically independent of species richness, it positively correlates with species richness across samples.
 
-If the root is to be included in all calculations of PD (\code{include.root=TRUE}), the tree must be rooted and ultrametric. Single-species samples will be assigned a PD value equal to the distance from the root to the present.
+If the root is to be included in all calculations of PD (\code{include.root=TRUE}), the tree must be rooted. Single-species samples will be assigned a PD value equal to the distance from the root to the present.
 
-If the root is not included in all calculations by default (\code{include.root=FALSE}), the tree need not be ultrametric or rooted, but in the case of single-species samples the PD will be equal to NA and a warning will be issued.
+If the root is not included in all calculations by default (\code{include.root=FALSE}), the tree need not rooted, but in the case of single-species samples the PD will be equal to NA and a warning will be issued.
 
 }
 \section{Warning }{
-If the root is to be included in all calculations (\code{include.root=TRUE}), the PD of all samples will include the branch length connecting taxa in those samples and the root of the supplied tree. The root of the supplied tree may not be spanned by any taxa in the sample. If you want the root of your tree to correspond to the most recent ancestor of the taxa actually present in your sample, you should prune the tree before running \code{pd}:
+If the root is to be included in all calculations (\code{include.root=TRUE}), the PD of all samples will include the branch length connecting taxa in those samples and the root node of the supplied tree. The root of the supplied tree may not be spanned by any taxa in the sample. If you want the root of your tree to correspond to the most recent ancestor of the taxa actually present in your sample, you should prune the tree before running \code{pd}:
 
 \code{prunedTree <- prune.sample(sample,tree)}
 }

Modified: pkg/man/pic3.Rd
===================================================================
--- pkg/man/pic3.Rd	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/man/pic3.Rd	2009-05-21 18:47:41 UTC (rev 186)
@@ -13,7 +13,7 @@
   \item{x}{ Trait vector (same order as phy\$tip.label) }
   \item{phy}{ phylo object }
   \item{scaled}{ TRUE = standardize contrasts by branch lengths }
-  \item{...}{ TRUE = return variance of contrasts }
+  \item{var.contrasts}{ TRUE = return variance of contrasts }
 }
 \value{
  Matrix with three columns:
@@ -28,7 +28,7 @@
 Garland T, Jr, Harvey PH & Ives AR (1992) Procedures for the analysis of comparative data using phylogenetically independent contrasts.  Systematic  Biology 41: 18-32.
  }
 \author{ Original pic function by Emmanuel Paradis <Emmanuel.Paradis at mpl.ird.fr> modified to return node.vals by David Ackerly <dackerly at berkeley.edu> }
-\seealso{ \code{\link{pic}} }
+\seealso{ \code{\link[ape]{pic}} }
 \section{Warning }{ Assumes that trait data are sorted in the same order as phylo\$tip.label }
 \examples{
 randtree <- rcoal(20)

Modified: pkg/man/picante-package.Rd
===================================================================
--- pkg/man/picante-package.Rd	2009-04-24 23:19:24 UTC (rev 185)
+++ pkg/man/picante-package.Rd	2009-05-21 18:47:41 UTC (rev 186)
@@ -3,7 +3,7 @@
 \alias{picante}
 \docType{package}
 \title{
-Picante: Phylocom Integration, Community Analyses, Null-models, Traits, and Evolution in R
+picante: R tools for integrating phylogenies and ecology
 }
 \description{
 R tools for integrating phylogenies and ecology
@@ -13,7 +13,7 @@
 Package: \tab picante\cr
 Type: \tab Package\cr
 Version: \tab 0.7-0\cr
-Date: \tab 2009-4-3\cr
+Date: \tab 2009-5-18\cr
 License: \tab GPL-2\cr
 }
 }

Modified: www/index.php
===================================================================
--- www/index.php	2009-04-24 23:19:24 UTC (rev 185)
+++ www/index.php	2009-05-21 18:47:41 UTC (rev 186)
@@ -24,35 +24,42 @@
 <body>
 
 <!-- own website starts here, the following may be changed as you like -->
-<h1>picante</h1>
-<h2><strong>P</strong>hylocom <strong>i</strong>ntegration, <strong>c</strong>ommunity <strong>a</strong>nalyses, <strong>n</strong>ull-models, <strong>t</strong>raits and <strong>e</strong>volution in R</h2>
-
+<h1 align="center">picante: R tools for integrating phylogenies and ecology</h1>
 <!-- end of project description -->
+<img border=3 src="picante.jpg" alt="picante traitgram" align="right" />
 <h2>About picante</h2>
-<p>The picante package aims to provide a comprehensive set of tools for analyzing the phylogenetic and trait diversity of ecological communities in R, along with other comparative analyses and manipulations of phenotypic and phylogenetic data.</p>
+<p>The picante package provides tools for <strong>P</strong>hylocom <strong>i</strong>ntegration, <strong>c</strong>ommunity <strong>a</strong>nalyses, <strong>n</strong>ull-models, <strong>t</strong>raits and <strong>e</strong>volution in R.</p>
+<p>The package includes functions for analyzing the phylogenetic and trait diversity of ecological communities, comparative analyses, and the display and manipulation of phenotypic and phylogenetic data.</p>
 <p><strong>Package maintainer:</strong> Steven Kembel</p>
 <p><strong>Developers:</strong> Peter Cowan, Matthew Helmus, Steven Kembel</p>
 <p><strong>Contributors:</strong> David Ackerly, Simon Blomberg, Peter Cowan,
-    Matthew Helmus, Steven Kembel, Helene Morlon, Cam Webb<p>
+    Matthew Helmus, Steven Kembel, Helene Morlon, Cam Webb<p>    
 <p>Development of picante has been supported by <a href="http://nserc.ca">NSERC</a>, <a href="http://www.nescent.org/index.php">NESCent</a>, and the <a href="http://code.google.com/soc/2008/">Google Summer of Code</a>.</p>
+<p>Thanks to Kyle Dexter, Catherine Graham, Nathaniel Hallinan, Nick Matzke, Alain Paquette, Juan Parra, and Marten Winter for feedback and bug reports.</p>
 
 <h2>News</h2>
 <ul>
-<li>The pd and phylosor functions in version 0.5 of picante could result in incorrect calculation of phylosor in cases where the supplied phylogeny included taxa not present in any sample, or when pairs of samples collectively contained all taxa in the phylogeny. These functions have been updated in version 0.6, please see the documentation for more information about how PD and phylosor are calculated.</li>
-<li>Thanks to Catherine Graham, Nathaniel Hallinan, Nick Matzke, Alain Paquette, Juan Parra, and Marten Winter for feedback and bug reports.</li>
+<li>Several changes and new features in version 0.7
+<ul>
+<li>Added phylobeta diversity measures (comdist/comdistnt) and abundance-weighted phylognetic diversity (mpd/mntd)</li>
+<li>Added quantile regressions of co-occurrence vs. phylogenetic distance (comm.phylo.qr)</li>
+<li>Plot continuous trait values as tips of a phylogeny (traitgram)</li>
+<li>The mnnd and ses.mnnd functions have been renamed to mntd and ses.mntd, respectively, for consistency with naming conventions in <a href="http://phylodiversity.net/phylocom">Phylocom</a>.</li>
+</ul>
 </li>
+<li>The pd and phylosor functions in version 0.5 of picante could result in incorrect calculation of phylosor in cases where the supplied phylogeny included taxa not present in any sample, or when pairs of samples collectively contained all taxa in the phylogeny. These functions have been updated in versions of picante >0.5, please see the documentation for more information about how PD and phylosor are calculated.</li>
 </ul>
 
 <h2>Current features</h2>
 <ul>
-<li>Community phylogenetic and trait similarity measures</li>
+<li>Community phylogenetic and trait diversity</li>
     <ul>
-    <li>Webb's NRI/NTI and related measures of standardized effect size of community structure</li>
-    <li>Mean pairwise distance and mean distance to nearest neighbour among co-occurring species (can be used with any interspecific distance measure)</li>
-    <li>Correlations between species co-occurrence and phylogenetic distances</li>
-    <li>Phylogenetic diversity measures of Helmus et al. (2007).</li>
+    <li>Webb's NRI/NTI and related measures of standardized effect size of community phylogenetic structure</li>
+    <li>Mean pairwise distance and mean distance to nearest taxon among co-occurring species (can be used with any interspecific distance measure). Distances can be calculated based on presence or abundance in samples.</li>
+    <li>Correlations and quantile regressions between species co-occurrence and phylogenetic distances</li>
+    <li>Phylogenetic species richness, evenness and variance of Helmus et al. (2007).</li>
     <li>Phylogenetic community-environment regressions of Helmus et al. (2007).</li>
-    <li>Phylogenetic beta diversity measures (phylosor of Bryant et al. 2008).</li>
+    <li>Phylogenetic beta diversity measures (phylosor, betaMPD, betaMNTD).</li>
     </ul>
 <li>Phylogenetic signal (Blomberg <em>et al.</em>'s K statistic and P-value based on randomization test)</li>
 <li>Independent contrasts for traits with circular distributions</li>
@@ -74,7 +81,7 @@
 
 <h2>Obtaining picante</h2>
 <ul>
-<li>Version 0.6 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 0.7 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>
 
@@ -83,6 +90,7 @@
 
 <h2>Release history</h2>
 <p><ul>
+<li>Version 0.7: comm.phylo.qr function (quantile regression of co-occurrence and phylogenetic distance). traitgram function. Changed mnnd terminology to mntd. Added phylogenetic beta diversity measures comdist/comdistnt. Abundance weighting of mpd/mntd.
 <li>Version 0.6: Bugfix release. Changes to pd and phylosor functions.</li>
 <li>Version 0.5: Phylogenetic beta diversity measures (phylosor) with randomization testing.</li>
 <li>Version 0.4: New features and greatly improved speed of community randomizations (randomizeSample). New phylogenetic bipartite linear models functionality added.</li>
@@ -95,7 +103,7 @@
 <! --- R-Forge Logo --- >
 <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr><td ALIGN="center">
-<a href="/"><img src="<?php echo $themeroot; ?>/images/logo.png" border="0" alt="R-Forge Logo" /> </a> </td>
+<a href="http://r-forge.r-project.org"><img src="<?php echo $themeroot; ?>/images/logo.png" border="0" alt="R-Forge" /> </a> </td>
 <td ALIGN="center"><a href="http://www4.clustrmaps.com/counter/maps.php?url=http://picante.r-forge.r-project.org/" id="clustrMapsLink"><img src="http://www4.clustrmaps.com/counter/index2.php?url=http://picante.r-forge.r-project.org/" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onerror="this.onerror=null; this.src='http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://www2.clustrmaps.com';" />
 </a></td>
 </tr>

Added: www/picante.jpg
===================================================================
(Binary files differ)


Property changes on: www/picante.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Picante-commits mailing list