dhimmel / uberon

User-friendly anatomical structures data from the Uberon Ontology
https://doi.org/10.15363/thinklab.d41
1 stars 1 forks source link

human-constraint.ipynb: RecursionError: maximum recursion depth exceeded #2

Open hyosilpro opened 3 years ago

hyosilpro commented 3 years ago

An error occurred in the module below. I used the current version uberon 2021.02.13. But when I used the old version you provided 2015-07-24 Uberon release, there is no error.

The error message is:

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-9-8c5d22ff6c90> in <module>
      9     # Find whether term is in humans by seeing if node or its children
     10     # xref specific human terminologies
---> 11     children = get_children(ontology, node, in_keys = {'is_a', 'part_of', 'develops_from'})
     12     child_xrefs = set()
     13     for child in children | {node}:

<ipython-input-7-44d667171172> in get_children(graph, node, in_keys, out_keys)
      4         if key in in_keys:
      5             children.add(u)
----> 6             children |= get_children(graph, u)
      7     for u, v, key in graph.out_edges(node, keys=True):
      8         if key in out_keys:

... last 1 frames repeated, from the frame below ...

<ipython-input-7-44d667171172> in get_children(graph, node, in_keys, out_keys)
      4         if key in in_keys:
      5             children.add(u)
----> 6             children |= get_children(graph, u)
      7     for u, v, key in graph.out_edges(node, keys=True):
      8         if key in out_keys:

RecursionError: maximum recursion depth exceeded
-------------------------------------------------------------------------------------------------------

The error message was as follows, and I tried several things, but it didn't work. What should I do?

-------------------------------------------------------------------------------------------------------
import sys
sys.setrecursionlimit(30000)
print(sys.getrecursionlimit())
-------------------------------------------------------------------------------------------------------
The kernel for  human-constraint.ipynb appears to have died. It will restart automatically.
-------------------------------------------------------------------------------------------------------

Kindly regards

dhimmel commented 3 years ago

Sounds like there is a cycle in the graph. The 2021-02-13 Uberon must not directed acyclic for the union of the is_a, part_of, develops_from relations.

What if you remove develops_from from in_keys?

hyosilpro commented 3 years ago

I did remove develops_from from in_keys, but same error has occured.

so, I download human subset.

following link data set http://uberon.github.io/downloads.html#subsets

https://raw.githubusercontent.com/obophenotype/uberon/master/subsets/human-view.obo

And then the problem was solved.

dhimmel commented 3 years ago

Ah, nice to see that Uberon now has a human view. This wasn't around when we made human-constraint.ipynb, such that you probably don't need human-constraint.ipynb at all anymore. Since now you can just use human-view.obo as the input ontology for process.ipynb.

hyosilpro commented 3 years ago

Ah, nice to see that Uberon now has a human view. This wasn't around when we made human-constraint.ipynb, such that you probably don't need human-constraint.ipynb at all anymore. Since now you can just use human-view.obo as the input ontology for process.ipynb.

When I checked the code, it was determined that as you mentioned. just start ' process.ipynb` . Thank you very much for your reply.