Moretti Sébastien | 8 Feb 17:19 2013
Picon
Picon

PhyloXML

Hi

I would like to add some XML to an existing PhyloXML tree.

No problem to read and write it.
I would like to add <name>smthg</name> after the <phylogeny> tag as in 
http://www.phyloxml.org/examples_syntax/phyloxml_syntax_example_1.html
but get problems with add_phyloXML_annotation() :

Can't locate object method "annotation" via package "Bio::Tree::Tree" at
         /software/share/perl5/vendor_perl/Bio/TreeIO/phyloxml.pm line 
984, <GEN0> line 1 (#1)
     (F) You called a method correctly, and it correctly indicated a package
     functioning as a class, but that package doesn't define that particular
     method, nor does any of its base classes.  See perlobj.

Uncaught exception from user code:
         Can't locate object method "annotation" via package 
"Bio::Tree::Tree" at 
/software/share/perl5/vendor_perl/Bio/TreeIO/phyloxml.pm line 984, 
<GEN0> line 1.
  at /software/share/perl5/vendor_perl/Bio/TreeIO/phyloxml.pm line 984

Bio::TreeIO::phyloxml::element_default('Bio::TreeIO::phyloxml=HASH(0x134b1268)') 
called at /software/share/perl5/vendor_perl/Bio/TreeIO/phyloxml.pm line 670

Bio::TreeIO::phyloxml::processXMLNode('Bio::TreeIO::phyloxml=HASH(0x134b1268)') 
called at /software/share/perl5/vendor_perl/Bio/TreeIO/phyloxml.pm line 309

Bio::TreeIO::phyloxml::add_phyloXML_annotation('Bio::TreeIO::phyloxml=HASH(0x134b1268)', 
'-obj', 'Bio::Tree::Tree=HASH(0x13525258)', '-xml', '<name>SUMF 
family</name>') called at ./add_annotation_to_phyloxml.pl line 40

I think I do something wrong but what ?
Here is the code

my $treeio = new Bio::TreeIO(-file   => "$infile",
                              -format => 'phyloxml',
                             );
my $tree = $treeio->next_tree;

# Add annotation
$treeio->add_phyloXML_annotation(-obj => $tree,
                                  -xml => '<name>SUMF family</name>',
                                 );

--

-- 
Sébastien Moretti

Gmane