Skip to content

Commit 7e3b6c0

Browse files
committed
update impute.min_local(): rm reqPercentPresent
1 parent 8d4d17f commit 7e3b6c0

24 files changed

Lines changed: 89 additions & 861 deletions

R/imputations.R

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ impute.min_global <- function(dataSet, reportImputing = FALSE) {
7474
#'
7575
#' @param dataSet The 2d dataset of experimental values.
7676
#'
77-
#' @param reqPercentPresent A scalar (default = 0.51) specifying the required percent of
78-
#' values that must be present in a given protein by condition combination for values to
79-
#' be imputed.
80-
#'
8177
#' @param reportImputing A boolean (default = FALSE) specifying whether to provide a
8278
#' shadow data frame with imputed data labels, where 1 indicates the corresponding entries
8379
#' have been imputed, and 0 indicates otherwise. Alters the return structure.
@@ -91,8 +87,7 @@ impute.min_global <- function(dataSet, reportImputing = FALSE) {
9187
#'
9288
#' @export
9389

94-
impute.min_local <- function(dataSet, reportImputing = FALSE,
95-
reqPercentPresent = 0.51) {
90+
impute.min_local <- function(dataSet, reportImputing = FALSE) {
9691

9792
## select the numerical data
9893
dataPoints <- shadowMatrix <- select(dataSet, -c(R.Condition, R.Replicate))
@@ -124,21 +119,13 @@ impute.min_local <- function(dataSet, reportImputing = FALSE,
124119
## select and isolate the data from each protein by condition combination
125120
localData <- dataPoints[conditionIndex, j]
126121

127-
## calculate the percent of samples that are present in that protein by
128-
## condition combination
129-
percentPresent <- sum(!is.na(localData)) / numReplicates[i]
122+
## identify missing values
123+
missingValues <- is.na(localData)
130124

131-
## impute missing values if the threshold is met
132-
if (percentPresent >= reqPercentPresent) {
133-
134-
## identify missing values
135-
missingValues <- is.na(localData)
136-
137-
## replace missing values with the minimum (non-NA) value of the protein by
138-
## condition combination
139-
dataPoints[conditionIndex, j] <- replace(localData, missingValues,
140-
min(localData, na.rm = TRUE))
141-
}
125+
## replace missing values with the minimum (non-NA) value of the protein by
126+
## condition combination
127+
dataPoints[conditionIndex, j] <- replace(localData, missingValues,
128+
min(localData, na.rm = TRUE))
142129
}
143130
}
144131

docs/articles/analysis.html

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/analysis.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ dataSet <- preprocessing(fileName,
1515
dataTran <- transform(dataSet, logFold = 2)
1616
## normalization
1717
dataNorm <- normalize(dataTran, normalizeType = "quant")
18-
## imputation
19-
dataImput <- impute.min_local(dataNorm, reportImputing = FALSE,
20-
reqPercentPresent = 0.51)
2118
## filtering
22-
dataImput <- filterNA(dataImput, saveRm = TRUE)
19+
dataImput_pre <- filterNA(dataNorm, minProp = 0.51, by = "cond", saveRm = TRUE)
20+
## imputation
21+
dataImput <- impute.min_local(dataImput_pre, reportImputing = FALSE)
2322
```
2423

2524
The functions in the analysis module calculate the results that can be

docs/articles/cust_vis.html

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/cust_vis.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ dataSet <- preprocessing(fileName,
2626
dataTran <- transform(dataSet, logFold = 2)
2727
## normalization
2828
dataNorm <- normalize(dataTran, normalizeType = "quant")
29-
## imputation
30-
dataImput <- impute.min_local(dataNorm, reportImputing = FALSE,
31-
reqPercentPresent = 0.51)
3229
## filtering
33-
dataImput <- filterNA(dataImput, minProp = 1, by = "all", saveRm = TRUE)
30+
dataImput_pre <- filterNA(dataNorm, minProp = 0.51, by = "cond", saveRm = TRUE)
31+
## imputation
32+
dataImput <- impute.min_local(dataImput_pre, reportImputing = FALSE)
3433
## analysis
3534
anlys_modt <- analyze.mod_t(dataImput, ref = "50pmol")
3635
anlys_ma <- analyze.ma(dataImput, ref = "50pmol")

0 commit comments

Comments
 (0)