Open cannin opened 4 years ago
I did not find a direct method, but I found following methods which when used together can solve the purpose
import os
os.environ["INDRA_DB_REST_URL"] = "INDRA API"
from indra.literature import pubmed_client
from indra.sources import indra_db_rest
def get_stmts_from_term(search_term, maximum_articles = 10):
pmid_list = pubmed_client.get_ids(search_term.strip(), retmax = maximum_articles)
search_pmid_list = [('pmid',pmid) for pmid in pmid_list]
stmts = []
if search_pmid_list:
stmts = indra_db_rest.get_statements_for_paper(search_pmid_list).statements
return stmts
# Main
search_term = input("Please Enter Search Query: ")
get_stmts_from_term(search_term)
Can you please check if this addresses the requirement. Should I make a PR to INDRA adding this function? or should I make a gist of the function and attach link here?
Thanks
I think this task is separate from others.
Do we have a function where I can pass in a string (this will be a PubMed query) and it returns INDRA statements? If not, can you create one? It should have a parameter that limits the number of articles to send to INDRA set to 10 as default. The INDRA statements should be merged into one collection.