Used to 'transfer' information from nodes to other nodes across specific predicates, either in an outward direction (along the edge direction) or inward (against the edge direction). Returns a node-property column; intended to be used with mutate() on nodes.
transfer(colname = NULL, over, direction = "out")
Vector or list, with one entry per node.
The return value will be either a list, or if the result would be a list with all length-1 or length-0 elements, a vector with 0-length elements replaced by NA. Practically, this results in a list when necessary and a vector otherwise.
engine <- file_engine(system.file("extdata", "eds_marfan_kg.tar.gz", package = "monarchr"))
engine |> fetch_nodes(name %~% "COL1A") |>
expand(categories = "biolink:Disease") |>
activate(nodes) |>
mutate(caused_by_genes = transfer(name, over = "biolink:causes", direction = "out")) |>
mutate(causes_diseases = transfer(name, over = "biolink:causes", direction = "in")) |>
plot.tbl_kgx(node_label = paste(name,
" caused by: ", caused_by_genes,
" causes: ", causes_diseases),
label_size = 3)
#> Error in plot.tbl_kgx(mutate(mutate(activate(expand(fetch_nodes(engine, name %~% "COL1A"), categories = "biolink:Disease"), nodes), caused_by_genes = transfer(name, over = "biolink:causes", direction = "out")), causes_diseases = transfer(name, over = "biolink:causes", direction = "in")), node_label = paste(name, " caused by: ", caused_by_genes, " causes: ", causes_diseases), label_size = 3): could not find function "plot.tbl_kgx"