boot.phylo( ) function
2
0
Entering edit mode
Nora Muda ▴ 70
@nora-muda-2065
Last seen 10.2 years ago
Dear BioConducter useRs, I have problems in writing boot.phylo() function. Let say I have 30 aligned sequences; then I computed pairwise distances with "K80" method. Then I construct phylogenetic tree with neighbor-joining method and my proposed method. Now I have problems in writing "FUN" in boot.phylo() function. Below are examples of my programs: library(ape) allbacteria <- read.dna("allbacteriafasta","fasta") distallbacteria <- dist.dna(allbacteria,pairwise.deletion=TRUE,as.matrix=TRUE) plot(nj(distallbacteria)) boot.phylo(plot(nj(distallbacteria)),allbacteria,nj(distallbacteria)) What should I put as FUN in boot.phylo? I make comparison between distances of "K80" in PHYLIP and dist.dna("K80").There are a lot of differences esp in PHYLIP there is a default for transversion/transition rate; which is 2 but not in ape package. How to modify it to make it the same? Hope you all may help. Your attention are really appreciated. Regards, Nora. ______________________________________________________________________ ______________ Be a PS3 game guru.
• 3.0k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States
Hi Nora -- I do not have direct experience with this package, but from the help page > library(ape) > ?boot.phylo perhaps allbacteria <- read.dna("allbacteriafasta","fasta") distallbacteria <- dist.dna(allbacteria, pairwise.deletion=TRUE, as.matrix=TRUE) njtree <- nj(distallbacteria) boot.phylo(njtree, allbacteria, FUN=function(bootstrappedData) { nj(dist.dna(bootstrappedData, pairwise.deletion=TRUE, as.matrix=TRUE)) }) works? Martin Nora Muda <noramuda at="" yahoo.com=""> writes: > Dear BioConducter useRs, > > I have problems in writing boot.phylo() function. > > Let say I have 30 aligned sequences; then I computed > pairwise distances with "K80" method. Then I construct > phylogenetic tree with neighbor-joining method and my > proposed method. Now I have problems in writing "FUN" > in boot.phylo() function. Below are examples of my > programs: > > library(ape) > allbacteria <- read.dna("allbacteriafasta","fasta") > distallbacteria <- > dist.dna(allbacteria,pairwise.deletion=TRUE,as.matrix=TRUE) > plot(nj(distallbacteria)) > > boot.phylo(plot(nj(distallbacteria)),allbacteria,nj(distallbacteria)) > > What should I put as FUN in boot.phylo? > > I make comparison between distances of "K80" in PHYLIP > and dist.dna("K80").There are a lot of differences esp > in PHYLIP there is a default for > transversion/transition rate; which is 2 but not in > ape package. How to modify it to make it the same? > > Hope you all may help. Your attention are really > appreciated. > > > Regards, > Nora. > > > > > > ____________________________________________________________________ ________________ > Be a PS3 game guru. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Bioconductor / Computational Biology http://bioconductor.org
ADD COMMENT
0
Entering edit mode
Dear all, I have replied privately to this query, mentioning that the BioC list may not be appropriate for this kind of question, but I was apparently wrong (I'm not on the list, so not aware of the usual topics). Martin Morgan wrote: > Hi Nora -- > > I do not have direct experience with this package, but from the help > page > >> library(ape) >> ?boot.phylo > > perhaps > > allbacteria <- read.dna("allbacteriafasta","fasta") > distallbacteria <- > dist.dna(allbacteria, pairwise.deletion=TRUE, as.matrix=TRUE) > njtree <- nj(distallbacteria) > > boot.phylo(njtree, > allbacteria, > FUN=function(bootstrappedData) { > nj(dist.dna(bootstrappedData, > pairwise.deletion=TRUE, > as.matrix=TRUE)) > }) > > works? Yes, this is it. The option as.matrix=TRUE is not needed, and will likely slow down the whole thing. Earl Glynn asked me for an example of using boot.phylo with a "toy" problem. Here's what can be done in R: library(ape) data(woodmouse) d <- dist.dna(woodmouse) tr <- nj(d) bp <- boot.phylo(tr, woodmouse, function(xx) nj(dist.dna(xx))) plot(tr) nodelabels(bp) Then you can change the options of dist.dna and boot.phylo to see how this may affect the results. There is a more "real life" example in my book "APER" (this case study is actually spread in several chapters, so that it explains the analysis from A to Z, or nearly). boot.phylo is fairly fast for small to moderate size, on my laptop I have: > system.time(bp <- boot.phylo(tr, woodmouse, function(xx) nj(dist.dna(xx)))) [1] 11.089 0.008 11.098 0.000 0.000 These times are expected to be quite longer for big data sets as a substantial part of the computation is done in R (I plan to rewrite this in C sometime). Also I have experimental codes for dist.dna that are much faster than the current ones. > Martin > > Nora Muda <noramuda at="" yahoo.com=""> writes: > >> Dear BioConducter useRs, >> >> I have problems in writing boot.phylo() function. >> >> Let say I have 30 aligned sequences; then I computed >> pairwise distances with "K80" method. Then I construct >> phylogenetic tree with neighbor-joining method and my >> proposed method. Now I have problems in writing "FUN" >> in boot.phylo() function. Below are examples of my >> programs: >> >> library(ape) >> allbacteria <- read.dna("allbacteriafasta","fasta") >> distallbacteria <- >> dist.dna(allbacteria,pairwise.deletion=TRUE,as.matrix=TRUE) >> plot(nj(distallbacteria)) >> >> boot.phylo(plot(nj(distallbacteria)),allbacteria,nj(distallbacteria)) >> >> What should I put as FUN in boot.phylo? >> >> I make comparison between distances of "K80" in PHYLIP >> and dist.dna("K80").There are a lot of differences esp >> in PHYLIP there is a default for >> transversion/transition rate; which is 2 but not in >> ape package. How to modify it to make it the same? Here the answer I sent to Nora: Indeed, and these differences are expected. PHYLIP assumes a "theoretically expected" value of the ts/tv ratio, the distance is then calculated by maximizing a likelihood function. (I owe this information to my colleague Olivier Gascuel who dissected PHYLIP's code.) You can change the default of the ts/tv ratio, in which case it is also estimated by ML. dist.dna is faithful to Kimura's original formulae; it also computes the variance of the distances (which PHYLIP does not). Emmanuel Paradis
ADD REPLY
0
Entering edit mode
Glynn, Earl ▴ 170
@glynn-earl-952
Last seen 10.2 years ago
I am looking for a similar solution using only R/Bioconductor packages. After not finding any examples of using boot.phylo from Google, I sent a note to the author of boot.phylo asking if any working examples are available. Perhaps Emmanuel Paradis can join this discussion. I have used the PHYLIP programs "neighbor" and "consense" for this, and used R to create the files for "neighbor". I can now put these working notes online to give some idea about using neighbor and consense: http://research.stowers-institute.org/efg/Report/BootstrapTree.pdf (since the related paper was published late last year). While these notes are quite specific to our particular problem, they show how R can be used to create distance matrices for input to PHYLIP's "neighbor" program. A complete solution in R is desirable, but I haven't found one yet. I'm hoping boot.phylo can do something similar, but the documentation needs to have some better examples so the software can be used. efg Earl F. Glynn Scientific Programmer Bioinformatics Stowers Institute for Medical Research "Nora Muda" <noramuda at="" yahoo.com=""> wrote in message news:855563.43819.qm at web61024.mail.yahoo.com... > Dear BioConducter useRs, > > I have problems in writing boot.phylo() function.
ADD COMMENT

Login before adding your answer.

Traffic: 456 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6