[Bioperl-l] Trees and networks: ask for features
Csaba Ortutay
Csaba.Ortutay at uta.fi
Thu Aug 5 05:29:42 EDT 2004
Hello,
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:
http://www.aisee.com/gdl/nutshell/
and shorter here:
http://www.program-transformation.org/Transform/GraphDescriptionLanguage
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
--
Csaba Ortutay PhD
University of Tampere
Institute of Medical Technology
Bioinformatics Group
Finland
Csaba.Ortutay at uta.fi
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nexus2gdl.pl:
#!/usr/bin/perl -w
use strict;
use Bio::TreeIO;
my $treeio=new Bio::TreeIO (-format=>'nexus',
-file=>'mytree.tre'
);
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){
$_->id('internal_'.$i++);
}
my @siblings=$_->each_Descendent;
$gdlnodes{$_->id}->{1}=1;
foreach my $son (@siblings){
if (! $son->id){
$son->id('internal_'.$i++);
}
$gdlnodes{$_->id}->{$son->id}=1;
}
}
# 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";
exit;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
More information about the Bioperl-l
mailing list