Skip to content

Commit

Permalink
Use pmids instead of pubmeds
Browse files Browse the repository at this point in the history
  • Loading branch information
bgyori committed Dec 11, 2023
1 parent 4a39f28 commit ba3fc24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/indra_cogex/client/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"get_evidences_for_stmt_hash",
"get_evidences_for_stmt_hashes",
"get_stmts_for_paper",
"get_stmts_for_pubmeds",
"get_stmts_for_pmids",
"get_stmts_for_mesh",
"get_stmts_meta_for_stmt_hashes",
"get_stmts_for_stmt_hashes",
Expand Down Expand Up @@ -955,16 +955,16 @@ def get_stmts_for_paper(


@autoclient()
def get_stmts_for_pubmeds(
pubmeds: List[Union[str, int]], *, client: Neo4jClient, **kwargs
def get_stmts_for_pmids(
pmids: List[Union[str, int]], *, client: Neo4jClient, **kwargs
) -> List[Statement]:
"""Return the statements with evidence from the given PubMed IDs.
Parameters
----------
client :
The Neo4j client.
pubmeds :
pmids :
The PMIDs to query
Returns
Expand All @@ -976,15 +976,15 @@ def get_stmts_for_pubmeds(
-------
.. code-block::
from indra_cogex.client.queries import get_stmts_for_pubmeds
from indra_cogex.client.queries import get_stmts_for_pmids
pubmeds = [20861832, 19503834]
stmts = get_stmts_for_pubmeds(pubmeds)
pmids = [20861832, 19503834]
stmts = get_stmts_for_pmids(pmids)
"""
pubmeds = sorted(f"pubmed:{pubmed}" for pubmed in pubmeds)
pmids = sorted(f"pubmed:{pmid}" for pmid in pmids)
hash_query = f"""\
MATCH (e:Evidence)-[:has_citation]->(p:Publication)
WHERE p.id IN {repr(pubmeds)}
WHERE p.id IN {repr(pmids)}
RETURN e.stmt_hash, e.evidence
"""
result = client.query_tx(hash_query)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ def test_get_stmts_for_pmid():


@pytest.mark.nonpublic
def test_get_stmts_for_pmid():
def test_get_stmts_for_pmids():
# Two queries: first evidences, then the statements
client = _get_client()
pubmeds = ["14898026"]
stmts = get_stmts_for_pubmeds(pubmeds, client=client)
pmids = ["14898026"]
stmts = get_stmts_for_pmids(pmids, client=client)
assert stmts
assert isinstance(stmts[0], Statement)

Expand Down

0 comments on commit ba3fc24

Please sign in to comment.