Skip to content

Commit ac97d79

Browse files
committed
Rename to getOutlierIds, update stat articles
- renamed getFlaggedIds() to getOutlierIds() - updated calls to preProcessAdat() in stat workflow articles - removed recommendation to use pre-normalized data if scale factors correlate with biological endpoint
1 parent 0e8a784 commit ac97d79

16 files changed

+59
-56
lines changed

NAMESPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ export(getAnalyteInfo)
8686
export(getAnalytes)
8787
export(getFeatureData)
8888
export(getFeatures)
89-
export(getFlaggedIds)
9089
export(getMeta)
90+
export(getOutlierIds)
9191
export(getSeqId)
9292
export(getSeqIdMatches)
9393
export(getSignalSpace)

R/0-declare-global-variables.R

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ utils::globalVariables(
2929
"seqid",
3030
"SubjectCount",
3131
"SubjectId",
32+
"TargetFullName",
3233
"Type",
3334
"value",
3435
"Value"

R/getFlaggedIds.R renamed to R/getOutlierIds.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#' out_adat[12, apts] <- out_adat[12, apts] * 10
2525
#'
2626
#' om <- calcOutlierMap(out_adat)
27-
#' getFlaggedIds(om, out_adat, flags = 0.05, include = c("Sex", "Subarray"))
27+
#' getOutlierIds(om, out_adat, flags = 0.05, include = c("Sex", "Subarray"))
2828
#' @export
29-
getFlaggedIds <- function(x, flags = 0.05, data = NULL, include = NULL) {
29+
getOutlierIds <- function(x, flags = 0.05, data = NULL, include = NULL) {
3030

3131
if ( !inherits(x, "outlier_map") ) {
3232
stop("Input `x` object must be class `outlier_map`!",

R/plotMap.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ plot.Map <- function(x, color.scheme = NULL,
101101
# determine color palette for the final figure
102102
color.scheme <- color.scheme %||% rev(grDevices::topo.colors(100))
103103
legend.ticks <- 2 # only 2 are required for boolean data
104-
star_samples <- getFlaggedIds(obj, flags)$idx # outlier samples to flag
104+
star_samples <- getOutlierIds(obj, flags)$idx # outlier samples to flag
105105

106106
# define plot title & axis labels for starred samples
107107
title <- paste0(plot.info$title, " ",

R/preProcessAdat.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ preProcessAdat <- function(adat,
129129

130130
if( filter.outliers ) {
131131
# get count of sample level outliers by RFU
132-
rfu_outliers <- suppressMessages(getFlaggedIds(calcOutlierMap(adat)))
132+
rfu_outliers <- suppressMessages(getOutlierIds(calcOutlierMap(adat)))
133133
n_outliers <- nrow(rfu_outliers)
134134
adat <- adat |> filter(!dplyr::row_number() %in% rfu_outliers$idx)
135135

inst/WORDLIST

+2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ frac
9999
funder
100100
ggplot
101101
gridlines
102+
homogenate
102103
intra
103104
leftrightarrow
104105
lifecycle
105106
lysate
107+
lysis
106108
magrittr
107109
medNormRef
108110
nd

man/calcOutlierMap.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/getFlaggedIds.Rd renamed to man/getOutlierIds.Rd

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot.Map.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/preProcessAdat.Rd

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-getFlaggedIds.R renamed to tests/testthat/test-getOutlierIds.R

+24-24
Original file line numberDiff line numberDiff line change
@@ -10,93 +10,93 @@ om <- calcOutlierMap(data)
1010

1111

1212
# Testing ------
13-
test_that("`getFlaggedIds()` returns error if `x` is not the required class", {
13+
test_that("`getOutlierIds()` returns error if `x` is not the required class", {
1414
expect_error(
15-
getFlaggedIds(1:3),
15+
getOutlierIds(1:3),
1616
"Input `x` object must be class `outlier_map`!"
1717
)
1818
expect_error(
19-
getFlaggedIds("foo"),
19+
getOutlierIds("foo"),
2020
"Input `x` object must be class `outlier_map`!"
2121
)
2222
expect_error(
23-
getFlaggedIds(data.frame(x = 1)),
23+
getOutlierIds(data.frame(x = 1)),
2424
"Input `x` object must be class `outlier_map`!"
2525
)
2626
})
2727

28-
test_that("`getFlaggedIds()` returns error if `data` is not a df", {
28+
test_that("`getOutlierIds()` returns error if `data` is not a df", {
2929
expect_error(
30-
getFlaggedIds(om, data = 1:3),
30+
getOutlierIds(om, data = 1:3),
3131
"The `data` argument must be a `data.frame` object."
3232
)
3333
})
3434

35-
test_that("`getFlaggedIds()` returns error if flags arg is not in [0, 1]", {
35+
test_that("`getOutlierIds()` returns error if flags arg is not in [0, 1]", {
3636
expect_error(
37-
getFlaggedIds(om, flags = 1.1),
37+
getOutlierIds(om, flags = 1.1),
3838
"`flags =` argument must be between 0 and 1!"
3939
)
4040
expect_error(
41-
getFlaggedIds(om, flags = -0.1),
41+
getOutlierIds(om, flags = -0.1),
4242
"`flags =` argument must be between 0 and 1!"
4343
)
4444
})
4545

46-
test_that("`getFlaggedIds()` trips error if `include` not in `data`", {
46+
test_that("`getOutlierIds()` trips error if `include` not in `data`", {
4747
expect_error(
48-
getFlaggedIds(om, 0.05, data, "foo"),
48+
getOutlierIds(om, 0.05, data, "foo"),
4949
"All `include` must be in `data`."
5050
)
5151
})
5252

53-
test_that("`getFlaggedIds()` returns 0 row df and msg if no obs are flagged", {
54-
expect_message(outliers <- getFlaggedIds(om, 0.8),
53+
test_that("`getOutlierIds()` returns 0 row df and msg if no obs are flagged", {
54+
expect_message(outliers <- getOutlierIds(om, 0.8),
5555
"No observations were flagged at this flagging proportion:")
5656

5757
expect_s3_class(outliers, "data.frame")
5858
expect_false(has_rn(outliers))
5959
expect_equal(outliers, data.frame(idx = numeric(0)))
6060
})
6161

62-
test_that("`getFlaggedIds()` works on `calcOutlierMap` object, using default
62+
test_that("`getOutlierIds()` works on `calcOutlierMap` object, using default
6363
flags = 0.05, no included variables", {
64-
outliers <- getFlaggedIds(om, data = data)
64+
outliers <- getOutlierIds(om, data = data)
6565
expect_s3_class(outliers, "data.frame")
6666
expect_false(has_rn(outliers))
6767
expect_equal(outliers, data.frame(idx = c(12, 18)))
6868
})
6969

70-
test_that("`getFlaggedIds()` works on `calcOutlierMap` object, using
70+
test_that("`getOutlierIds()` works on `calcOutlierMap` object, using
7171
flags = 0.02, one included variable", {
72-
outliers <- getFlaggedIds(om, 0.02, data, "SampleId")
72+
outliers <- getOutlierIds(om, 0.02, data, "SampleId")
7373
expect_s3_class(outliers, "data.frame")
7474
expect_false(has_rn(outliers))
7575
expect_equal(outliers, data.frame(idx = c(12, 13, 18, 20),
7676
SampleId = c("14", "15", "21", "23")))
7777
})
7878

79-
test_that("`getFlaggedIds()` works on `calcOutlierMap` object, using
79+
test_that("`getOutlierIds()` works on `calcOutlierMap` object, using
8080
flags = 0.1, multiple included variables", {
81-
outliers <- getFlaggedIds(om, 0.1, data, c("SampleId", "Sex"))
81+
outliers <- getOutlierIds(om, 0.1, data, c("SampleId", "Sex"))
8282
expect_s3_class(outliers, "data.frame")
8383
expect_false(has_rn(outliers))
8484
expect_equal(outliers, data.frame(idx = 12,
8585
SampleId = "14",
8686
Sex = "M"))
8787
})
8888

89-
test_that("`getFlaggedIds()` works on `calcOutlierMap` object with `data = NULL`", {
89+
test_that("`getOutlierIds()` works on `calcOutlierMap` object with `data = NULL`", {
9090
# data = NULL, include = NULL
91-
outliers <- getFlaggedIds(om)
91+
outliers <- getOutlierIds(om)
9292
expect_s3_class(outliers, "data.frame")
9393
expect_false(has_rn(outliers))
9494
expect_equal(outliers, data.frame(idx = c(12, 18)))
9595
})
9696

97-
test_that("`getFlaggedIds()` `include` is ignored `data = NULL`", {
97+
test_that("`getOutlierIds()` `include` is ignored `data = NULL`", {
9898
expect_equal(
99-
getFlaggedIds(om),
100-
getFlaggedIds(om, data = NULL, include = "SampleId") # test if `data = NULL`
99+
getOutlierIds(om),
100+
getOutlierIds(om, data = NULL, include = "SampleId") # test if `data = NULL`
101101
)
102102
})

vignettes/articles/pre-processing.Rmd

+4-5
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ plot(om)
331331
The one sample in `filt_data` that we modified in the previous code chunk
332332
was identified as an outlier by RFU measurements with the `*`.
333333

334-
The `getFlaggedIds()` function is useful for extracting the
334+
The `getOutlierIds()` function is useful for extracting the
335335
sample IDs that were flagged as outliers in the plot. These sample IDs should be
336336
investigated further and possibly considered for removal prior to analysis.
337337

338338
```{r get-flagged-id}
339-
rfu_outliers <- getFlaggedIds(om)
339+
rfu_outliers <- getOutlierIds(om)
340340
rfu_outliers
341341
342342
# drop one outlier sample
@@ -433,9 +433,8 @@ norm_vars |>
433433
```
434434

435435
If there *is* a considerable normalization bias observed in your ADAT,
436-
an alternate normalization or use of pre-normalized data should be used
437-
for univariate analyses, and any planned analyses may need to be
438-
modified to account for this bias.
436+
an alternate normalization should be used for univariate analyses, and any
437+
planned analyses may need to be modified to account for this bias.
439438

440439
------------------------------------------------------------------------
441440

vignettes/articles/stat-binary-classification.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ table(example_data$SampleType)
5858
cleanData <- example_data |>
5959
preProcessAdat(
6060
filter.features = TRUE, # rm non-human protein features
61-
filter.samples = TRUE, # rm control samples
62-
data.qc = "Sex", # plot scale factors by covariate
61+
filter.controls = TRUE, # rm control samples
62+
filter.qc = TRUE, # rm non-passing qc samples
6363
log.10 = TRUE, # log10 transform
64-
center.scale = TRUE # center, scale transform
64+
center.scale = TRUE # center/scale analytes
6565
)
6666
6767
# drop any missing values in Sex, and convert to binary 0/1 variable

vignettes/articles/stat-linear-regression.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ table(example_data$SampleType)
5858
cleanData <- example_data |>
5959
preProcessAdat(
6060
filter.features = TRUE, # rm non-human protein features
61-
filter.samples = TRUE, # rm control samples
62-
data.qc = "Age", # plot scale factors by covariate
61+
filter.controls = TRUE, # rm control samples
62+
filter.qc = TRUE, # rm non-passing qc samples
6363
log.10 = TRUE, # log10 transform
64-
center.scale = TRUE # center, scale transform
64+
center.scale = TRUE # center/scale analytes
6565
)
6666
6767
# drop any missing Age values

vignettes/articles/stat-three-group-analysis-anova.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ table(example_data$SampleType)
6060
cleanData <- example_data |>
6161
preProcessAdat(
6262
filter.features = TRUE, # rm non-human protein features
63-
filter.samples = TRUE, # rm control samples
64-
data.qc = "Sex", # plot scale factors by covariate
63+
filter.controls = TRUE, # rm control samples
64+
filter.qc = TRUE, # rm non-passing qc samples
6565
log.10 = TRUE, # log10 transform
66-
center.scale = TRUE # center, scale transform
66+
center.scale = TRUE # center/scale analytes
6767
)
6868
6969
# drop any missing values in Sex

vignettes/articles/stat-two-group-comparison.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ table(example_data$SampleType)
5858
cleanData <- example_data |>
5959
preProcessAdat(
6060
filter.features = TRUE, # rm non-human protein features
61-
filter.samples = TRUE, # rm control samples
62-
data.qc = "Sex", # plot scale factors by covariate
61+
filter.controls = TRUE, # rm control samples
62+
filter.qc = TRUE, # rm non-passing qc samples
6363
log.10 = TRUE, # log10 transform
64-
center.scale = TRUE # center, scale transform
64+
center.scale = TRUE # center/scale analytes
6565
)
6666
6767
# drop any missing values in Sex

0 commit comments

Comments
 (0)