[Picante-commits] r232 - pkg pkg/R pkg/inst pkg/inst/doc pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jul 18 23:06:09 CEST 2010


Author: skembel
Date: 2010-07-18 23:06:09 +0200 (Sun, 18 Jul 2010)
New Revision: 232

Modified:
   pkg/DESCRIPTION
   pkg/R/evol.distinct.R
   pkg/R/phylosignal.R
   pkg/inst/CITATION
   pkg/inst/doc/picante-intro.pdf
   pkg/man/picante-package.Rd
   www/index.php
Log:
Version 1.2 fix bug in evol.distinct improve Kcalc update website

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-07-01 16:47:44 UTC (rev 231)
+++ pkg/DESCRIPTION	2010-07-18 21:06:09 UTC (rev 232)
@@ -1,8 +1,8 @@
 Package: picante
 Type: Package
 Title: R tools for integrating phylogenies and ecology
-Version: 1.1-1
-Date: 2010-5-18
+Version: 1.2-0
+Date: 2010-7-18
 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

Modified: pkg/R/evol.distinct.R
===================================================================
--- pkg/R/evol.distinct.R	2010-07-01 16:47:44 UTC (rev 231)
+++ pkg/R/evol.distinct.R	2010-07-18 21:06:09 UTC (rev 232)
@@ -4,7 +4,8 @@
 #The scale option refers to whether or not the phylogeny should be scaled to a depth of 1 or, in the case of an ultrametric tree,  scaled such that branch lengths are relative.
 #If use.branch.lengths=FALSE, then all branch lengths are changed to 1.
 
-evol.distinct<- function(tree, type=c("equal.splits", "fair.proportion"), scale=FALSE, use.branch.lengths=TRUE){
+evol.distinct <- function(tree, type=c("equal.splits", "fair.proportion"),
+                            scale=FALSE, use.branch.lengths=TRUE){
 
 type <- match.arg(type)
 
@@ -33,15 +34,16 @@
 
 #apportion internal branch lengths appropriately
 if(length(internal.brlen)!=0){
-internal.brlen<- internal.brlen*switch(type,
-	"equal.splits"=	sort(rep(.5,length(internal.brlen))^c(1:length(internal.brlen))),
-	"fair.proportion"= 1/for(j in 1:length(nodes)){
-		sons<-.node.desc(tree, nodes[j])
-		n.descendents<- length(sons$tips)
-		if(j==1)
-		portion<- n.descendents else
-		portion<- c(n.descendents, portion)
-		})}
+   internal.brlen <- internal.brlen * switch(type, equal.splits = sort(rep(0.5, 
+        length(internal.brlen))^c(1:length(internal.brlen))), 
+        fair.proportion = {for (j in 1:length(nodes)) {
+          sons <- .node.desc(tree, nodes[j])
+          n.descendents <- length(sons$tips)
+          if (j == 1) 
+            portion <- n.descendents
+          else portion <- c(n.descendents, portion)
+        }; 1/portion})
+}
 	
 	#sum internal branch lengths with the pendant edge
 	ED<- sum(internal.brlen, tree$edge.length[which.edge(tree, spp)])
@@ -52,7 +54,7 @@
 	}
 results<- cbind(tree$tip.label, as.data.frame(w))
 names(results)<- c("Species", "w")
-results
+return(results)
 	
 	}
 	
\ No newline at end of file

