Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JVM methods #2

Merged
merged 19 commits into from
Apr 2, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand Down
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: rPHG2
Title: R interface to PHGv2
Version: 0.1
Version: 0.2
Authors@R:
person(
given = "Brandon",
family = "Last",
family = "Monier",
email = "bm646@cornell.edu",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-6797-1221")
Expand All @@ -23,12 +23,16 @@ License: Apache License (>= 2) | file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Depends:
R (>= 4.1.0)
Imports:
cli,
curl,
GenomicRanges,
httr,
jsonlite,
methods,
rJava,
tibble
Suggests:
testthat (>= 3.0.0)
Expand Down
25 changes: 25 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
# Generated by roxygen2: do not edit by hand

export(PHGLocalCon)
export(PHGServerCon)
export(brapiURL)
export(brapiVersion)
export(buildHaplotypeGraph)
export(hVcfFiles)
export(host)
export(httProtocol)
export(initPhg)
export(javaMemoryAddress)
export(javaRefObj)
export(numberOfChromosomes)
export(numberOfRefRanges)
export(numberOfTaxa)
export(phgType)
export(port)
export(readHapIdMetaData)
export(readHapIdPosMetaData)
export(readHapIds)
export(readRefRanges)
export(readSamples)
export(serverInfo)
exportClasses(HaplotypeGraph)
exportClasses(PHGCon)
exportClasses(PHGLocalCon)
exportClasses(PHGServerCon)
exportMethods(brapiURL)
exportMethods(brapiVersion)
exportMethods(hVcfFiles)
exportMethods(host)
exportMethods(httProtocol)
exportMethods(javaMemoryAddress)
exportMethods(javaRefObj)
exportMethods(numberOfChromosomes)
exportMethods(numberOfRefRanges)
exportMethods(numberOfTaxa)
exportMethods(phgType)
exportMethods(port)
exportMethods(readHapIdMetaData)
exportMethods(readHapIdPosMetaData)
exportMethods(readHapIds)
exportMethods(readRefRanges)
exportMethods(readSamples)
exportMethods(serverInfo)
importFrom(curl,has_internet)
importFrom(methods,is)
22 changes: 22 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## 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


22 changes: 22 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## rPHG2 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


134 changes: 132 additions & 2 deletions R/class_all_generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,90 @@ setGeneric("host", function(object, ...) standardGeneric("host"))
setGeneric("httProtocol", function(object, ...) standardGeneric("httProtocol"))


## ----
#' @title Return hVCF files
#'
#' @description
#' Returns a list of hVCF files.
#'
#' @param object an \code{rPHG} local connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname hVcfFiles
#' @export
setGeneric("hVcfFiles", function(object, ...) standardGeneric("hVcfFiles"))


## ----
#' @title Return \code{rJava} reference object
#'
#' @description
#' Returns the \code{rJava} memory reference for a given \code{rPHG} object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname javaMemoryAddress
#' @export
setGeneric("javaMemoryAddress", function(object, ...) standardGeneric("javaMemoryAddress"))


## ----
#' @title Return \code{rJava} reference object
#'
#' @description
#' Returns the \code{rJava} memory reference for a given \code{rPHG} object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname javaRefObj
#' @export
setGeneric("javaRefObj", function(object, ...) standardGeneric("javaRefObj"))


## ----
#' @title Return number of chromosomes
#'
#' @description
#' Returns the number of chromosomes for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfChromosomes
#' @export
setGeneric("numberOfChromosomes", function(object, ...) standardGeneric("numberOfChromosomes"))


## ----
#' @title Return number of reference ranges
#'
#' @description
#' Returns the number of reference ranges for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfRefRanges
#' @export
setGeneric("numberOfRefRanges", function(object, ...) standardGeneric("numberOfRefRanges"))


## ----
#' @title Return number of taxa
#'
#' @description
#' Returns the number of taxa for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfTaxa
#' @export
setGeneric("numberOfTaxa", function(object, ...) standardGeneric("numberOfTaxa"))


## ----
#' @title Return type of PHG connection
#'
Expand Down Expand Up @@ -82,11 +166,57 @@ setGeneric("phgType", function(object, ...) standardGeneric("phgType"))
setGeneric("port", function(object, ...) standardGeneric("port"))


## ----
#' @title Return haplotype IDs
#'
#' @description
#' Gets haplotype ID for given samples and reference ranges from a
#' \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param nThreads Number of threads to use when evaluating haplotype IDs
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readHapIds
#' @export
setGeneric("readHapIds", function(object, nThreads, ...) standardGeneric("readHapIds"))


## ----
#' @title Return haplotype ID metadata
#'
#' @description
#' Gets haplotype ID metadata for given samples and reference ranges from a
#' \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readHapIdMetaData
#' @export
setGeneric("readHapIdMetaData", function(object, ...) standardGeneric("readHapIdMetaData"))


## ----
#' @title Return haplotype ID positional metadata
#'
#' @description
#' Gets haplotype ID positional metadata for given samples and reference ranges
#' from a \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readHapIdPosMetaData
#' @export
setGeneric("readHapIdPosMetaData", function(object, ...) standardGeneric("readHapIdPosMetaData"))


## ----
#' @title Return reference ranges
#'
#' @description
#' Get reference range data for a given PHG method
#' Get reference range data from a \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
Expand All @@ -100,7 +230,7 @@ setGeneric("readRefRanges", function(object, ...) standardGeneric("readRefRanges
#' @title Return samples IDs
#'
#' @description
#' Gets sample ID data for a given PHG method
#' Gets sample ID data from a \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param ... Additional arguments, for use in specific methods
Expand Down
Loading
Loading