Skip to content

Commit

Permalink
Merge pull request #10 from bschilder/main
Browse files Browse the repository at this point in the history
Add rworkflows CI + Get closer to passing rcmdchecks
  • Loading branch information
oneilsh authored Mar 18, 2024
2 parents 317f746 + 1a881c2 commit 1f78b92
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@
^LICENSE\.md$
^meta$
^docs$

^\.lintr$
^\.github$
^\.vscode$

## For GitHub Actions Windows runner
node_modules$
package-lock\.json$
package\.json$
57 changes: 57 additions & 0 deletions .github/workflows/rworkflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: rworkflows
'on':
push:
branches:
- master
- main
- devel
- RELEASE_**
pull_request:
branches:
- master
- main
- devel
- RELEASE_**
jobs:
rworkflows:
permissions: write-all
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
container: ${{ matrix.config.cont }}
strategy:
fail-fast: ${{ false }}
matrix:
config:
- os: ubuntu-latest
bioc: devel
r: auto
cont: ghcr.io/bioconductor/bioconductor_docker:devel
rspm: ~
- os: macOS-latest
bioc: release
r: auto
cont: ~
rspm: ~
- os: windows-latest
bioc: release
r: auto
cont: ~
rspm: ~
steps:
- uses: neurogenomics/rworkflows@master
with:
run_bioccheck: ${{ false }}
run_rcmdcheck: ${{ true }}
as_cran: ${{ true }}
run_vignettes: ${{ true }}
has_testthat: ${{ true }}
run_covr: ${{ true }}
run_pkgdown: ${{ true }}
has_runit: ${{ false }}
has_latex: ${{ false }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run_docker: ${{ true }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
runner_os: ${{ runner.os }}
cache_version: cache-v1
docker_registry: ghcr.io
32 changes: 23 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
Package: monarchr
Type: Package
Title: What the Package Does (Title Case)
Version: 0.2.0
Author: Who wrote it
Maintainer: The package maintainer <[email protected]>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
Title: Monarch Knowledge Graph Queries
Description: R package for easy access, manipulation, and analysis of
Monarch KG data Resources.
Version: 0.2.1
Authors@R:
c(
person(given = "Shawn",
family = "O'Neil",
role = c("aut","cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-6220-7080")),
person(given = "Brian",
family = "Schilder",
role = c("aut","ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-5949-2191"))
)
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Imports:
assertthat,
colorDF,
dotenv,
dplyr,
tidyr,
ggiraph,
ggraph,
httr,
Expand All @@ -33,3 +44,6 @@ Imports:
tidygraph,
vcr,
yaml
Suggests:
testthat (>= 3.0.0),
knitr
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
S3method(explode,tbl_kgx)
S3method(select_nodes,monarch_kg)
export(cypher_query)
export(cypher_query_df)
export(edges)
export(fetch_edges)
export(monarch_search)
Expand Down
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# monarchr 0.2.1

* Add rworkflows GHA for automated checking, site building, and Docker container creation.
* Update *.Rbuildignore*.
* Add NEWS file.
* Add Title, Description, and Authors to *DESCRIPTION*.
- Hope you don't mind me adding our names here @oneilsh, I anticipate making lots of contributions!
* Add `tidyr` Import to *DESCRIPTION*.
* Add vignettes header info.
* Fix `edges` docs by adding title.
* Add `VignetteBuilder: knitr` to *DESCRIPTION*.
* Fix `cypher_query` example by adding `ids`
* Fix `cypher_query_df` example by adding `ids`
* Export `cypher_query_df`
* Get `monarchR` closer to passing rcmdcheck (methods for edges/nodes not yet being recognized)
6 changes: 4 additions & 2 deletions R/cypher_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ stitch_vectors <- function(x) {
#' query <- "MATCH (s) -[p]- (o) return s, p, o LIMIT 2"
#' parameters <- NULL
#' g <- cypher_query(query, parameters)
#'
#' ids <- c("MONDO:0007525", "MONDO:0020066", "MONDO:0034021")
#' query = "MATCH (n) WHERE n.id IN $ids RETURN n"
#' parameters = list(ids = ids)
#' g <- cypher_query(query, parameters)
Expand Down Expand Up @@ -162,9 +162,11 @@ cypher_query <- function(query, parameters = NULL, ...) {
#' @param parameters A list of parameters for the Cypher query. Default is an empty list.
#' @param ... Additional arguments passed to the function.
#' @return A data frame containing the result of the Cypher query.
#' @export
#' @examples
#' query <- "MATCH (n) RETURN n LIMIT 10"
#' parameters <- list()
#' ids <- c("MONDO:0007525", "MONDO:0020066", "MONDO:0034021")
#' parameters <- list(ids = ids)
#' result <- cypher_query_df(query, parameters)
#' @importFrom neo2R cypher
cypher_query_df <- function(query, parameters = list(), ...) {
Expand Down
7 changes: 7 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#' Get tbl_kgx graph nodes table.
#'
#' @importFrom tidygraph as_tibble
#' @examples
#' g <- monarch_search("fanconi anemia", limit = 1)
Expand All @@ -6,6 +8,8 @@ nodes.tbl_kgx <- function(x, ...) {
tidygraph::as_tibble(x, active = "nodes")
}

#' Get tbl_kgx graph edges table.
#'
#' @importFrom tidygraph as_tibble
#' @examples
#' g <- monarch_search("fanconi anemia", limit = 1)
Expand All @@ -29,6 +33,9 @@ nodes <- function(x, ...) {
UseMethod("nodes")
}

#' Get graph edges table.
#'
#' @return A tibble with the edges of the graph
#' @importFrom tidygraph as_tibble
#' @export
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion man/cypher_query.Rd

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

3 changes: 2 additions & 1 deletion man/cypher_query_df.Rd

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

19 changes: 19 additions & 0 deletions man/edges.Rd

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

15 changes: 15 additions & 0 deletions man/edges.tbl_kgx.Rd

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

15 changes: 15 additions & 0 deletions man/nodes.tbl_kgx.Rd

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

11 changes: 8 additions & 3 deletions vignettes/Basics.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
title: "MonarchR Basics"
author: "Shawn T O'Neil"
date: "2024-02-17"
output: html_document
date: "<h4>Vignette updated: <i>`r format( Sys.Date(), '%b-%d-%Y')`</i></h4>"
output:
rmarkdown::html_document
vignette: >
%\VignetteIndexEntry{Basics}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
Expand Down Expand Up @@ -243,5 +248,5 @@ eds_search %>% # starting with a
explode() %>% # split into a list of 5 single-node graphs
lapply(fetch_edges) %>% # fetch neighborhood edges for each graph
lapply(nodes) %>% # extract nodes df from each graph
lapply(function(nodes_df) {filter(nodes_df, is.na(source))}) # remove original seached nodes from each df
lapply(function(nodes_df) {filter(nodes_df, is.na(source))}) # remove original searched nodes from each df
```

0 comments on commit 1f78b92

Please sign in to comment.