From 5683014d90ed67102d08d17a08a67237c026b831 Mon Sep 17 00:00:00 2001 From: haohangyan Date: Thu, 31 Oct 2024 16:12:22 -0400 Subject: [PATCH] Agent type can be either object or subject in get_stmts_for_agent_type --- src/indra_cogex/client/queries.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/indra_cogex/client/queries.py b/src/indra_cogex/client/queries.py index 90aca5401..fe71f83b0 100644 --- a/src/indra_cogex/client/queries.py +++ b/src/indra_cogex/client/queries.py @@ -1272,14 +1272,17 @@ def get_stmts_for_agent_type( RETURN p LIMIT $limit """ else: - raise ValueError("agent_role must be 'subject' or 'object'") + query = """ + MATCH p = (a:BioEntity {name: $agent_name})-[r:indra_rel]-(b:BioEntity) + RETURN p LIMIT $limit + """ params = { "agent_name": agent_name, "limit": limit } - logger.info(f"Getting statements for agent '{agent_name}' as '{agent_role}' with limit {limit}") + logger.info(f"Getting statements for agent '{agent_name}' with limit {limit}") rels = client.query_relations(query, **params) stmts = indra_stmts_from_relations(rels, deduplicate=True) if evidence_limit and evidence_limit > 1: