Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'features' #19

Open
gmartinezredondo opened this issue Dec 6, 2021 · 4 comments
Open

Comments

@gmartinezredondo
Copy link

Hi!

I am using pyham 1.1.11 with 4 different gene trees/orthoxml files with a large species tree, and another orthoxml with a second species tree which is a clade within the other one. However, when I use the species trees without modifications I get this error:
Traceback (most recent call last): 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.11/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.11/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.11/lib/python3.7/site-packages/pyham/parsers.py", line 159, in end ln['node'].set_MRCA() File "/opt/cesga/2020/software/Core/pyham/1.1.11/lib/python3.7/site-packages/pyham/abstractgene.py", line 512, in set_MRCA self.MRCA = self.ham._get_ancestral_genome_by_taxon(self.MRCA.taxon.up) File "/opt/cesga/2020/software/Core/pyham/1.1.11/lib/python3.7/site-packages/pyham/ham.py", line 907, in _get_ancestral_genome_by_taxon if "genome" in tax_node.features: AttributeError: 'NoneType' object has no attribute 'features'

If I add to the species trees an outgroup species (not present in the orthoxml file), pyham runs without any issue for all genes but one.

Why is it working if I add an outgroup species but not without it? What could be the source of the error?

I attach the smallest of my datasets (the original and modified species tree) to see if you can see where the issue lies.
eglps.orthoxml.txt
insecta_original.nwk.txt
insecta_with_outgroup.nwk.txt

@F4llis
Copy link
Contributor

F4llis commented Dec 6, 2021

Dear gmartinezredondo,

This is indeed not a normal behavior from pyham, it should run without the need to add an outgroup.

However, the newick files you send me are identicals. (md5 1532a2ea3364f46182a5fab65605c623 for both)

Also ALWAYS make sure you are using the reference species tree used to built the HOGs.

Clement

@gmartinezredondo
Copy link
Author

Hi, Clement:

My bad. I uploaded the same file by mistake.

It is supposed to be the same reference species tree I used to build the HOGs. I execute all the steps using the same script. But I will double check everything, just in case.

insecta_original.nwk.txt

@gmartinezredondo
Copy link
Author

gmartinezredondo commented Dec 13, 2021 via email

@alpae
Copy link
Member

alpae commented Nov 25, 2022

Hi @gmartinezredondo

sorry for the late reply. It seems that your orthoxml file is not in agreement with the species tree. The gene from your outgroup species MHRA1 is somewhere deep in the orthologGroup/paralogGroup nesting. According the orthoxml file, the XVES1_DN6789_c0_g1_i1.p1 should be the outgroup protein, but that species is completely nested in the tree.

My feeling is that your gene tree is not properly rooted and you used a simple species overlap method for the label the events on the gene tree. Instead, you should properly reconcile the gene tree with your species tree you use for pyham.

Feel free to get back to us.
Best wishes
Adrian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants