diff --git a/pyham/abstractgene.py b/pyham/abstractgene.py index 0f58531..b96819b 100644 --- a/pyham/abstractgene.py +++ b/pyham/abstractgene.py @@ -502,7 +502,6 @@ def set_MRCA(self): else: self.MRCA = self.ham._get_ancestral_genome_by_mrca_of_genome_set(children_genomes) - self.MRCA = self.ham._get_ancestral_genome_by_taxon(self.MRCA.taxon.up) def add_child(self, child): """ diff --git a/pyham/ham.py b/pyham/ham.py index d5b3a1b..f955f53 100644 --- a/pyham/ham.py +++ b/pyham/ham.py @@ -902,11 +902,12 @@ def _get_ancestral_genome_by_taxon(self, tax_node): :obj:`AncestralGenome` """ - - if "genome" in tax_node.features: + #make sure genome is ancestral genome + if "genome" in tax_node.features and isinstance(tax_node.genome, AncestralGenome): return tax_node.genome - + else: + #create genome or overwrite extant genome with ancestral genome ancestral_genome = AncestralGenome() self.taxonomy.add_genome_to_node(tax_node, ancestral_genome)