-
Notifications
You must be signed in to change notification settings - Fork 30
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
to_bel_script() invokes a TypeError: make_knowledge_header() missing 1 required positional argument: 'name' #436
Comments
It should give nicer output but to write to bel script you need to set the name of the graph. I think the version as well. |
Thanks! Now I am getting this error: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-999f6b46130e> in <module>
4 mars_graph.name = 'MARS_Indra'
5 mars_graph.version = emmaa_covid_graph.version
----> 6 pybel.to_bel_script(mars_graph,os.path.join(curation_dir,'mars_indra.bel'))
</Users/zuck016/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/decorator.py:decorator-gen-803> in to_bel_script(graph, path, use_identifiers)
~/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/networkx/utils/decorators.py in _open_file(func_to_be_decorated, *args, **kwargs)
238 # Finally, we call the original function, making sure to close the fobj
239 try:
--> 240 result = func_to_be_decorated(*new_args, **kwargs)
241 finally:
242 if close_fobj:
~/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/pybel/canonicalize.py in to_bel_script(graph, path, use_identifiers)
46 :param use_identifiers: Enables extended `BEP-0008 <http://bep.bel.bio/published/BEP-0008.html>`_ syntax
47 """
---> 48 for line in to_bel_script_lines(graph, use_identifiers=use_identifiers):
49 print(line, file=path)
50
~/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/pybel/canonicalize.py in _to_bel_lines_body(graph, use_identifiers)
296 keys = sorted(annotations_data) if annotations_data is not None else tuple()
297 for key in keys:
--> 298 yield _set_annotation_to_str(annotations_data, key)
299
300 yield graph.edge_to_bel(u, v, data, use_identifiers=use_identifiers)
~/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/pybel/canonicalize.py in _set_annotation_to_str(annotation_data, key)
233 value = annotation_data[key]
234
--> 235 if len(value) == 1:
236 return 'SET {} = "{}"'.format(key, list(value)[0])
237
TypeError: object of type 'NoneType' has no len() |
Weirdly, when I try this: from pybel.canonicalize import _set_annotation_to_str
for u,v,data in mars_graph.edges(data=True):
annotations_data = data.get("ANNOTATIONS")
keys = sorted(annotations_data) if annotations_data is not None else tuple()
for key in keys:
print(_set_annotation_to_str(annotations_data, key))
print("No keys found") I just get:
So I am not sure how to reproduce this error. |
Quite strange, maybe you could try and figure out for which annotation there's a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @cthoyt
When I try to run
pybel.to_bel_script()
I get the following error:According to:
https://github.com/pybel/bel-resources/blob/master/src/bel_resources/write_document.py#L17
make_knowledge_header()
requires a positionalname
parameterHowever,
pybel/src/pybel/canonicalize.py
Lines 259 to 266 in e108252
attempts to call
make_knowledge_header()
without calling thename
parameter.The text was updated successfully, but these errors were encountered: