Skip to content

Commit

Permalink
fix the shadow matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Carol-seven committed Jul 25, 2024
1 parent 5408a55 commit c0ee0ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions R/imputations.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ impute.min_global <- function(dataSet, reportImputing = FALSE) {
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -291,7 +292,8 @@ impute.min_local <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -364,7 +366,8 @@ impute.knn <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -420,7 +423,8 @@ impute.knn_seq <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -476,7 +480,8 @@ impute.knn_trunc <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -565,7 +570,8 @@ impute.nuc_norm <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -624,7 +630,8 @@ impute.mice_norm <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -683,7 +690,8 @@ impute.mice_cart <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -745,7 +753,8 @@ impute.pca_bayes <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down Expand Up @@ -810,7 +819,8 @@ impute.pca_prob <- function(dataSet, reportImputing = FALSE,
if (reportImputing) {
## return the imputed data and the shadow matrix
return(list(imputedData = imputedData,
shadowMatrix = ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0)))
shadowMatrix = cbind(dataSet[,c("R.Condition", "R.Replicate")],
ifelse(is.na(shadowMatrix) & !is.na(dataPoints), 1, 0))))
} else {
return(imputedData)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pkgdown_sha: ~
articles:
scaffold: scaffold.html
usage_template: usage_template.html
last_built: 2024-07-25T04:54Z
last_built: 2024-07-25T19:05Z
urls:
reference: https://uconn-scs.github.io/msDiaLogue/reference
article: https://uconn-scs.github.io/msDiaLogue/articles

0 comments on commit c0ee0ad

Please sign in to comment.