From 7e78dcfcf1bca3d6aaca7ae92ab0f4fb3d9cc711 Mon Sep 17 00:00:00 2001 From: paradis Date: Fri, 12 Jun 2009 09:36:38 +0000 Subject: [PATCH] removed klastorin() git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@77 6e262413-ae40-0410-9e79-b911bd7a66b7 --- ChangeLog | 2 + DESCRIPTION | 5 +- R/klastorin.R | 59 +--------- man/ape-internal.Rd | 8 +- man/klastorin.Rd | 54 --------- src/treefunc.c | 259 -------------------------------------------- 6 files changed, 6 insertions(+), 381 deletions(-) delete mode 100644 man/klastorin.Rd delete mode 100644 src/treefunc.c diff --git a/ChangeLog b/ChangeLog index 5705d9a..efef3ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,8 @@ OTHER CHANGES o rcoal() is now faster. + o klastorin() has been removed. + CHANGES IN APE VERSION 2.3 diff --git a/DESCRIPTION b/DESCRIPTION index c12694c..42abd25 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.3-1 -Date: 2009-06-10 +Date: 2009-06-12 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Gangolf Jobb, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Korbinian Strimmer, Damien de Vienne Maintainer: Emmanuel Paradis @@ -17,8 +17,7 @@ Description: ape provides functions for reading, writing, plotting, parameter theta based on various approaches, nucleotide diversity, generalized skyline plots, estimation of absolute evolutionary rates and clock-like trees using mean path lengths, non-parametric rate - smoothing and penalized likelihood, classifying genes in trees using - the Klastorin-Misawa-Tajima approach. Phylogeny estimation can be done + smoothing and penalized likelihood. Phylogeny estimation can be done with the NJ, BIONJ, and ME methods. License: GPL (>= 2) URL: http://ape.mpl.ird.fr/ diff --git a/R/klastorin.R b/R/klastorin.R index 27ba6ef..3d19128 100644 --- a/R/klastorin.R +++ b/R/klastorin.R @@ -1,59 +1,2 @@ -## klastorin.R (2003-05-26) - -## Klastorin's (1982) classifification method, applied to -## phylogenetic trees as suggested by Misawa and Tajima (2000) - -## Copyright 2003 Gangolf Jobb - -## This file is part of the R-package `ape'. -## See the file ../COPYING for licensing issues. - -########### PRIVATE ############## - -getMisawaTajima <- function() - .C("getMisawaTajima", result = integer(klastorin_nTips()), - PACKAGE = "ape")$result - -### functions to set and extract phylo tree ### - -buildTreeFromPhylo <- function(tree) { - lowerNodes <- tree$edge[,1] - upperNodes <- tree$edge[,2] - edgeLengths <- tree$edge.length - tipLabels <- tree$tip.label - .C("buildTreeFromPhylo", as.integer(lowerNodes), - as.integer(upperNodes), as.double(edgeLengths), - as.integer(length(edgeLengths)), - as.character(tipLabels), - as.integer(length(tipLabels)), - result = integer(1), PACKAGE = "ape" - )$result -} - -destroyTree <- function() - .C("destroyTree", result = integer(1), - PACKAGE = "ape")$result - -getError <- function() - .C("getError", result = integer(1), - PACKAGE = "ape")$result - -klastorin_nTips <- function() - .C("nTips", result = integer(1), - PACKAGE = "ape")$result - -########### PUBLIC ############## - klastorin <- function(phy) -{ - if (!inherits(phy, "phylo")) - stop("object \"phy\" is not of class \"phylo\"") - ## added by EP for the new coding of "phylo" (2006-10-04): - phy <- new2old.phylo(phy) - ## End - buildTreeFromPhylo(phy) - if (getError() !=0) stop("Could not load \"phylo\" object") - tmp <- getMisawaTajima() - destroyTree() - tmp -} + stop("the function klastorin has been removed from ape") diff --git a/man/ape-internal.Rd b/man/ape-internal.Rd index 464d304..602f407 100644 --- a/man/ape-internal.Rd +++ b/man/ape-internal.Rd @@ -19,13 +19,8 @@ \alias{phylogram} \alias{prepareTree} \alias{setTree} -\alias{buildTreeFromPhylo} -\alias{destroyTree} -\alias{getError} \alias{nEdges} \alias{nNodes} -\alias{klastorin_nTips} -\alias{getMisawaTajima} \alias{phylogram.plot} \alias{cladogram.plot} \alias{circular.plot} @@ -51,7 +46,6 @@ Internal ape functions. } \note{ - These are not to be called by the user (or in some cases are just - waiting for proper documentation to be written). + These are not to be called by the user (unless you know what you're doing). } \keyword{internal} diff --git a/man/klastorin.Rd b/man/klastorin.Rd deleted file mode 100644 index 5388162..0000000 --- a/man/klastorin.Rd +++ /dev/null @@ -1,54 +0,0 @@ -\name{klastorin} -\alias{klastorin} -\title{Klastorin's (1982) method for classifying genes as suggested by Misawa -and Tajima (2000)} -\usage{ -klastorin(phy) -} -\arguments{ - \item{phy}{a phylogenetic tree, i.e. an object of class \code{"phy"}. The root of the tree should make - sense biologically. - } -} -\description{ - The function \code{klastorin} uses the method by Klastorin's (1982) as - suggested by Misawa and Tajima (2000) for identifying groups within - gene trees. -} -\value{ -A vector indication the class affiliation for each sequence/taxon in the tree. -} -\seealso{ -\code{\link{opsin}}. -} -\references{ - Klastorin T.D. (1982) An alternative method for hospital partition - determination using hierarchical cluster analysis. \emph{Operations - Research} \bold{30},1134--1147. - - Misawa, K. (2000) A simple method for classifying genes and a bootstrap - test for classifications. \emph{Molecular Biology and Evolution}, - \bold{17}, 1879--1884. -} -\author{Gangolf Jobb (\url{http://www.treefinder.de})} -\examples{ -# find groups in landplant tree -data("landplants.newick") -tree1 <- read.tree(text = landplants.newick) -plot(tree1, label.offset = 0.001) -klastorin(tree1) -tree1$tip.label - -# find groups in opsin tree -data("opsin.newick") -tree2 <- read.tree(text = opsin.newick) -plot(tree2,label.offset = 0.01) -groups <- klastorin(tree2) -groups -tree2$tip.label[groups==1] -tree2$tip.label[groups==2] -tree2$tip.label[groups==3] -tree2$tip.label[groups==4] -tree2$tip.label[groups==5] -} -\keyword{manip} diff --git a/src/treefunc.c b/src/treefunc.c deleted file mode 100644 index 3b234ee..0000000 --- a/src/treefunc.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * treefunc.c - * - * (c) 2003 Gangolf Jobb (http://www.treefinder.de) - * - * Various data structures and methods for manipulating - * and traversing trees - * (e.g., to classify genes) - * - * This code may be distributed under the GNU GPL - */ - -#include -#include -#include - -/*============================================================================*/ - -#define LABLEN 128 - -typedef struct tree { - char label[LABLEN]; - struct tree *branches,*next; - double length; - int mark; -} Tree; - -/*....*/ - -Tree *NewTree(void) { - Tree *b; - - b=malloc(sizeof(Tree)); if(!b) return(NULL); - - *b->label='\0'; b->branches=NULL; b->next=NULL; b->length=0.0; - - return(b); -} - -/*....*/ - -void FreeTree(Tree *t) { - Tree *b; - - while(t->branches) {b=t->branches; t->branches=b->next; FreeTree(b);} - - free(t); - -} - -/*============================================================================*/ - -static Tree *current=NULL; - -static int tip_index; -static int edge_index; -static int node_index; - -enum {OK=0,ERROR}; /* one may invent more descriptive error codes */ -static int error=OK; - -/*============================================================================*/ - -Tree *buildTreeFromPhylo_( - int node, - int *lowerNodes, - int *upperNodes, - double *edgeLengths, - int nedges, - char **tipLabels, - int ntips -) { - Tree *t,*b,**bb; - int i,j,n; - - t=NewTree(); - - bb=&t->branches; n=0; - for(i=0;i0) { if(j>ntips) {error=ERROR; goto err;} - b=NewTree(); strcpy(b->label,tipLabels[j-1]); - } else { if(-j>nedges) {error=ERROR; goto err;} - b= - buildTreeFromPhylo_(j,lowerNodes,upperNodes,edgeLengths,nedges,tipLabels,ntips); - } - b->length=edgeLengths[i]; - *bb=b; bb=&b->next; n++; - } if(n<2) {error=ERROR; goto err;} - err: - *bb=NULL; - - return(t); -} - -/*....*/ - -void buildTreeFromPhylo( - int *lowerNodes, - int *upperNodes, - double *edgeLengths, - int *nedges, - char **tipLabels, - int *ntips, - int *result -) { - - error=OK; - - if(current) {FreeTree(current); current=NULL;} - - if(*nedges<2||*ntips<2) {error=ERROR; *result=error; return;} - - current=buildTreeFromPhylo_(-1,lowerNodes,upperNodes,edgeLengths,*nedges,tipLabels,*ntips); - - if(error&¤t) {FreeTree(current); current=NULL;} - - *result=error; - -} - -/*============================================================================*/ - -void destroyTree(int *result) { - - error=OK; - - if(current) {FreeTree(current); current=NULL;} - - *result=error; - -} - -/*============================================================================*/ - -void getError(int *result) { - - *result=error; - - error=OK; - -} - -/*============================================================================*/ - -int nTips_(Tree *t) { - Tree *b; - int n; - - if(!t->branches) return(1); - - n=0; for(b=t->branches;b;b=b->next) n+=nTips_(b); - - return(n); -} - -/*....*/ - -void nTips(int *result) { - - error=OK; - - if(!current) {error=ERROR; *result=0; return;} - - *result=nTips_(current); - -} - -/*============================================================================*/ - -int nNodes_(Tree *t) { - Tree *b; - int n; - - if(!t->branches) return(1); - - n=1; for(b=t->branches;b;b=b->next) n+=nNodes_(b); - - return(n); -} - -/*....*/ - -void nNodes(int *result) { - - error=OK; - - if(!current) {error=ERROR; *result=0; return;} - - *result=nNodes_(current); - -} - -/*....*/ - -void nEdges(int *result) { - - error=OK; - - if(!current) {error=ERROR; *result=0; return;} - - *result=nNodes_(current)-1; -} - -/*============================================================================*/ - -double markClasses_(Tree *t) { - Tree *b; double destinct,sum; - - /* all tips above a marked ( == 1) node belong to the same class */ - - if(!t->branches) {t->mark=1; return(t->length);} - - sum=0.; for(b=t->branches;b;b=b->next) sum+=markClasses_(b); - - destinct=nTips_(t)*(t->length); /* (t->length) == 0. at root */ - - if(destinct>sum) { t->mark=1; return(destinct); } - - t->mark=0; return(sum); - -} - -/*....*/ - -void getMisawaTajima__(Tree *t,int ignore,int *result) { /* maps tips to marked classes */ - Tree *b; - - if(t->mark&&!ignore) {node_index++; ignore=1;} /* marked nodes above a marked node will be ignored */ - - if(!t->branches) {result[tip_index++]=node_index; return;} - - for(b=t->branches;b;b=b->next) getMisawaTajima__(b,ignore,result); - -} - -/*....*/ - -void getMisawaTajima_(Tree *t,int *result) { - - markClasses_(t); - - tip_index=0; node_index=0; - - getMisawaTajima__(t,0,result); - -} - -/*....*/ - -void getMisawaTajima(int *result) { - - error=OK; - - if(!current) {error=ERROR; return;} - - getMisawaTajima_(current,result); - -} -- 2.39.2