From 1f4e0f3a22847205fc8253c480a5e7ae60d54f0a Mon Sep 17 00:00:00 2001 From: Brandon Monier Date: Thu, 25 Apr 2024 13:45:32 -0500 Subject: [PATCH 1/8] Add "Get started" section --- .gitignore | 10 + vignettes/img/filtering/mat_01.svg | 335 +++++++++++++++++++++++++++++ vignettes/img/filtering/mat_02.svg | 334 ++++++++++++++++++++++++++++ vignettes/img/filtering/mat_03.svg | 334 ++++++++++++++++++++++++++++ vignettes/img/filtering/mat_04.svg | 334 ++++++++++++++++++++++++++++ vignettes/rPHG2.Rmd | 55 +++++ 6 files changed, 1402 insertions(+) create mode 100644 vignettes/img/filtering/mat_01.svg create mode 100644 vignettes/img/filtering/mat_02.svg create mode 100644 vignettes/img/filtering/mat_03.svg create mode 100644 vignettes/img/filtering/mat_04.svg create mode 100644 vignettes/rPHG2.Rmd diff --git a/.gitignore b/.gitignore index 234f028..1c9de78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,13 @@ +## General ---- +*.swp +*.swo +*.html +*.pdf +.DS_Store +.httr-oauth +vignettes/*.log +vignettes/figure/ + .Rproj.user .Rhistory .RData diff --git a/vignettes/img/filtering/mat_01.svg b/vignettes/img/filtering/mat_01.svg new file mode 100644 index 0000000..6bd975b --- /dev/null +++ b/vignettes/img/filtering/mat_01.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vignettes/img/filtering/mat_02.svg b/vignettes/img/filtering/mat_02.svg new file mode 100644 index 0000000..aed290a --- /dev/null +++ b/vignettes/img/filtering/mat_02.svg @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vignettes/img/filtering/mat_03.svg b/vignettes/img/filtering/mat_03.svg new file mode 100644 index 0000000..480d99f --- /dev/null +++ b/vignettes/img/filtering/mat_03.svg @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vignettes/img/filtering/mat_04.svg b/vignettes/img/filtering/mat_04.svg new file mode 100644 index 0000000..5268e57 --- /dev/null +++ b/vignettes/img/filtering/mat_04.svg @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vignettes/rPHG2.Rmd b/vignettes/rPHG2.Rmd new file mode 100644 index 0000000..04dd9c2 --- /dev/null +++ b/vignettes/rPHG2.Rmd @@ -0,0 +1,55 @@ +--- +title: "Introduction to rPHG2" +output: rmarkdown::html_document +description: > + Learn how to get started with the basics of rPHG2. +vignette: > + %\VignetteIndexEntry{Introduction to rPHG2} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +editor_options: + markdown: + wrap: 70 +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set( + fig.path = "figure/graphics-", + cache.path = "cache/graphics-", + fig.align = "center", + external = TRUE, + echo = TRUE, + warning = FALSE +) + +library(rPHG2) +``` + +The basic workflow of the `rPHG2` package is as follows: + +1. Create a connection object +2. Read data into the R environment +3. Analyze and visualize data retrieval + +This document introduces you to `rPHG2`'s methods and grammar, and +shows you how to apply them to the previously mentioned workflow. + +## Creating connection objects + +PHG databases can be connected through two primary sources: + +- local +- server + +_Local_ connections are for local TileDB instances or direct locations of +[hVCF](https://github.com/maize-genetics/phg_v2/blob/main/docs/hvcf_specifications.md) +files on a local disk. + +Conversely, _server_ locations are for databases served on publicly available +web services leveraging the [Breeding API (BrAPI) endpoints](https://brapi.org/). + + + + + + From c36f6d7c30c0e7c72d2856c506e5d6dc7d24b561 Mon Sep 17 00:00:00 2001 From: Brandon Monier Date: Thu, 25 Apr 2024 17:27:43 -0500 Subject: [PATCH 2/8] Add static theming --- DESCRIPTION | 1 + _pkgdown.yml | 14 -------------- pkgdown/_pkgdown.yml | 33 +++++++++++++++++++++++++++++++++ pkgdown/extra.css | 6 ++++++ 4 files changed, 40 insertions(+), 14 deletions(-) delete mode 100644 _pkgdown.yml create mode 100644 pkgdown/_pkgdown.yml create mode 100644 pkgdown/extra.css diff --git a/DESCRIPTION b/DESCRIPTION index 6924e9c..9765145 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,6 +20,7 @@ Description: from unphased species characterized by low genetic diversity and high-density genotyping. License: Apache License (>= 2) | file LICENSE +URL: https://github.com/maize-genetics/rPHG2 Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 diff --git a/_pkgdown.yml b/_pkgdown.yml deleted file mode 100644 index badfedb..0000000 --- a/_pkgdown.yml +++ /dev/null @@ -1,14 +0,0 @@ -url: ~ -template: - bootstrap: 5 - -footer: - structure: - left: acknowledgment - components: - acknowledgment: rPHG2 is an R package developed by The Buckler Lab - -home: - links: - - text: Report a bug - href: https://github.com/maize-genetics/rPHG2/issues diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml new file mode 100644 index 0000000..0285154 --- /dev/null +++ b/pkgdown/_pkgdown.yml @@ -0,0 +1,33 @@ +url: ~ + +template: + theme: breeze-light + bootstrap: 5 + bslib: + base_font: {google: "Barlow"} + heading_font: {google: "Oswald"} + code_font: {google: "Roboto Mono"} + extra_css: pkgdown/extra.css + +navbar: + structure: + left: [intro, articles, reference, news] + right: [search, github, phg] + components: + phg: + icon: fa-dna + href: https://github.com/maize-genetics/phg_v2 + aria-label: PHG Source + +footer: + structure: + left: acknowledgment + components: + acknowledgment: rPHG2 is an R package developed by The Buckler Lab + +home: + links: + - text: Report a bug + href: https://github.com/maize-genetics/rPHG2/issues + + diff --git a/pkgdown/extra.css b/pkgdown/extra.css new file mode 100644 index 0000000..2bcd3fc --- /dev/null +++ b/pkgdown/extra.css @@ -0,0 +1,6 @@ +.navbar-brand { + font-family: 'Oswald', sans-serif; /* Change font family */ + font-size: 20px; /* Change font size */ + font-weight: bold; /* Make font bold */ + color: #363636; /* Change font color to red */ +} From facbcb3886ce014ab0f1a9ad16c431b96158bad6 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 29 Apr 2024 16:22:15 -0500 Subject: [PATCH 3/8] Add remaining sections --- DESCRIPTION | 5 +- rphg2.Rproj | 2 +- vignettes/rPHG2.R | 67 ++++++++++ vignettes/rPHG2.Rmd | 292 ++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 357 insertions(+), 9 deletions(-) create mode 100644 vignettes/rPHG2.R diff --git a/DESCRIPTION b/DESCRIPTION index 9765145..7f9d699 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,6 +36,9 @@ Imports: methods, rJava, tibble -Suggests: +VignetteBuilder: knitr +Suggests: + knitr, + rmarkdown, testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/rphg2.Rproj b/rphg2.Rproj index fa0d77b..2ce7861 100644 --- a/rphg2.Rproj +++ b/rphg2.Rproj @@ -19,4 +19,4 @@ LineEndingConversion: Posix BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +PackageRoxygenize: rd,collate,namespace,vignette diff --git a/vignettes/rPHG2.R b/vignettes/rPHG2.R new file mode 100644 index 0000000..cf69f4b --- /dev/null +++ b/vignettes/rPHG2.R @@ -0,0 +1,67 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set( + fig.align = "center", + external = TRUE, + echo = TRUE, + warning = FALSE +) + +library(rPHG2) +source("../tests/testthat/setup.R") + +## ----eval=FALSE, echo=TRUE---------------------------------------------------- +# PHGLocalCon() + +## ----eval=FALSE, echo=TRUE---------------------------------------------------- +# system.file("extdata", "LineA.h.vcf", package = "rPHG2") + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +hVcfFiles <- system.file( + "extdata", + c("LineA.h.vcf", "LineB.h.vcf"), + package = "rPHG2" +) + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +localCon <- hVcfFiles |> PHGLocalCon() + +localCon + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +srvCon <- "phg.maizegdb.org" |> PHGServerCon() + +srvCon + +## ----eval=FALSE, echo=TRUE---------------------------------------------------- +# "www.my-unsecure-phg.org" |> +# PHGServerCon( +# port = 5300, +# protocol = "http" +# ) + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph <- localCon |> buildHaplotypeGraph() + +graph + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph |> javaRefObj() + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph |> readSamples() + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph |> readRefRanges() + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +m <- graph |> readHapIds() + +# Show only first 3 columns +m[, 1:3] + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph |> readHapIdMetaData() + +## ----eval=TRUE, echo=TRUE----------------------------------------------------- +graph |> readHapIdPosMetaData() + diff --git a/vignettes/rPHG2.Rmd b/vignettes/rPHG2.Rmd index 04dd9c2..d1d479f 100644 --- a/vignettes/rPHG2.Rmd +++ b/vignettes/rPHG2.Rmd @@ -1,6 +1,6 @@ --- title: "Introduction to rPHG2" -output: rmarkdown::html_document +output: rmarkdown::html_vignette description: > Learn how to get started with the basics of rPHG2. vignette: > @@ -14,8 +14,6 @@ editor_options: ```{r setup, include=FALSE} knitr::opts_chunk$set( - fig.path = "figure/graphics-", - cache.path = "cache/graphics-", fig.align = "center", external = TRUE, echo = TRUE, @@ -23,6 +21,7 @@ knitr::opts_chunk$set( ) library(rPHG2) +source("../tests/testthat/setup.R") ``` The basic workflow of the `rPHG2` package is as follows: @@ -34,22 +33,301 @@ The basic workflow of the `rPHG2` package is as follows: This document introduces you to `rPHG2`'s methods and grammar, and shows you how to apply them to the previously mentioned workflow. + + ## Creating connection objects +rPHG objects can be created through two primary sources: +* local data +* server connections -PHG databases can be connected through two primary sources: +Creating initial "connection" objects helps unify downstream reading and +evaluation steps for PHGv2 data. In the next couple of sections, we will show +you how to create either local or server connnection objects. -- local -- server +### Local data _Local_ connections are for local TileDB instances or direct locations of [hVCF](https://github.com/maize-genetics/phg_v2/blob/main/docs/hvcf_specifications.md) -files on a local disk. +files on a local disk. To create a local connection, we will create a +`PHGLocalCon` object using the following constructor function: + +```{r, eval=FALSE, echo=TRUE} +PHGLocalCon() +``` + +For the above example, we will create a connection to some example local hVCF +files provided with the `rPHG2` package: + +* `LineA.h.vcf` +* `LineB.h.vcf` + +Since the full paths to these files will differ between each user, we can +use the `system.file()` function to get the full path: + +```{r, eval=FALSE, echo=TRUE} +system.file("extdata", "LineA.h.vcf", package = "rPHG2") +``` + +This will get the full path from the `extdata` directory for the file, +`LineA.h.vcf`, found in the `rPHG2` source code. + +We can further build on this to create a collection of full file paths to our +hVCF data: + +```{r, eval=TRUE, echo=TRUE} +hVcfFiles <- system.file( + "extdata", + c("LineA.h.vcf", "LineB.h.vcf"), + package = "rPHG2" +) +``` + + +Now that we have a collection of hVCF files, we can use the `PHGLocalCon()` +constructor function to create a `PHGLocalCon` object: + +```{r, eval=TRUE, echo=TRUE} +localCon <- hVcfFiles |> PHGLocalCon() + +localCon +``` + +From here, we can move to the [next section](#creating-jvm-objects) to create a `HaplotypeGraph` +object interface with the JVM. + +### Server connections Conversely, _server_ locations are for databases served on publicly available web services leveraging the [Breeding API (BrAPI) endpoints](https://brapi.org/). +Since this is a connection to a server, a URL path instead of a local file +path will be needed. We will use the `PHGServerCon()` constructor function +to create a `PHGServerCon` object: + +```{r, eval=TRUE, echo=TRUE} +srvCon <- "phg.maizegdb.org" |> PHGServerCon() + +srvCon +``` + +In the above example, we have made the assumptions that this URL: + +1. Uses a secure transfer protocol ([`https`](https://en.wikipedia.org/wiki/HTTPS)) +2. Uses default ports for data serving +3. Has BrAPI specified endpoints + +For points **1** and **2**, if the URL uses non-secure protocols ("http") +and/or has a modified port number, you will need to specify these with the +`protocol` and `port` parameters in the constructor function. For example: + +```{r, eval=FALSE, echo=TRUE} +"www.my-unsecure-phg.org" |> + PHGServerCon( + port = 5300, + protocol = "http" + ) +``` + +For point **3**, if the constructor cannot resolve +[mandatory endpoints](https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI-Core/2.1#/Server%20Info/get_serverinfo), +an exception will occur. + + + +## Creating JVM objects + +Now that we have either a local or server-based connection object, we can +convert the raw hVCF data into a +[`HaplotypeGraph`](https://github.com/maize-genetics/phg_v2/blob/main/src/main/kotlin/net/maizegenetics/phgv2/api/HaplotypeGraph.kt) +JVM object and bridge the Java reference pointer to R using the function, +`buildHaplotypeGraph()`: + + +```{r, eval=TRUE, echo=TRUE} +graph <- localCon |> buildHaplotypeGraph() + +graph +``` + +In the above example, we took the local connection object and passed it into +a `HaplotypeGraph` constructor. Here, we have a basic class that contains a +pointer object where we can direct data from Java to R: + +```{r, eval=TRUE, echo=TRUE} +graph |> javaRefObj() +``` + + + +## Reading data +Now that we have created a `HaplotypeGraph` object, we can begin **read**ing +data using the `read*` family of `rPHG2` functions. + + +### Sample IDs +To return a vector of sample IDs from the graph object, we can use the +`readSamples()` function: + +```{r, eval=TRUE, echo=TRUE} +graph |> readSamples() +``` + + +### Reference ranges +To return information about all reference ranges found within the graph object, +we can use the `readRefRanges()` function. This will return a `GRanges` object +which is a common data class in the +[`GenomicRanges`](https://bioconductor.org/packages/release/bioc/html/GenomicRanges.html) +package: + +```{r, eval=TRUE, echo=TRUE} +graph |> readRefRanges() +``` + + +### Haplotype IDs +To return all haplotype IDs as a "sample $\times$ reference range" `matrix` +object, we can use the `readHapIds()` function: + + +```{r, eval=TRUE, echo=TRUE} +m <- graph |> readHapIds() + +# Show only first 3 columns +m[, 1:3] +``` + + + +### Haplotype ID metadata +To return metadata for each haplotype ID as a `tibble` object, we can use +the `readHapIdMetaData()` function: + +```{r, eval=TRUE, echo=TRUE} +graph |> readHapIdMetaData() +``` + + +### Haplotype ID metadata (positions) +To return positional information for each haplotype ID as another `tibble` +object, we can use the `readHapIdPosMetaData()` function: + +```{r, eval=TRUE, echo=TRUE} +graph |> readHapIdPosMetaData() +``` + + +### All hVCF data +In a majority of cases, we may need more than one piece of hVCF data. We can +read all of the prior data simultaneously as `PHGDataSet` object which is +an in-R-memory representation of all hVCF data: + +```{r, eval=TRUE, echo=TRUE} +graph |> readPhgDataSet() +``` + +If this object is created, we can use the prior `read*` methods to +instantaneously pull out the previously mentioned R data objects: + +* `readSamples()` +* `readRefRanges()` +* `readHapIds()` +* `readHapIdMetaData()` +* `readHapIdPosMetaData()` + + + +## Filter data +In some cases, you may want to query information and focus on one +specific reference range and/or sample(s). We can **filter** our `PHGDataSet` +objects using the `filter*` family of functions. + +For the following examples, let's picture our primary data as a 2-dimensional +`matrix` of: +* samples (rows) +* reference ranges (columns) +* hap ID data (elements) +If we were to represent this as an object in R called `phgDs`, it would look +like the following diagram: +```{r, eval=FALSE, echo=TRUE} +phgDs +``` + +![](img/filtering/mat_01.svg){fig.align="center"} + + +### Filter by sample +If we want to filter based on sample ID, we can use the `filterSamples()` +function. Simply add the sample ID or collection of sample IDs as a `character` +string or a vector of `character` strings, respectively. Using the prior +diagram as a reference, I will filter out anything that is not the following: + +* `B73` +* `Ky21` +* `Mo17` + +```{r, eval=FALSE, echo=TRUE} +phgDs |> filterSamples(c("B73", "Ky21", "Mo17")) +``` + +![](img/filtering/mat_02.svg){fig.align="center"} + +**Note**: If samples are added to the filter collection, but are not +present in the data, they will be discarded. If **no** samples are found, an +exception will be thrown stating that no samples could be found. + + +### Filter by reference range +If we want to filter based on sample ID, we can use the `filterRefRanges()` +function. Currently, this takes a `GRanges` object where we can specify +integer-based ranges located in genomic regions by chromosome (i.e., +`seqnames`). For example, if I want to return all ranges that intersect with +the following genomic regions: + +| Chromosome | Start (bp) | End (bp) | +|------------|------------|----------| +| `"1"` | `100` | `400` | +| `"2"` | `400` | `900` | + +I can create the following `GRanges` object and pass that to the filter +method: + +```{r, eval=FALSE, echo=TRUE} +gr <- GRanges( + seqnames = c("1", "2"), + ranges = IRanges( + c(100, 800), + c(400, 900) + ) +) + + +phgDs |> filterRefRanges(gr) +``` + +![](img/filtering/mat_03.svg) + + +### Chaining methods +Since we have two dimensions, we can filter simultaneously by "piping" or +combining filter methods in one pass: + +```{r, eval=FALSE, echo=TRUE} +gr <- GRanges( + seqnames = c("1", "2"), + ranges = IRanges( + c(100, 800), + c(400, 900) + ) +) + +phgDs |> + filterSamples(c("B73", "Ky21", "Mo17")) |> + filterRefRanges(gr) +``` +![](img/filtering/mat_04.svg) From 2ba40bad5a0946863e2c3f96d4696c8760e69f92 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 30 Apr 2024 07:53:42 -0500 Subject: [PATCH 4/8] Add new sections --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4bb2bc4..f866a70 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Life Cycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) +[![R-CMD-check](https://github.com/maize-genetics/rPHG2/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/maize-genetics/rPHG2/actions/workflows/check-standard.yaml) +[![codecov](https://codecov.io/gh/maize-genetics/rPHG2/graph/badge.svg?token=BEEI8KZ96H)](https://codecov.io/gh/maize-genetics/rPHG2) `rPHG2` is a system to interact with and retrieve information from **version 2** @@ -15,19 +17,69 @@ framework for genotype inference. This is accomplished by leveraging the You can install the development version of rphg2 from [GitHub](https://github.com/) with: ``` r -# install.packages("devtools") -devtools::install_github("maize-genetics/rPHG2") +# install.packages("pak") +pak::pak("maize-genetics/rPHG2") ``` -## Example -This is a basic example which shows you how to solve a common problem: +## Usage +### Initialize with PHGv2 JARs ``` r -library(rphg2) +initPhg("my/phg/jar/path") +``` + +### Create a connection +``` r +locCon <- list.files("my/hvcf/dir") |> + PHGLocalCon() +``` + +### Build a graph +``` r +graph <- locCon |> buildHaplotypeGraph() +``` + +### Read data into R +``` r +phgDs <- graph |> readPhgDataSet() +``` + +### Identify areas of interest +``` r +gr <- GRanges( + seqnames = c("1", "2"), + ranges = IRanges( + c(100, 800), + c(400, 900) + ) +) + +phgDs |> + filterSamples(c("B73", "Ky21", "Mo17")) |> + filterRefRanges(gr) +``` + + +## Lifecycle +[![Life Cycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) -phgCon <- PHGServerCon("localhost", 8080, "http") +`rPHG2` is a relatively new R package and may be subject to changes in +workflow and function definitions. If you would like to see anything added +or run into problems, please feel free to contact the team using the +[issues page](https://github.com/maize-genetics/rPHG2/issues). -phgCon |> readSamples() + +## Learning rPHG2 +If installed locally, you can read the "Introduction to rPHG2" vignette by +using: + +``` r +vignette("rPHG2") ``` +Alternatively, the package's [website](https://rphg2.maizegenetics.net) is +another great place to read up on function usage, code changes, and +workflows. + + From 4f1e7587555a4003ec9c8c12b46fb793a333d2f1 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 30 Apr 2024 08:10:05 -0500 Subject: [PATCH 5/8] Add URLs; add press release --- DESCRIPTION | 6 ++++-- NEWS | 33 --------------------------------- NEWS.md | 7 +++++++ pkgdown/_pkgdown.yml | 2 +- 4 files changed, 12 insertions(+), 36 deletions(-) delete mode 100644 NEWS diff --git a/DESCRIPTION b/DESCRIPTION index 7f9d699..261f1cf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rPHG2 Title: R interface to PHGv2 -Version: 0.3 +Version: 0.3.1 Authors@R: person( given = "Brandon", @@ -20,7 +20,9 @@ Description: from unphased species characterized by low genetic diversity and high-density genotyping. License: Apache License (>= 2) | file LICENSE -URL: https://github.com/maize-genetics/rPHG2 +URL: + https://github.com/maize-genetics/rPHG2, + https://rphg2.maizegenetics.net/ Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 diff --git a/NEWS b/NEWS deleted file mode 100644 index b197b54..0000000 --- a/NEWS +++ /dev/null @@ -1,33 +0,0 @@ -## CHANGES IN 0.3 -* Added new class, `PHGDataSet` - + In memory representation of hVCF data sets -* Added new function, `filterRefRanges()` - + Filters relevant rPHG2 data objects by reference range - + Requires a `GRanges` object as input -* Added new function, `filterSamples()` - + Filters relevant rPHG2 data objects by sample ID - + Input is a basic `character` vector of sample identifiers - - -## CHANGES IN 0.2 -* Added JVM connections via `rJava` interface -* Added new class, `HaplotypeGraph` - + Wrapper for PHGv2 API Java graph object -* Added new class, `PHGLocalCon` - + Interface to local hVCF database and file connections -* Added new function `initPHG()` - + Initializes JVM and adds PHGv2 Java JARs to classpath -* Added new function `readHapIds()` - + Reads haplotype IDs as a `character` matrix from a connection object -* Added new function `readHapIdMetaData()` - + Reads ALT header metadata for each haplotype ID from a connection object -* Added new function `readHapIdPosMetaData()` - + Reads ALT header positional metadata for each haplotype ID from a - connection object -* Added new function `readSamples()` - + Reads sample IDs from a connection object -* Added new function `readRefRanges()` - + Read reference range positional information as a `GRanges` object from a - connection object - - diff --git a/NEWS.md b/NEWS.md index 1005a78..2dae214 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +## rPHG2 0.4 +* Added vignettes and README updates + + `vignette("rPHG2")` +* Created build system for website generation + + [rphg2.maizegenetics.net](https://rphg2.maizegenetics.net) + + ## rPHG2 0.3 * Added new class, `PHGDataSet` + In memory representation of hVCF data sets diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 0285154..53eb2a4 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -1,4 +1,4 @@ -url: ~ +url: https://rphg2.maizegenetics.net template: theme: breeze-light From dc0aa656f02ac3c1561c01dc6bed3dba18ab674c Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 30 Apr 2024 09:58:34 -0500 Subject: [PATCH 6/8] Fix website deployment --- .github/workflows/check-standard.yaml | 4 +--- .github/workflows/pkgdown.yaml | 5 +++++ vignettes/rPHG2.Rmd | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index 3f5a748..a484448 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -20,9 +20,7 @@ jobs: config: - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: ubuntu-latest, r: 'release'} - # - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - # - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: 'release'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 087f0b0..9deab3f 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -22,6 +22,11 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 diff --git a/vignettes/rPHG2.Rmd b/vignettes/rPHG2.Rmd index d1d479f..bee226c 100644 --- a/vignettes/rPHG2.Rmd +++ b/vignettes/rPHG2.Rmd @@ -21,6 +21,7 @@ knitr::opts_chunk$set( ) library(rPHG2) + source("../tests/testthat/setup.R") ``` From 5208418f3e59cc45ddc470bda6b9e15a78f352e8 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 30 Apr 2024 10:09:32 -0500 Subject: [PATCH 7/8] Fix code coverage generation --- .github/workflows/test-coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index ae03aef..92512c1 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -10,7 +10,7 @@ name: test-coverage jobs: test-coverage: - runs-on: macos-latest + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} From d0783d0a992fc514fd461c2bae80703e36cbea09 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 30 Apr 2024 10:36:21 -0500 Subject: [PATCH 8/8] Add API stats for action debugging --- tests/testthat/setup.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 6f980a2..453ba4b 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -18,6 +18,12 @@ getLatestReleaseUrl <- function(repo) { response <- httr::GET(apiUrl) + message(" * API total rate...............: ", response$headers$`x-ratelimit-limit`) + message(" * API rate limit (remaining)...: ", response$headers$`x-ratelimit-remaining`) + message(" * API rate limit (used)........: ", response$headers$`x-ratelimit-used`) + message(" * UTC Epoch time to reset......: ", response$headers$`x-ratelimit-reset`) + + # Check if the request was successful if (httr::http_status(response)$category != "Success") { stop(