[Bioperl-l] Bio::Tree method - FixedTopo tree factory with random
branchlengths
Jason Stajich
jason.stajich at duke.edu
Mon Sep 19 10:12:26 EDT 2005
That API looks great - I would prefer this to be in
Tree::RandomFactory if possible.
You can just add code in next_tree to see if tree object is already
stored and the method is 'fixedtopo', then return trees from that in
the same fashion as the rest of the random topos are generated.
As for implementation - I think you need to decide how you want the
branch lengths to be distributed. You can see how time is applied to
each node in the rand_birthdeath_backwards_tree() function in the
Tree::RandomFactory - but I think I assign brlens first and then
build up the tree from that so the lengths are distributed properly
on each level.
I took a lot of the tree generation code from Mike Sanderson's r8s
package (based on his advice) - you may want to trawl around in the
tree building literature to get a better sense of how to best
generate branch lengths. I'm sure smarter folks than I could point
you to the right the literature but I don't know it off the top of my
head.
-jason
On Sep 19, 2005, at 7:00 AM, Albert Vilella wrote:
> Dears,
>
> I am looking to implement a method for a Bio::Tree object that will
> generate a number of trees with the same topology as the input tree
> but with random branch lengths for each branch given.
>
> I would like to ask where do you think is the best place to implement
> this: RandomFactory.pm ? Maybe this should go inside
> DistanceFactory ? Maybe put in another module.
>
> My idea is that one would call the method with something similar to
> this:
>
> my $treeio = new Bio::TreeIO(-format => 'newick', -file =>
> 'treefile.dnd');
> my $tree = $treeio->next_tree;
> my $out = Bio::TreeIO->new
> (
> -format => 'newick',
> -file => ">$outfile"
> );
> my $factory = new Bio::Tree::RandomFactory(
> -tree => $tree,
> -maxcount => $maxcount,
> -method => "fixedtopo",
> );
>
> while(my $generatedtree = $factory->next_tree) {
> $out->write_tree($generatedtree);
> }
>
> There would be something like a "fixedtopo_maxlen" so that the random
> lengths fall inside the (0..maxlen) range.
>
> I would be glad to know how do you think this could be implemented, of
> if there is an easier way to do so with the current methods.
>
> Thanks in advance,
>
> Albert.
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
http://www.duke.edu/~jes12
More information about the Bioperl-l
mailing list