Skip to content
New issue

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

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

Already on GitHub? # to your account

Biocypher does not connect types from tail ontologies (Gene Ontology example) #28

Open
kgaydukova opened this issue Aug 6, 2024 · 0 comments
Labels
biocypher Bug related to BioCypher

Comments

@kgaydukova
Copy link
Collaborator

kgaydukova commented Aug 6, 2024

When we describe some type in Biocypher schema_config.file from tail ontology, for example, molecular_function term from Gene Ontology

molecular function:
    represented_as: node
    input_label: molecular_function

or

molecular_function:
    represented_as: node
    input_label: molecular_function

we have an error :

Traceback (most recent call last):
  File "/Users/egayduko/Desktop/oncodashkb/./weave.py", line 192, in <module>
    bc.write_nodes(nodes)
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/biocypher/_core.py", line 235, in write_nodes
    return self._writer.write_nodes(tnodes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/biocypher/_write.py", line 201, in write_nodes
    passed = self._write_node_data(nodes, batch_size)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/biocypher/_write.py", line 366, in _write_node_data
    all_labels = self.ontology.get_ancestors(label)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/biocypher/_ontology.py", line 491, in get_ancestors
    return nx.dfs_tree(self._nx_graph, node_label)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/networkx/algorithms/traversal/depth_first_search.py", line 139, in dfs_tree
    T.add_edges_from(dfs_edges(G, source, depth_limit))
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/networkx/classes/digraph.py", line 768, in add_edges_from
    for e in ebunch_to_add:
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/networkx/algorithms/traversal/depth_first_search.py", line 84, in dfs_edges
    stack = [(start, depth_limit, iter(G[start]))]
                                       ~^^^^^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/networkx/classes/graph.py", line 513, in __getitem__
    return self.adj[n]
           ~~~~~~~~^^^
  File "/Users/egayduko/Library/Caches/pypoetry/virtualenvs/oncodashkb-mdmvUq_Q-py3.11/lib/python3.11/site-packages/networkx/classes/coreviews.py", line 81, in __getitem__
    return AtlasView(self._atlas[name])
                     ~~~~~~~~~~~^^^^^^
KeyError: 'molecular function'

If we use is_a to specify a type from the Biolink model, it starts to work.

molecular function:
    is_a: molecular activity #name in biolink
    represented_as: node
    input_label: molecular_function

@kgaydukova kgaydukova changed the title Biocypher do not connect types from tail ontologies (Gene Ontology example) Biocypher does not connect types from tail ontologies (Gene Ontology example) Aug 6, 2024
@jdreo jdreo added the biocypher Bug related to BioCypher label Nov 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
biocypher Bug related to BioCypher
Projects
None yet
Development

No branches or pull requests

2 participants