Coverage for /home/deng/Projects/ete4/hackathon/ete4/ete4/phyloxml/__init__.py: 50%
22 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-03-21 09:19 +0100
« prev ^ index » next coverage.py v7.2.7, created at 2024-03-21 09:19 +0100
1from sys import stdout
2from . import _phyloxml as main
3from ._phyloxml import *
4from ._phyloxml_tree import PhyloxmlTree
6_phyloxml.Phylogeny.subclass = PhyloxmlTree
8class Phyloxml(_phyloxml.Phyloxml):
9 def __repr__(self):
10 return "PhyloXML project <%s>" %hex(hash(self))
12 def __init__(self, *args, **kargs):
13 _phyloxml.Phyloxml.__init__(self, *args, **kargs)
15 def build_from_file(self, fname):
16 doc = _phyloxml.parsexml_(fname)
17 rootNode = doc.getroot()
18 rootTag, rootClass = _phyloxml.get_root_tag(rootNode)
19 if rootClass is None:
20 rootTag = 'phyloxml'
21 rootClass = self.__class__
22 self.build(rootNode)
24 def export(self, outfile=stdout, level=0):
25 namespace = 'xmlns:phy="http://www.phyloxml.org/1.10/phyloxml.xsd"'
26 return super(Phyloxml, self).export(outfile=outfile, level=level, namespacedef_=namespace)
29__all__ = _phyloxml.__all__ + ["Phyloxml", "PhyloxmlTree"]