1# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com)
2# based on code by Eric Talevich (eric.talevich@gmail.com)
3#
4# This file is part of the Biopython distribution and governed by your
5# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
6# Please see the LICENSE file that should have been included as part of this
7# package.
8
9"""Classes corresponding to CDAO trees.
10
11See classes in ``Bio.Nexus``: Trees.Tree, Trees.NodeData, and Nodes.Chain.
12"""
13
14from Bio.Phylo import BaseTree
15
16
17class Tree(BaseTree.Tree):
18    """CDAO Tree object."""
19
20    def __init__(self, root=None, rooted=False, id=None, name=None, weight=1.0):
21        """Initialize value of for the CDAO tree object."""
22        BaseTree.Tree.__init__(
23            self, root=root or Clade(), rooted=rooted, id=id, name=name
24        )
25        self.weight = weight
26        # a list of (predicate, object) pairs, containing additional triples
27        # using this tree as subject
28        self.attributes = []
29
30
31class Clade(BaseTree.Clade):
32    """CDAO Clade (sub-tree) object."""
33
34    def __init__(
35        self, branch_length=1.0, name=None, clades=None, confidence=None, comment=None
36    ):
37        """Initialize values for the CDAO Clade object."""
38        BaseTree.Clade.__init__(
39            self,
40            branch_length=branch_length,
41            name=name,
42            clades=clades,
43            confidence=confidence,
44        )
45        self.comment = comment
46        # a list of (predicate, object) pairs, containing additional triples
47        # using this clade as subject
48        self.attributes = []
49        self.tu_attributes = []
50        self.edge_attributes = []
51