[Bioperl-l] Trees and networks: ask for features

Csaba Ortutay Csaba.Ortutay at uta.fi
Thu Aug 5 05:29:42 EDT 2004


I am using Bioperl to handle trees.

My first question is that is it possible to write a TreeIO module, which can 
write trees in the Graph Description Language (gdl) format?

The description is here:
and shorter here:

I wrote a short script, which can convert a nexus file to a dgl graph, but it 
lacks much of the functionality. (I included the script at the end of the 
mail. I am not a professional programmer, so don't look for an expert code.) 
Is there anybody who can (and wants) help me to develop this, and integrate 
to Bioperl?

The another topic is the networks.
A network (from my point of view) is very similar to trees except it is 
allowed to have more than 1 ancestor for a node. Or more, the relations is 
not strictly distinguished as ancestor or siblings, but in another way. GDL 
format is a valid file format to store networks too.

It would be nice if someone could help to develop a module which can handle 
network objects, such as signaling networks, metabolic networks or pedigrees; 
similar to tree handling.

I have seen that others also looked for solutions for network handling.

Thanks for help:

Csaba Ortutay PhD
University of Tampere
Institute of Medical Technology
Bioinformatics Group
Csaba.Ortutay at uta.fi



#!/usr/bin/perl -w
use strict;
use Bio::TreeIO;

my $treeio=new Bio::TreeIO (-format=>'nexus',
my $tree=$treeio->next_tree;
my @nodes=$tree->get_nodes;
my $i=0;
my %gdlnodes;

# Parsing the nodes of the tree into the  %gdlnodes,
# where hash key is the id of the node, value is a hash of siblings 
# The keys of sibling hash are the ids of siblings, and the value is simply 1
# which can be used in a more useful way later

foreach (@nodes){
    if (! $_->id){
    my @siblings=$_->each_Descendent;
    foreach my $son (@siblings){
	if (! $son->id){
# Print out the gdl to the STDOUT

print "
// Tree in GDL format //

graph: {title : \"Testtree\"
        layoutalgorithm: tree
        orientation: left_to_right
        arrowmode: free
        portsharing: yes

foreach my $gnode (sort keys %gdlnodes){
    print "
node: {title : \"",$gnode,"\"

    foreach my $son (sort keys %{$gdlnodes{$gnode}}){
	if ($son eq '1'){next}
print "
edge: {source : \"",$gnode,"\"
       target : \"",$son,"\"
print "}\n";

More information about the Bioperl-l mailing list