DessimozLab / pyham

MIT License
9 stars 5 forks source link

TypeError: expect subclass obj of 'AncestralGenome', got ExtantGenome #7

Open ethanbass opened 4 years ago

ethanbass commented 4 years ago

Hi, I am trying to set up a HAM from the latest OMA release (https://omabrowser.org/oma/current/) as in the tutorial here (https://zoo.cs.ucl.ac.uk/tutorials/tutorial_pyHam_get_started.html).

import pyham
nwk_path = "./speciestree.nwk"
orthoxml_path =  "./oma-hogs.orthoXML"
ham_analysis = pyham.Ham(nwk_path, orthoxml_path, use_internal_name=True, tree_format='newick')

It comes back with the following error:

Traceback (most recent call last):

  File "<ipython-input-6-9b28b33953bd>", line 1, in <module>
    ham_analysis = pyham.Ham(nwk_path, orthoxml_path, use_internal_name=True, tree_format='newick')

  File "/Users/ethanbass/Downloads/pyham_master/pyham/ham.py", line 273, in __init__
    self.top_level_hogs, self.extant_gene_map, self.external_id_mapper = self._build_hogs_and_genes(orthoxml_file, filter_object=self.filter_obj)

  File "/Users/ethanbass/Downloads/pyham_master/pyham/ham.py", line 829, in _build_hogs_and_genes
    parser.feed(line)

  File "/Users/ethanbass/Downloads/pyham_master/pyham/parsers.py", line 182, in end
    hog.set_genome(ancestral_genome)

  File "/Users/ethanbass/Downloads/pyham_master/pyham/abstractgene.py", line 245, in set_genome
    type(genome).__name__))

TypeError: expect subclass obj of 'AncestralGenome', got ExtantGenome

I would appreciate any insights into what might be causing this problem. Ethan

ethanbass commented 4 years ago

It appears that HOG 8703 is the first HOG that is triggering the error. The problem is that the 'ancestral genome' is also an 'extant genome': Methanoccoccus maripaludis. I'm not sure what the appropriate way is to deal with this? Should this node have an 'ancestral genome' object and an 'extant genome' object?

F4llis commented 4 years ago

Hello Ethan,

Just a few word to inform you that i'm investigating on this bug.

Also, I strongly recommend you to use the phyloxml tree instead of the newick tree !

Clement

ethanbass commented 4 years ago

Thank you very much for investigating. FIY, the same bug arises when using the phyloxml tree.