Skip to content

phyloxml support for ete4 #782

@alpae

Description

@alpae

Hi,

it seems that with ete4 the support to load phyloxml trees has diminished. nothing mentioned in the docs anymore, but the phyloxml module is still available. However, loading a simple phyloxml tree results in an error:

In [13]: from ete4 import Phyloxml

In [14]: project = Phyloxml()
    ...: project.build_from_file("test.xml")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[14], line 2
      1 project = Phyloxml()
----> 2 project.build_from_file("test.xml")

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phyloxml/__init__.py:22, in Phyloxml.build_from_file(self, fname)
     20     rootTag = 'phyloxml'
     21     rootClass = self.__class__
---> 22 self.build(rootNode)

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phyloxml/_phyloxml.py:421, in Phyloxml.build(self, node)
    419 for child in node:
    420     nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
--> 421     self.buildChildren(child, node, nodeName_)

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phyloxml/_phyloxml.py:426, in Phyloxml.buildChildren(self, child_, node, nodeName_, fromsubclass_)
    424 def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
    425     if nodeName_ == 'phylogeny':
--> 426         obj_ = Phylogeny.factory()
    427         obj_.build(child_)
    428         self.phylogeny.append(obj_)

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phyloxml/_phyloxml.py:474, in Phylogeny.factory(*args_, **kwargs_)
    472 def factory(*args_, **kwargs_):
    473     if Phylogeny.subclass:
--> 474         return Phylogeny.subclass(*args_, **kwargs_)
    475     else:
    476         return Phylogeny(*args_, **kwargs_)

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phyloxml/_phyloxml_tree.py:75, in PhyloxmlTree.__init__(self, phyloxml_clade, phyloxml_phylogeny, **kargs)
     71     #self.__support = Confidence(valueOf_=1.0, type_="branch_support")
     72     #self.phyloxml_clade.add_confidence(self.__support)
     73 else:
     74     self.phyloxml_clade = phyloxml_clade
---> 75 super(PhyloxmlTree, self).__init__(**kargs)

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/phylo/phylotree.py:288, in PhyloTree.__init__(self, newick, children, alignment, alg_format, sp_naming_function, parser)
    272 def __init__(self, newick=None, children=None, alignment=None,
    273              alg_format="fasta", sp_naming_function=None,
    274              parser=None):
    275     """
    276     :param newick: If not None, initializes the tree from a newick,
    277         which can be a string or file object containing it.
   (...)    286         identifier.
    287     """
--> 288     super().__init__(data=newick, children=children, parser=parser)
    290     # This will be only executed after reading the whole tree,
    291     # because the argument 'alignment' is not passed to the
    292     # PhyloTree constructor during parsing.
    293     if alignment:

File ~/.pyenv/versions/3.12.2/envs/pyham-new/lib/python3.12/site-packages/ete4/core/tree.pyx:60, in ete4.core.tree.Tree.__init__()

AttributeError: property 'children' of 'PhyloxmlTree' object has no setter

any comments on your plans about phyloxml would be appreciated. thanks

Adrian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions