DessimozLab / pyham

MIT License
9 stars 5 forks source link

More species in the species tree than in the orthoXML file #17

Closed gmartinezredondo closed 2 years ago

gmartinezredondo commented 2 years ago

Hi!

I have a question. Does pyHam allow using an orthoXML file that contains fewer species than the species tree? Say, for instance, that a given gene has been completely lost on a species and the orthoXML has been created without taking the species tree into account and it does not include this species. PyHam raised an error and I'm not sure whether this is the cause:

File "/mnt/netapp2/Store_csbye/scripts/orthoxml_pyham.py", line 44, in <module>
    ham_analysis = pyham.Ham(tree_str, orthoxml_path, use_internal_name=False)
  File "/opt/cesga/2020/software/Core/pyham/1.1.10/lib/python3.7/site-packages/pyham/ham.py", line 263, 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 "/opt/cesga/2020/software/Core/pyham/1.1.10/lib/python3.7/site-packages/pyham/ham.py", line 819, in _build_hogs_and_genes
    parser.feed(line)
  File "/opt/cesga/2020/software/Core/pyham/1.1.10/lib/python3.7/site-packages/pyham/parsers.py", line 154, in end
    ln['node'].set_MRCA()
  File "/opt/cesga/2020/software/Core/pyham/1.1.10/lib/python3.7/site-packages/pyham/abstractgene.py", line 508, in set_MRCA
    self.MRCA = self.ham._get_ancestral_genome_by_taxon(list(children_genomes)[0].taxon.up)
IndexError: list index out of range

Gemma

gmartinezredondo commented 2 years ago

I tried with another dataset where this also happened and it works fine. So it seems that this was not the cause. What could be the source of the error above, then?

alpae commented 2 years ago

Hi @gmartinezredondo

it's quite tricky to answer this without a concrete example. are you able to share your species tree and orthoxml file where this happens?

gmartinezredondo commented 2 years ago

Sure, here are the orthoxml and the species tree:

species tree orthoxml

Thank you very much

alpae commented 2 years ago

pyham release 1.1.11 seems to fix this problem for me. please upgrade pyham and retry. in case the issue persist, feel free to reopen the issue.

Cheers Adrian