Skip to content

Commit

Permalink
Merge pull request #5 from maize-genetics/phg-metrics
Browse files Browse the repository at this point in the history
Add PHG metrics integration
  • Loading branch information
btmonier authored May 17, 2024
2 parents 4500abc + 3e7f4b5 commit e2cbff7
Show file tree
Hide file tree
Showing 50 changed files with 2,966 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
# - {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}

Expand Down
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rPHG2
Title: R interface to PHGv2
Version: 0.3.1
Version: 0.4
Authors@R:
person(
given = "Brandon",
Expand Down Expand Up @@ -32,12 +32,16 @@ Imports:
cli,
curl,
GenomicRanges,
ggplot2,
httr,
IRanges,
jsonlite,
methods,
rJava,
tibble
rlang,
tibble,
tools,
utils
VignetteBuilder: knitr
Suggests:
knitr,
Expand Down
18 changes: 18 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Generated by roxygen2: do not edit by hand

S3method(.DollarNames,PHGMetrics)
export("%T%")
export("metricsIds<-")
export("metricsTable<-")
export(PHGDataSet)
export(PHGLocalCon)
export(PHGMetrics)
export(PHGServerCon)
export(brapiURL)
export(brapiVersion)
Expand All @@ -14,10 +19,14 @@ export(httProtocol)
export(initPhg)
export(javaMemoryAddress)
export(javaRefObj)
export(metricsIds)
export(metricsMetaData)
export(metricsTable)
export(numberOfChromosomes)
export(numberOfRefRanges)
export(numberOfTaxa)
export(phgType)
export(plotDot)
export(port)
export(readHapIdMetaData)
export(readHapIdPosMetaData)
Expand All @@ -30,7 +39,11 @@ exportClasses(HaplotypeGraph)
exportClasses(PHGCon)
exportClasses(PHGDataSet)
exportClasses(PHGLocalCon)
exportClasses(PHGMetrics)
exportClasses(PHGServerCon)
exportMethods("$")
exportMethods("metricsIds<-")
exportMethods("metricsTable<-")
exportMethods(brapiURL)
exportMethods(brapiVersion)
exportMethods(filterRefRanges)
Expand All @@ -40,10 +53,14 @@ exportMethods(host)
exportMethods(httProtocol)
exportMethods(javaMemoryAddress)
exportMethods(javaRefObj)
exportMethods(metricsIds)
exportMethods(metricsMetaData)
exportMethods(metricsTable)
exportMethods(numberOfChromosomes)
exportMethods(numberOfRefRanges)
exportMethods(numberOfTaxa)
exportMethods(phgType)
exportMethods(plotDot)
exportMethods(port)
exportMethods(readHapIdMetaData)
exportMethods(readHapIdPosMetaData)
Expand All @@ -54,3 +71,4 @@ exportMethods(readSamples)
exportMethods(serverInfo)
importFrom(curl,has_internet)
importFrom(methods,is)
importFrom(utils,.DollarNames)
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
+ `vignette("rPHG2")`
* Created build system for website generation
+ [rphg2.maizegenetics.net](https://rphg2.maizegenetics.net)
* Added new class `PHGMetrics`
+ Primary container for PHGv2 metrics data
* Added accessor methods for `PHGMetrics` objects:
+ `metricsIds()`
+ `metricsTable()`
+ `metricsMetaData()`
* Prior methods are also updatable
* Added visualization methods:
+ `plotDot()` - collinearity plotter for alignment data


## rPHG2 0.3
Expand Down
116 changes: 90 additions & 26 deletions R/class_all_generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @description
#' Returns the Uniform Resource Locator (URL) of a \code{BrapiCon} object.
#'
#' @param object an \code{rPHG} local or server connection object.
#' @param object an \code{rPHG2} local or server connection object.
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname brapiURL
Expand All @@ -18,7 +18,7 @@ setGeneric("brapiURL", function(object, ...) standardGeneric("brapiURL"))
#' @description
#' Returns the version ID for a BrAPI-compliant PHG server
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname brapiVersion
Expand All @@ -30,9 +30,9 @@ setGeneric("brapiVersion", function(object, ...) standardGeneric("brapiVersion")
#' @title Filter data by reference range
#'
#' @description
#' Filters \code{rPHG}-related datasets by reference range coordinates or ID.
#' Filters \code{rPHG2}-related datasets by reference range coordinates or ID.
#'
#' @param object an \code{rPHG} dataset
#' @param object an \code{rPHG2} dataset
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname filterRefRanges
Expand All @@ -44,9 +44,9 @@ setGeneric("filterRefRanges", function(object, ...) standardGeneric("filterRefRa
#' @title Filter data by sample IDs
#'
#' @description
#' Filters \code{rPHG}-related datasets by sample ID.
#' Filters \code{rPHG2}-related datasets by sample ID.
#'
#' @param object an \code{rPHG} dataset
#' @param object an \code{rPHG2} dataset
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname filterSamples
Expand All @@ -60,7 +60,7 @@ setGeneric("filterSamples", function(object, ...) standardGeneric("filterSamples
#' @description
#' Returns the host information for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname host
Expand All @@ -74,7 +74,7 @@ setGeneric("host", function(object, ...) standardGeneric("host"))
#' @description
#' Returns the protocol information for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname httProtocol
Expand All @@ -88,7 +88,7 @@ setGeneric("httProtocol", function(object, ...) standardGeneric("httProtocol"))
#' @description
#' Returns a list of hVCF files.
#'
#' @param object an \code{rPHG} local connection object
#' @param object an \code{rPHG2} local connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname hVcfFiles
Expand All @@ -100,9 +100,9 @@ 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
#' Returns the \code{rJava} memory reference for a given \code{rPHG2} object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname javaMemoryAddress
Expand All @@ -114,23 +114,73 @@ setGeneric("javaMemoryAddress", function(object, ...) standardGeneric("javaMemor
#' @title Return \code{rJava} reference object
#'
#' @description
#' Returns the \code{rJava} memory reference for a given \code{rPHG} object
#' Returns the \code{rJava} memory reference for a given \code{rPHG2} object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname javaRefObj
#' @export
setGeneric("javaRefObj", function(object, ...) standardGeneric("javaRefObj"))


## ----
#' @title Return metrics table IDs
#'
#' @description
#' Returns a PHG metrics table by given ID
#'
#' @param object an \code{rPHG2} metrics object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname metricsIds
#' @export
setGeneric("metricsIds", function(object, ...) standardGeneric("metricsIds"))

#' @rdname metricsIds
#' @export
setGeneric("metricsIds<-", function(object, ..., value) standardGeneric("metricsIds<-"))


## ----
#' @title Return metric metadata
#'
#' @description
#' Returns metadata information from \code{rPHG2} metrics objects
#'
#' @param object an \code{rPHG2} metrics object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname metricsMetaData
#' @export
setGeneric("metricsMetaData", function(object, ...) standardGeneric("metricsMetaData"))


## ----
#' @title Return a metrics table
#'
#' @description
#' Returns a PHG metrics table by given ID
#'
#' @param object an \code{rPHG2} metrics object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname metricsTable
#' @export
setGeneric("metricsTable", function(object, ...) standardGeneric("metricsTable"))

#' @rdname metricsTable
#' @export
setGeneric("metricsTable<-", function(object, ..., value) standardGeneric("metricsTable<-"))


## ----
#' @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 object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfChromosomes
Expand All @@ -144,7 +194,7 @@ setGeneric("numberOfChromosomes", function(object, ...) standardGeneric("numberO
#' @description
#' Returns the number of reference ranges for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfRefRanges
Expand All @@ -158,7 +208,7 @@ setGeneric("numberOfRefRanges", function(object, ...) standardGeneric("numberOfR
#' @description
#' Returns the number of taxa for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname numberOfTaxa
Expand All @@ -170,23 +220,37 @@ setGeneric("numberOfTaxa", function(object, ...) standardGeneric("numberOfTaxa")
#' @title Return type of PHG connection
#'
#' @description
#' Returns the PHG type for a given \code{rPHG} local or server connection object
#' Returns the PHG type for a given \code{rPHG2} local or server connection object
#'
#' @param object an \code{rPHG} connection object
#' @param object an \code{rPHG2} connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname phgType
#' @export
setGeneric("phgType", function(object, ...) standardGeneric("phgType"))


## ----
#' @title Generate dot plots
#'
#' @description
#' Generates collinearity (dot) plots between 2 samples
#'
#' @param object an \code{rPHG2} metrics object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname plotDot
#' @export
setGeneric("plotDot", function(object, ...) standardGeneric("plotDot"))


## ----
#' @title Return port value
#'
#' @description
#' Returns the port information for a given object
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname port
Expand All @@ -201,7 +265,7 @@ setGeneric("port", function(object, ...) standardGeneric("port"))
#' Gets haplotype ID for given samples and reference ranges from a
#' \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
# @param nThreads Number of threads to use when evaluating haplotype IDs
#' @param ... Additional arguments, for use in specific methods
#'
Expand All @@ -217,7 +281,7 @@ setGeneric("readHapIds", function(object, ...) standardGeneric("readHapIds"))
#' 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 object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readHapIdMetaData
Expand All @@ -232,7 +296,7 @@ setGeneric("readHapIdMetaData", function(object, ...) standardGeneric("readHapId
#' 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 object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readHapIdPosMetaData
Expand All @@ -247,7 +311,7 @@ setGeneric("readHapIdPosMetaData", function(object, ...) standardGeneric("readHa
#' Returns all haplotype, sample, and reference range IDs and relative metadata
#' from a \code{\linkS4class{HaplotypeGraph}} object.
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readPhgDataSet
Expand All @@ -261,7 +325,7 @@ setGeneric("readPhgDataSet", function(object, ...) standardGeneric("readPhgDataS
#' @description
#' Get reference range data from a \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readRefRanges
Expand All @@ -275,7 +339,7 @@ setGeneric("readRefRanges", function(object, ...) standardGeneric("readRefRanges
#' @description
#' Gets sample ID data from a \code{HaplotypeGraph}
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname readSamples
Expand All @@ -289,7 +353,7 @@ setGeneric("readSamples", function(object, ...) standardGeneric("readSamples"))
#' @description
#' Get available BrAPI calls from BrAPI compliant PHG server
#'
#' @param object an \code{rPHG} local or server connection object
#' @param object an \code{rPHG2} local or server connection object
#' @param ... Additional arguments, for use in specific methods
#'
#' @rdname serverInfo
Expand Down
Loading

0 comments on commit e2cbff7

Please sign in to comment.