SyntaxError: keyword can't be an expression

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SyntaxError: keyword can't be an expression

Gopi
Hi,
I am trying to use onto.search function on HGNC ontology. HGNC has a property name "approved-symbol". During compilation the compiler is throwing a Syntax error. Can someone help me with this?

HGNC= get_ontology("HGNC.nt").load()
print(HGNC.search(aprroved-symbol="BRCA1"))

Error:
print(Hugo.search(aprroved-symbol="BRCA1"))
                     ^
SyntaxError: keyword can't be an expression
Reply | Threaded
Open this post in threaded view
|

Re: SyntaxError: keyword can't be an expression

Jiba
Administrator
Hi,

"approved-symbol" is not a valid attribute name in Python (due to the -), so you cannot use it as such. You can use it in a dict:

print(HGNC.search( ** { "approved-symbol" : "BRCA1" } ))

Jiba