Re: [R-sig-phylo] Zero bootstrap values

2012-04-03 Thread Klaus Schliep
Dear Gwennaël,

the bootstrapping function is fine, it is just a problem with the
plotting. Can you try this function, it should work:


plotBSNew - function (tree, BStrees, type = unrooted, bs.col = black,
bs.adj = NULL, ...)
{

prop.clades - function (phy, ..., part = NULL, rooted = FALSE)
{
   if (is.null(part)) {
   obj - list(...)
   if (length(obj) == 1  class(obj[[1]]) != phylo)
   obj - unlist(obj, recursive = FALSE)
   part - prop.part(obj, check.labels = TRUE)
   }

   bp - prop.part(phy)
   if (!rooted){
   bp - postprocess.prop.part(bp)
   part - postprocess.prop.part(part)   # This line I added!!
   }
   n - numeric(phy$Nnode)
   for (i in seq_along(bp)) {
   for (j in seq_along(part)) {
   if (identical(bp[[i]], part[[j]])) {
   n[i] - attr(part, number)[j]
   done - TRUE
   break
   }
   }
   }
   n
}

if (type == phylogram | type == cladogram) {
if (!is.rooted(tree))
tree2 = midpoint(tree)
plot(tree2, type = type, ...)
}
else plot(tree, type = type, ...)
x = prop.clades(tree, BStrees)
x = round((x/length(BStrees)) * 100)
label = c(rep(, length(tree$tip)), x)
ind - get(last_plot.phylo, envir = .PlotPhyloEnv)$edge[,
2]
if (type == phylogram | type == cladogram) {
root = getRoot(tree)
label = c(rep(0, length(tree$tip)), x)
label[root] = 0
ind2 = matchEdges(tree2, tree)
label = label[ind2]
ind = which(label  0)
if (is.null(bs.adj))
bs.adj = c(1, 1)
nodelabels(text = label[ind], node = ind, frame = none,
col = bs.col, adj = bs.adj, ...)
}
else {
if (is.null(bs.adj))
bs.adj = c(0.5, 0.5)
edgelabels(label[ind], frame = none, col = bs.col,
adj = bs.adj, ...)
}
}


plotBSNew(Cassidinaealnx2pmloptim $tree, Cassidinaepmlbs, type=p)


Regards,
Klaus

On 4/3/12, Gwennaël Bataille gwennael.batai...@uclouvain.be wrote:
 Dear all,
 I have got some troubles with the ML bootstrapping {phangorn} : I get
 zero values...
 I already had this problem before, but cannot see what's going wrong here.

 The script and fasta file are in the end of the mail.
 Any idea ?

 Many thanks,


 Gwennaël



 _

 #Import the data  make a first NJ tree
 Cassidinaealnx2- read.dna(file = Cassidinaealnx.fasta, format =
 fasta)
 Cassidinaealnxdist- dist.dna(Cassidinaealnx2, model = K80,
 pairwise.deletion = FALSE)
 Cassidinaetrx- nj(Cassidinaealnxdist)
 plot(Cassidinaetrx)
 Cassidinaertrx- root(Cassidinaetrx, Imatidiumthoracicum)

 #ML
 Cassidinaealnx2pml- pml(Cassidinaertrx, as.phyDat(Cassidinaealnx2))
 Cassidinaealnx2pmloptim- optim.pml(Cassidinaealnx2pml, optNni=TRUE)
 plot(Cassidinaealnx2pmloptim)
 Cassidinaepmlbs- bootstrap.pml(Cassidinaealnx2pmloptim, optNni=TRUE)
 plotBS(Cassidinaealnx2pmloptim $tree, Cassidinaepmlbs, type=p)




 
 Cassidinaealnx.fasta





Agroiconotapropinqua
 tganaaaccgaa-ggatcg-aataaattcattcgcg-tttcgattgtcagcgttgagcgg-ttgtgtgactgacggagtacgcttcg-tccgcaccttcagttcatcga-act-ggcttcgaacgcgtgcac-tagtaggacgtcgcgatccg-ttgggcgtcggtctaaggcttgcgg-tggagctcgcgtg--gacgtttc--ggcgtt--ccgcacgaacccgcaatgtccc-gatcgactcgctcgacggt-ata-aagatggcgcccgctactcagttagcgttcgacctacggca-agc-acgtccggtgttt--gatggcn-atcagacctggtcggatcctgtcctc-ggacgactgttgg--ctcgtantg-ttctcgaacagacctcg-ttkaaacgcc-catctgcgacgcgctt-tgggtactttca-ggacccgtcttgaaacacgg-
Microctenochiracumulata
 ---ctgagaamccgaa-agatcg-aataaattcattcgcg-tttcgattgtcagcgttgagcgg-ttgtgtgactgacggagtacgcttcg-tccgcaccttcagttcatcga-act-ggcttcgaacgcgtgcac-tagtaggacgtcgcgatccg-ttgggcgtcggtctaaggcttgcgg-tggagctcgcgtg--gacgtttc--ggcgt---ccgcacgaacccgcaatgtccc-gatcgacacgctcgacggt-aca-aagatggcgcccgctattcagttagcgttcgacctatggca-agc-acgtccggtgttt--gatggcg-atcagacctggtcggatcccgtcctc-ggacgactgttgg--ctcgtagtg-ttctcgaacagacctcg-ttgaaacgcc-gatctgcgacgctatagctt-tgggtactttca-ggacccgtcttgaaacacg--
Charidotellasexpunctata
 --a-tcg-aataaattcatkggcg-tttcgattgtcagcgttggacgg-ttgtgtgactgacggagtacgcttcg-tccgcaccttcagttcatcga-act-ggcttcgaacgcgtgcac-tagtaggacgtcgcgatccg-ttgggcgtcgatctaaggcttgcgg-tggagctcgcgtg--gacgtttc--ggcgtt--ccacacgaacctgcaatgtccc-gatcgactcgctcgacggt-ata-aagatggcgcccgctattcagttagcgttcggcctacggca-agc-acgtgcggtattt--gatggcg-atcagacctggtcggatcccgtcgcc-ggacgactgttgg--ctcgtagtg-ttctcgaacagacctcg-ttgaaacgcc-gatctgcgacgctntagctt-tgggtactttca-ggacccgtcttgaaacacggcagg-
Charidotellasinuata
 

[R-sig-phylo] parsimony bootstrapping

2012-04-03 Thread Brian Bourke

Dear All
I am constructing maximum parsimony trees:

library(phangorn)
primates = read.phyDat(primates.dna, format=phylip, type=DNA)
dm = dist.dna(as.DNAbin(primates))
treeNJ = NJ(dm)
treePars = optim.parsimony(treeNJ, primates)
##and
treeRatchet = pratchet(primates, trace = 0)

, and I would like to know how to do parsimony bootstrap analysis.  Anyone know 
how this can be done?

Regards,
Brian.
  
[[alternative HTML version deleted]]

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo