X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fbipartition.c;h=884fc6c35100f1619c3017997343eef82524b24c;hb=fab4946bb5d41cd408dffd4b66aae8a697690cfa;hp=aeb6977080ff182c1c044442b9a7e1e9e558aba3;hpb=d88302b4735b5b7c9132387090bb592d906fe1cb;p=ape.git diff --git a/src/bipartition.c b/src/bipartition.c index aeb6977..884fc6c 100644 --- a/src/bipartition.c +++ b/src/bipartition.c @@ -1,6 +1,6 @@ -/* bipartition.c 2007-06-29 */ +/* bipartition.c 2011-10-22 */ -/* Copyright 2005-2007 Emmanuel Paradis, and 2007 R Development Core Team */ +/* Copyright 2005-2011 Emmanuel Paradis, and 2007 R Development Core Team */ /* This file is part of the R-package `ape'. */ /* See the file ../COPYING for licensing issues. */ @@ -143,7 +143,7 @@ int SameClade(SEXP clade1, SEXP clade2) SEXP prop_part(SEXP TREES, SEXP nbtree, SEXP keep_partitions) { - int i, j, k, l, KeepPartition, Ntree, Ntip, Nnode, Npart, NpartCurrent, *no; + int i, j, k, KeepPartition, Ntree, Ntip, Nnode, Npart, NpartCurrent, *no; SEXP bp, ans, nbtip, nbnode, number; PROTECT(nbtree = coerceVector(nbtree, INTSXP)); @@ -189,6 +189,11 @@ SEXP prop_part(SEXP TREES, SEXP nbtree, SEXP keep_partitions) /* We start on the 2nd tree: */ for (k = 1; k < Ntree; k++) { + +/* in case there are trees with multichotomies: */ + nbnode = getListElement(VECTOR_ELT(TREES, k), "Nnode"); + Nnode = INTEGER(nbnode)[0]; + PROTECT(bp = bipartition(getListElement(VECTOR_ELT(TREES, k), "edge"), nbtip, nbnode)); for (i = 1; i < Nnode; i++) {