def __init__(self, prop_dict, taxomachine_wrapper=None, taxonomy=None, taxon=None): if taxon is None: taxon = TaxonWrapper(taxomachine_wrapper=taxomachine_wrapper, taxonomy=taxonomy, prop_dict=prop_dict) TaxonHolder.__init__(self, taxon) self._score = prop_dict.get('score') self._is_approximate_match = prop_dict.get('is_approximate_match')
def __init__(self, prop_dict, treemachine_wrapper=None, graph_of_life=None, taxon=None, nearest_taxon=None, node_id=None): self._treemachine_wrapper = treemachine_wrapper self._graph_of_life = graph_of_life if node_id is None: self._node_id = prop_dict['mrca_node_id'] else: self._node_id = node_id if taxon is None: oi = prop_dict.get('ott_id') if oi == 'null': oi = None if oi is not None: taxon_dict = {'ot:ottId': oi, 'rank': prop_dict.get('mrca_rank'), 'ot:ottTaxonName': prop_dict.get('mrca_name'), 'unique_name': prop_dict.get('mrca_unique_name'), 'treemachine_node_id': self.node_id } #TODO should write wrappers for getting the taxomachine wrapper from treemachine wrapper... taxon = TaxonWrapper(prop_dict=taxon_dict) if nearest_taxon is None: taxon_dict = {'ot:ottId': prop_dict['nearest_taxon_mrca_ott_id'], 'rank': prop_dict.get('nearest_taxon_mrca_rank'), 'ot:ottTaxonName': prop_dict.get('nearest_taxon_mrca_name'), 'unique_name': prop_dict.get('nearest_taxon_mrca_unique_name'), 'treemachine_node_id': prop_dict.get('nearest_taxon_mrca_node_id') } assert prop_dict['nearest_taxon_mrca_ott_id'] != 'null' #TODO should write wrappers for getting the taxomachine wrapper from treemachine wrapper... self._nearest_taxon = TaxonWrapper(prop_dict=taxon_dict) else: self._nearest_taxon = nearest_taxon TaxonHolder.__init__(self, taxon) if self._taxon is not None: assert (nearest_taxon is None) or (nearest_taxon is self._taxon) self._nearest_taxon = self._taxon self._subtree_newick = None self._synth_sources = prop_dict.get('synth_sources') self._in_synth_tree = prop_dict.get('in_synth_tree') self._tax_source = prop_dict.get('tax_source') self._in_graph = prop_dict.get('in_graph') self._num_tips = prop_dict.get('num_tips') self._num_synth_children = prop_dict.get('num_synth_children')