[ensembl-dev] NHX & phyloXML

Moretti Sébastien sebastien.moretti at unil.ch
Fri May 17 15:34:42 BST 2013


I will try with this.

Thanks Matthieu

>> Hi
>>
>> I wonder if you have a module, or a script, in the Ensembl API to
>> convert from NHX trees to phyloXML trees.
>>
>> For what I found, it looks you generate NHX and phyloXML from the
>> database, and you don't convert from one format to the other directly.
>>
>> Am I right?
>> Regards
>>
>
> Hi Sébastien,
>
> We have a NHX parser and a PhyloXML writer. I believe it is possible to
> connect them, though I haven't tried. Here are the two bits you can use:
>
> To get the tree structure from the NHX:
> my $tree =
> Bio::EnsEMBL::Compara::Graph::NewickParser::parse_newick_into_tree($str);
>
> To write it in PhyloXML format to the file handle $fh:
> my $w = Bio::EnsEMBL::Compara::Graph::PhyloXMLWriter->new(-SOURCE =>
> 'compara', -NO_SEQUENCES => 1, -HANDLE => $fh, -NO_RELEASE_TREES => 1);
> $w->write_trees($tree);
> $w->finish();
>
>
> Hope this helps,
> Matthieu

-- 
Sébastien Moretti
SIB Vital-IT EMBnet, Quartier Sorge - Genopode
CH-1015 Lausanne, Switzerland
Tel.: +41 (21) 692 4079/4221
http://www.vital-it.ch/ http://myhits.vital-it.ch/




More information about the Dev mailing list