Modified: pkg/R/phylosignal.R
===================================================================
--- pkg/R/phylosignal.R	2010-07-01 16:47:44 UTC (rev 231)
+++ pkg/R/phylosignal.R	2010-07-18 21:06:09 UTC (rev 232)
@@ -1,34 +1,34 @@
-Kcalc <- function(x, phy, checkdata=TRUE) {
+Kcalc <- function(x,phy, checkdata=TRUE) {
 
     if (checkdata) {
         dat <- match.phylo.data(phy, x)
         x <- dat$data
         phy <- dat$phy
     }
+    dat2 <- data.frame(x=x)
+    mat <- vcv.phylo(phy)
+    dat2$vars <- diag(mat)
+    matc <- vcv.phylo(phy, cor=TRUE) # correlation matrix
+    ntax <- length(phy$tip.label)
+
+    # calculate "phylogenetic" mean via gls
+    fit <- gls(x ~ 1, correlation=corSymm(matc[lower.tri(matc)], fixed=TRUE), 
+    weights=varFixed(~vars), data=dat2)
+    ahat <- coef(fit)
     
-	mat <- vcv.phylo(phy, cor=TRUE) # correlation matrix
-	ntax = length(phy$tip.label)
-	ntax1 = ntax-1
+    #observed
+    MSE <- fit$sigma^2
+    MSE0 <- t(x-ahat) %*% (x - ahat)/(ntax-1)
+    
+    #expected
+    MSE0.MSE <- 1/(ntax-1) * (sum(diag(mat))-ntax/sum(solve(mat)))
+    
+    K <- MSE0/MSE / MSE0.MSE
+    return(K)
 
-	dat = data.frame(x)
-	names(dat) = 'x'
-	# calculate "phylogenetic" mean via gls
-	fit <- gls(x ~ 1, data = dat, 	
-		correlation=corSymm(mat[lower.tri(mat)], fixed=TRUE))
-	ahat <- coef(fit)
-	
-	#observed
-	MSE <- fit$sigma^2
-	MSE0 <- t(dat$x - ahat) %*% (dat$x - ahat)/ ntax1
+}
 
-	#expected
-	MSE0.MSE <- 1/ ntax1 * 	
-		(sum(diag(mat))- ntax/sum(solve(mat)))
 
-	K <- MSE0/MSE / MSE0.MSE
-	return(K)
-}
-
 pic.variance <- function(x,phy,scaled=TRUE) {
 	pics <- pic(x, phy, scaled)
 	N <- length(pics)

Modified: pkg/inst/CITATION
===================================================================
--- pkg/inst/CITATION	2010-07-01 16:47:44 UTC (rev 231)
+++ pkg/inst/CITATION	2010-07-18 21:06:09 UTC (rev 232)
@@ -4,5 +4,7 @@
 	title = "Picante: {R} tools for integrating phylogenies and ecology",
         author = personList(as.person("S.W. Kembel"), as.person("P.D. Cowan"), as.person("M.R. Helmus"), as.person("W.K. Cornwell"), as.person("H. Morlon"), as.person("D.D. Ackerly"),as.person("S.P. Blomberg"), as.person("C.O. Webb")),
 	journal = "Bioinformatics",
-  	year = "In press",
-	textVersion = "S.W. Kembel, P.D. Cowan, M.R. Helmus, W.K. Cornwell, H. Morlon, D.D. Ackerly, S.P. Blomberg, and C.O. Webb. In press. Picante: R tools for integrating phylogenies and ecology. Bioinformatics." )
+    volume="26",
+    pages="1463--1464",
+    year="2010",
+	textVersion = "S.W. Kembel, P.D. Cowan, M.R. Helmus, W.K. Cornwell, H. Morlon, D.D. Ackerly, S.P. Blomberg, and C.O. Webb. 2010. Picante: R tools for integrating phylogenies and ecology. Bioinformatics 26:1463-1464." )

Modified: pkg/inst/doc/picante-intro.pdf
===================================================================
(Binary files differ)

Modified: pkg/man/picante-package.Rd
===================================================================
--- pkg/man/picante-package.Rd	2010-07-01 16:47:44 UTC (rev 231)
+++ pkg/man/picante-package.Rd	2010-07-18 21:06:09 UTC (rev 232)
@@ -12,8 +12,8 @@
 \tabular{ll}{
 Package: \tab picante\cr
 Type: \tab Package\cr
-Version: \tab 1.1-1\cr
-Date: \tab 2010-5-18\cr
+Version: \tab 1.2-0\cr
+Date: \tab 2010-7-18\cr
 License: \tab GPL-2\cr
 }
 }

Modified: www/index.php
===================================================================
--- www/index.php	2010-07-01 16:47:44 UTC (rev 231)
+++ www/index.php	2010-07-18 21:06:09 UTC (rev 232)
@@ -41,9 +41,9 @@
 <h2>News</h2>
 <ul>
 <li>A manuscript describing Picante has been published in Bioinformatics.</li>
-<li>Picante 1.1 has been released
+<li>Picante 1.2 has been released
 <ul>
-<li>Added a package vignette with information about data formats and examples of analyses</li>
+<li>Contains a package vignette with information about data formats and examples of analyses</li>
 <li>Data from Ives & Godfray (2006) now included in the package, type <code><strong>help(IvesGodfray)</code></strong> in R for more information.</li>
 </ul>
 </li>
@@ -91,7 +91,7 @@
 
 <h2>Obtaining picante</h2>
 <ul>
-<li>Version 1.1-1 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.2-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>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,6 +108,7 @@
 
 <h2>Release history</h2>
 <p><ul>
+<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>
 <li>Version 1.1: Added package vignette, new example data set from Ives & Godfray (2006), function example code. Reinstated "richness" and "frequency" null models for ses.* functions.</li>
 <li>Version 1.0: Added raoD, unifrac, taxonomic and evolutionary distinctiveness functions. Modified phylosor to work with non-ultrametric phylogenies. Changed name of randomizeSample to randomizeMatrix. Added functions for checking taxa label matching between phylogenies and other data.</li>  



More information about the Picante-commits mailing list