[Bioperl-l] Bio::Tree method - FixedTopo tree factory with random branchlengths

Albert Vilella avilella at gmail.com
Mon Sep 19 07:00:38 EDT 2005


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.




More information about the Bioperl-l mailing list