Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: Monarch Knowledge Graph Queries
Description: R package for easy access, manipulation, and analysis of
Monarch KG data Resources.
Version: 2.1.1
Version: 2.1.2
URL: https://github.com/monarch-initiative/monarchr
BugReports: https://github.com/monarch-initiative/monarchr/issues
Authors@R:
Expand Down Expand Up @@ -43,7 +43,7 @@ Imports:
archive,
readr,
ggraph,
ggplot2,
ggplot2 (>= 4.0.0),
R.utils,
RCy3,
digest,
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# monarchr 2.1.2

## Bug Fixes

* Better fix for `edge_color`
* Improved documentation for `transitive_closure()`, `transitive_reduction()`, `transfer()`, `roll_up()`, `roll_down()`

# monarchr 2.1.1

## Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions R/plot.tbl_kgx.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @param layout The layout to use for the plot. Default is "auto" as used by `ggraph`.
#' @param node_color The column to use for node color. Default is "pcategory".
#' @param node_shape The column to use for node shape Default is "namespace".
#' @param edge_color The column to use for edge color. Default is NULL.
#' @param edge_color The column to use for edge color. Default is "predicate".
#' @param edge_linetype The column to use for edge line type. Default is "primary_knowledge_source".
#' @param node_label The column to use for node labels. Defaults to "name".
#' @param plot_ids Whether to show node IDs in node labels. Defaults to FALSE.
Expand Down Expand Up @@ -33,7 +33,7 @@ plot.tbl_kgx <- function(g,
layout = "auto",
node_color = pcategory,
node_shape = namespace,
edge_color = NULL,
edge_color = predicate,
edge_linetype = primary_knowledge_source,
node_label = name,
plot_ids = FALSE,
Expand Down
12 changes: 8 additions & 4 deletions R/rollup.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,15 @@ roll <- function( column,
#' @examples
#' data(eds_marfan_kg)
#'
#' eds_marfan_kg |> fetch_nodes(name == "Tall stature" | name == "Short stature") |>
#' expand_n(predicates = "biolink:subclass_of", direction = "out", n = 2) |> # get 2 levels of ancestors
#' eds_marfan_kg |>
#' fetch_nodes(name == "Tall stature" | name == "Short stature") |>
#' # get 2 levels of ancestors
#' expand_n(predicates = "biolink:subclass_of", direction = "out", n = 2) |>
#' activate(nodes) |>
#' mutate(count = rpois(graph_order(), 1.5)) |> # random count value per node
#' mutate(sum_count = roll_up(count, fun = sum, include_self = TRUE)) |> # apply sum to descendant (and self) values
#' # random count value per node
#' mutate(count = rpois(graph_order(), 1.5)) |>
#' # apply sum to descendant (and self) values
#' mutate(sum_count = roll_up(count, fun = sum, include_self = TRUE)) |>
#' plot(node_label = paste(name, " count: ", count, "sum_count: ", sum_count))
#'
#' @name rolling
Expand Down
9 changes: 7 additions & 2 deletions R/transfer.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
#'
#' @return Vector or list, with one entry per node.
#' @seealso [roll_up()], [transitive_closure], [descendants()], [ancestors()]
#' @param colname The node column to transfer information from
#' @param over The edge predicate to transfer information over
#' @param direction Whether to transfer information along the predicate direction ("out") or against ("in")
#'
#' @examples
#' data(eds_marfan_kg)
#'
#' engine |> eds_marfan_kg |>
#' 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")) |>
#' 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),
Expand Down
5 changes: 4 additions & 1 deletion R/transitive_closure.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
#'
#' @return Graph with transitive edges added.
#' @seealso [roll_up()], [transfer()], [descendants()], [ancestors()]
#' @param g The `tbl_kgx` graph to compute on.
#' @param predicate The edge predicate to close over.
#'
#' @examples
#' data(eds_marfan_kg)
#'
#' eds_marfan_kg |> fetch_nodes(name == "Tall stature") |>
#' expand_n(predicates = "biolink:subclass_of", direction = "out", n = 3) |> # get 2 levels of ancestors
#' # get 2 levels of ancestors
#' expand_n(predicates = "biolink:subclass_of", direction = "out", n = 3) |>
#' activate(edges) |>
#' filter(primary_knowledge_source == "infores:upheno") |>
#' transitive_closure(predicate = "biolink:subclass_of") |>
Expand Down
7 changes: 6 additions & 1 deletion R/transitive_reduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
#'
#' @return Graph with transitive edges added.
#' @seealso [transitive_closure()], [roll_up()], [transfer()], [descendants()], [ancestors()]
#' @param g The `tbl_kgx` graph to compute on.
#' @param predicate The edge predicate to reduce over.
#'
#' @examples
#' data(eds_marfan_kg)
#'
#' g <- eds_marfan_kg |> fetch_nodes(name == "Tall stature") |>
#' expand_n(predicates = "biolink:subclass_of", direction = "out", n = 3) |>
#' bind_edges(data.frame(from = 2, to = 9, predicate = "biolink_subclass_of", primary_knowledge_source = "hand_annotated"))
#' bind_edges(data.frame(from = 2,
#' to = 9,
#' predicate = "biolink_subclass_of",
#' primary_knowledge_source = "hand_annotated"))
#'
#' plot(g, edge_color = primary_knowledge_source)
#'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ monarchr
================
[![License: MIT + file
LICENSE](https://img.shields.io/badge/license-MIT%20+%20file%20LICENSE-blue.svg)](https://cran.r-project.org/web/licenses/MIT%20+%20file%20LICENSE)
[![](https://img.shields.io/badge/devel%20version-2.1.1-black.svg)](https://github.com/monarch-initiative/monarchr)
[![](https://img.shields.io/badge/devel%20version-2.1.2-black.svg)](https://github.com/monarch-initiative/monarchr)
<br> [![R build
status](https://github.com/monarch-initiative/monarchr/workflows/rworkflows/badge.svg)](https://github.com/monarch-initiative/monarchr/actions)
[![](https://codecov.io/gh/monarch-initiative/monarchr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/monarch-initiative/monarchr)
Expand Down
4 changes: 2 additions & 2 deletions man/plot.tbl_kgx.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/rolling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions man/transfer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion man/transitive_closure.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion man/transitive_reduction.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading