3 if '_parent' not in self.__dict__:
4 if not hasattr(self,
'_id'):
5 print(
"'id' is not defined, cannot fetch the parent node")
7 copy = self.server.getTaxonomyEntryByID(self.id)
8 self.__dict__[
'_parent'] = copy.__dict__[
'_parent']
9 return self.__dict__[
'_parent']
14 if '_children' not in self.__dict__:
15 if not hasattr(self,
'_id'):
16 print(
"'id' is not defined, cannot fetch the parent node")
18 copy = self.server.getTaxonomyEntryByID(self.id)
19 self.__dict__[
'_children'] = copy.__dict__[
'_children']
20 return self.__dict__[
'_children']
25 from .
import _pyrest_core
28 """A node in the NCBI taxonomy"""
30 parent = property(_tax_parent,
None,
None,
"""Parent node in the taxonomy""")
32 children = property(_tax_children,
None,
None,
"""Child nodes in the taxonomy""")
34 tags = property(_pyrest_core.fget(
"_tags"),
None,
None,
"""Additionnal tags""")
36 NCBITaxon._construction_rules = {
"children":NCBITaxon,
"parent":NCBITaxon,
"tags":
None}
39 """A leaf of a gene-tree, i.e. a protein / gene"""
41 id = property(_pyrest_core.fget(
"_id"),
None,
None,
"""Protein / transcript identifier""")
43 mol_seq = property(_pyrest_core.fget(
"_mol_seq"),
None,
None,
"""DNA / protein sequence""")
48 """The evolutionary event that took place at this node of the tree"""
50 class GeneTreeNode(_pyrest_core.BaseObject):
51 """Node in a gene-tree"""
53 taxonomy = property(_pyrest_core.fget(
"_taxonomy"),
None,
None,
"""Taxonomy annotation of this node""")
55 children = property(_pyrest_core.fget(
"_children"),
None,
None,
"""Child nodes in the gene-tree""")
57 confidence = property(_pyrest_core.fget(
"_confidence"),
None,
None,
"""The confidence tags attached to a given gene-tree node""")
59 id = property(_pyrest_core.fget(
"_id"),
None,
None,
"""Gene identifier (only for leaves)""")
61 events = property(_pyrest_core.fget(
"_events"),
None,
None,
"""The evolutionary event that took place at this node""")
63 sequence = property(_pyrest_core.fget(
"_sequence"),
None,
None,
"""GeneTreeMember (only for leaves)""")
65 GeneTreeNode._construction_rules = {
"children":GeneTreeNode,
"confidence":
None,
"events":GeneTreeEvent,
"id":
genome.Identifier,
"sequence":GeneTreeMember,
"taxonomy":NCBITaxon}
68 """Global object for gene-trees"""
70 tree = property(_pyrest_core.fget(
"_tree"),
None,
None,
"""root node""")
72 id = property(_pyrest_core.fget(
"_id"),
None,
None,
"""GeneTree stable identifier""")
74 GeneTree._construction_rules = {
"tree":GeneTreeNode}
79 class Homolog(_pyrest_core.BaseObject):
82 class HomologyPair(_pyrest_core.BaseObject):
85 target = property(_pyrest_core.fget(
"_target"),
None,
None,
"""Paralog of the query gene / Ortholog in the other species""")
87 source = property(_pyrest_core.fget(
"_source"),
None,
None,
"""Query gene""")
89 HomologyPair._construction_rules = {
"source":Homolog,
"target":Homolog}
92 """Group of multiple homology-pairs"""
94 homologies = property(_pyrest_core.fget(
"_homologies"),
None,
None,
"""All the homology pairs""")
96 HomologyGroup._construction_rules = {
"homologies":HomologyPair}
101 class GenomicAlignment(_pyrest_core.BaseObject):
104 alignments = property(_pyrest_core.fget(
"_alignments"),
None,
None,
"""All the alignment-bloks for this query region""")
106 GenomicAlignment._construction_rules = {
"alignments":GenomicAlignmentEntry}
111 Get all the leaves under this node
113 if '_children' not in self.__dict__:
116 for n
in self.children:
117 l.extend(n.get_all_leaves())
120 setattr(GeneTreeNode,
'get_all_leaves', _gtn_get_all_leaves)
124 Get all the nodes in this sub-tree, including the root
126 if '_children' not in self.__dict__:
129 for n
in self.children:
130 l.extend(n.get_all_nodes())
133 setattr(GeneTreeNode,
'get_all_nodes', _gtn_get_all_nodes)
137 Get all the leaves in this tree
139 return self.tree.get_all_leaves()
141 setattr(GeneTree,
'get_all_leaves', _gt_get_all_leaves)
145 Get all the nodes in this tree
147 return self.tree.get_all_nodes()
149 setattr(GeneTree,
'get_all_nodes', _gt_get_all_nodes)
Group of multiple homology-pairs.
def _gtn_get_all_nodes
Get all the nodes in this sub-tree, including the root.
def _gtn_get_all_leaves
Get all the leaves under this node.
A node in the NCBI taxonomy.
def _gt_get_all_leaves
Get all the leaves in this tree.
def _gt_get_all_nodes
Get all the nodes in this tree.
Global object for gene-trees.
The evolutionary event that took place at this node of the tree.
A leaf of a gene-tree, i.e.