-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure of
lift_adat()
functionality
- `lift_adat()` now takes a `bridge =` argument, replacing the `anno.tbl =` argument. Lifting is now performed internally for a better (and safer) user experience, without the necessity of an external annotations file. Much simpler user experience. - the majority of this refactoring was internal and the user should not experience a major disruption to the API. - new internal objects `lift_master` and `lref` as sources of internal scaling factors (lifting) - new function `is_lifted()` - closes #81, closes #78
- Loading branch information
Showing
10 changed files
with
254 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
# map external commercial names to | ||
# internal SomaScan version names | ||
# ---------------------------------- | ||
map_ver2k <- c( | ||
V3 = "1.1k", | ||
v3 = "1.1k", | ||
v3.0 = "1.1k", | ||
V3.2 = "1.3k", | ||
v3.2 = "1.3k", | ||
V4 = "5k", | ||
v4 = "5k", | ||
v4.0 = "5k", | ||
V4.1 = "7k", | ||
v4.1 = "7k", | ||
V5 = "11k", | ||
v5 = "11k", | ||
v5.0 = "11k" | ||
) | ||
|
||
map_k2ver <- c( | ||
"1.1k" = "v3.0", | ||
"1.3k" = "v3.2", | ||
"5k" = "v4.0", | ||
"7k" = "v4.1", | ||
"11k" = "v5.0" | ||
) | ||
|
||
# matrx: either serum or plasma | ||
# bridge: direction of the bridge | ||
.get_lift_ref <- function(matrx = c("plasma", "serum"), bridge) { | ||
matrx <- match.arg(matrx) | ||
df <- lref[[matrx]][, c("SeqId", bridge)] | ||
setNames(df[[2L]], df[[1L]]) | ||
} | ||
|
||
|
||
# Checks ---- | ||
# check that SomaScan data has been ANML normalized | ||
# x = Header attributes | ||
.check_anml <- function(x) { | ||
steps <- x$ProcessSteps | ||
if ( is.null(steps) | !grepl("ANML", steps, ignore.case = TRUE) ) { | ||
stop("ANML normalized SOMAscan data is required for lifting.", | ||
call. = FALSE) | ||
} | ||
invisible(NULL) | ||
} | ||
|
||
#' @param x the 'from' space. | ||
#' @param y the bridge variable, e.g. '5k_to_7k'. | ||
#' @return The 'to' space, from the 'y' param. | ||
#' @noRd | ||
.check_direction <- function(x, y) { | ||
x <- tolower(x) | ||
from <- gsub("(.*)_to_(.*)$", "\\1", y) | ||
to <- gsub("(.*)_to_(.*)$", "\\2", y) | ||
|
||
if ( isFALSE(x == from) ) { | ||
stop( | ||
"You have indicated a bridge from ", .value(from), | ||
" space, however your RFU data appears to be in ", | ||
.value(x), " space.", call. = FALSE | ||
) | ||
} | ||
if ( isTRUE(x == to) ) { | ||
stop( | ||
"You have indicated a bridge to ", .value(to), | ||
" space, however your RFU data already appears to be in ", | ||
.value(x), " space.", call. = FALSE | ||
) | ||
} | ||
|
||
invisible(to) | ||
} |
Oops, something went wrong.