Skip to content

Commit

Permalink
Clean up ADAT helpers docs for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
stufield committed Mar 8, 2024
1 parent 7d95b3f commit 4910f59
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
20 changes: 14 additions & 6 deletions R/adat-helpers.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' Helpers to Extract Information from an ADAT
#'
#' Retrieves elements of the `HEADER` attributes of the object:\cr\cr
#' [getAdatVersion()] determines the the ADAT version
#' number from a parsed ADAT header.\cr\cr
#' [getSomaScanVersion()] determines the version of
#' SomaScan assay that a `soma_adat` object was run on.
#' These are elements of the `HEADER` attributes of the object.\cr\cr
#' [getSomaScanVersion()] determines the original SomaScan assay version
#' that generated RFU measurements within a `soma_adat` object.
#' [checkSomaScanVersion()] determines if the version of
#' is a recognized version of SomaScan.\cr
#' \cr
Expand All @@ -15,19 +15,21 @@
#' `v4.1` \tab 7k \tab 7596 \cr
#' `v5.0` \tab 11k \tab 11083 \cr
#' }
#' \cr
#' [getSignalSpace()] determines the current signal space of
#' the RFU values, which may differ from the original SomaScan
#' signal space if the data have been lifted. See [lift_adat()].
#'
#' @name adat-helpers
#' @param atts The *attributes* of a `soma_adat` object.
#' @return
#' \item{[getAdatVersion()]}{The key-value of the `Version` as a string.}
#' \item{[getSomaScanVersion()]}{The key-value of the `AssayVersion` as a string.}
#' \item{[checkSomaScanVersion()]}{Returns `NULL` (invisibly) if checks pass.}
#' @author Stu Field
#' @examples
#' atts <- attributes(example_data)
#' getAdatVersion(atts)
#'
#' atts$Header.Meta$HEADER$Version <- "1.0"
#' atts$Header.Meta$HEADER$Version <- "99.0"
#' getAdatVersion(atts)
#' @export
getAdatVersion <- function(atts) {
Expand Down Expand Up @@ -70,6 +72,8 @@ getAdatVersion <- function(atts) {
#'
#' ver <- getSomaScanVersion(example_data)
#' ver
#' @return
#' \item{[getSomaScanVersion()]}{The key-value of the `AssayVersion` as a string.}
#' @export
getSomaScanVersion <- function(adat) {
as.character(attr(adat, "Header.Meta")$HEADER$AssayVersion)
Expand All @@ -84,6 +88,8 @@ getSomaScanVersion <- function(adat) {
#'
#' rfu_space <- getSignalSpace(example_data)
#' rfu_space
#' @return
#' \item{[getSignalSpace()]}{The key-value of the `SignalSpace` as a string.}
#' @export
getSignalSpace <- function(adat) {
attr(adat, "Header.Meta")$HEADER$SignalSpace %||% getSomaScanVersion(adat)
Expand All @@ -98,6 +104,8 @@ getSignalSpace <- function(adat) {
#' @examples
#'
#' is.null(checkSomaScanVersion(ver))
#' @return
#' \item{[checkSomaScanVersion()]}{Returns `NULL` (invisibly) if checks pass.}
#' @export
checkSomaScanVersion <- function(ver) {
allowed <- c("v4", "v4.0", "v4.1", "v5", "v5.0")
Expand Down
16 changes: 12 additions & 4 deletions man/adat-helpers.Rd

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

0 comments on commit 4910f59

Please sign in to comment.