Converts a pubtator_context result into a relation network:
graph-ready nodes and edges, plus a lean evidence
table that maps each edge back to the PubTator relation row and, when the
endpoint mentions share a sentence, the supporting sentence.
pubtator_network(x)A list returned by pubtator_context, with
entities, relations, and sentences data.tables.
A named list with three data.tables:
nodesOne row per normalized relation endpoint. Columns:
id, type, label, n_mentions, and
n_pmids. Entity identifiers are used when present; otherwise
nodes fall back to type:text.
edgesOne row per directed PubTator relation edge. Columns:
from, to, relation_type, weight,
n_pmids, and n_sentences.
evidenceOne row per PubTator relation row. Columns:
from, to, relation_type, pmid,
relation_id, same_sentence, sentence_distance,
and sentence. The sentence is populated only when the relation
endpoints share a sentence.
if (FALSE) { # \dontrun{
pmids <- search_pubmed('"doxorubicin"[TiAb] AND "cardiotoxicity"[TiAb]')
ctx <- pmids |>
get_records(endpoint = "pubtator") |>
pubtator_context()
net <- pubtator_network(ctx)
net$nodes
net$edges
net$evidence
} # }