Skip to content

Commit

Permalink
moving to simulated data. Cleaning up examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed Jan 19, 2024
1 parent 60f2d70 commit 8df0ff2
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 108 deletions.
82 changes: 39 additions & 43 deletions R/tidyMS_missigness.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ missigness_impute_factors_interactions <-
#' imputed <- get_contrast(imputed, config$table$hierarchy_keys(), Contrasts)
#'
#' imputedProt <- aggregate_contrast(imputed, subject_Id = config$table$hierarchy_keys_depth())
#' if(FALSE){
#' \dontrun{
#' plot(imputedProt$group_1 - imputedProt$group_2, imputedProt$estimate_median)
#' abline(c(0,1), col=2, pch = "*")
#' plot(meanProt$estimate_median - imputedProt$estimate_median )
Expand Down Expand Up @@ -471,22 +471,16 @@ get_imputed_contrasts <- function(pepIntensity,
#' @family imputation
#' @examples
#'
#' bb <- prolfqua_data('data_ionstar')
#' configur <- old2new(bb$config)
#' data <- bb$data
#' xx <- complete_cases(data, configur)
#' missigness_histogram(xx, configur)
#'
#' missingPrec <- interaction_missing_stats(xx, configur)
#'
#' bx <- prolfqua_data('data_ionstar')$normalized()
#' configur <- old2new(bx$config)
#' data <- bx$data
#' data <- complete_cases(data, configur)
#' missingPrecNorm <- interaction_missing_stats(data, configur)
#' istar <- sim_lfq_data_peptide_config()
#' config <- istar$config
#' analysis <- istar$data
#' xx <- complete_cases(data, config)
#' pl <- missigness_histogram(xx, config)
#'
#' missigness_histogram(data, configur, showempty=FALSE)
#' missigness_histogram(data, configur, showempty=TRUE)
#' pl <- missigness_histogram(data, config, showempty=FALSE)
#' stopifnot("ggplot" %in% class(pl))
#' pl <- missigness_histogram(data, config, showempty=TRUE)
#' stopifnot("ggplot" %in% class(pl))
#'
missigness_histogram <- function(x,
config,
Expand Down Expand Up @@ -535,15 +529,14 @@ missigness_histogram <- function(x,
#' @examples
#'
#'
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' stopifnot(nrow(bb$data) == 25780)
#' configur <- old2new(bb$config$clone(deep=TRUE))
#' data <- bb$data
#' istar <- sim_lfq_data_peptide_config()
#' config <- istar$config
#' analysis <- istar$data
#'
#' res <- missingness_per_condition_cumsum(data,configur)
#' res <- missingness_per_condition_cumsum(analysis,config)
#' stopifnot("ggplot" %in% class(res$figure))
#' print(res$figure)
#' res$data
#' stopifnot(ncol(res$data) >= 6)
#'
missingness_per_condition_cumsum <- function(x,
config,
factors = config$table$factor_keys_depth()){
Expand Down Expand Up @@ -576,15 +569,15 @@ missingness_per_condition_cumsum <- function(x,
#' @family plotting
#' @family imputation
#' @examples
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' stopifnot(nrow(bb$data) == 25780)
#' configur <- old2new(bb$config$clone(deep=TRUE))
#' data <- bb$data
#'
#' res <- missingness_per_condition(data, configur)
#' stopifnot(c(5,8) == dim(res$data))
#' istar <- sim_lfq_data_peptide_config()
#' config <- istar$config
#' analysis <- istar$data
#'
#' res <- missingness_per_condition(analysis, config)
#' stopifnot("ggplot" %in% class(res$figure))
#' print(res$figure)
#'
#' stopifnot(ncol(res$data) >= 5)
#'
missingness_per_condition <- function(x, config, factors = config$table$factor_keys_depth()){
table <- config$table
Expand Down Expand Up @@ -618,13 +611,15 @@ missingness_per_condition <- function(x, config, factors = config$table$factor_k
#' @family imputation
#' @param tr if less than tr observations in condition then missing
#' @examples
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' stopifnot(nrow(bb$data) == 25780)
#' configur <- old2new(bb$config$clone(deep=TRUE))
#' data <- bb$data
#' #debug(UpSet_interaction_missing_stats)
#' pups <- UpSet_interaction_missing_stats(data, configur)
#' #UpSetR::upset(pups$data, order.by = "freq", nsets = pups$nsets)
#' istar <- sim_lfq_data_peptide_config()
#' config <- istar$config
#' analysis <- istar$data
#'
#' pups <- UpSet_interaction_missing_stats(data, config)
#' stopifnot(ncol(pups$data) == 5)
#' \dontrun{
#' UpSetR::upset(pups$data, order.by = "freq", nsets = pups$nsets)
#' }
UpSet_interaction_missing_stats <- function(data, cf, tr = 2) {
tmp <- prolfqua::interaction_missing_stats(data, cf)
nrMiss <- tmp$data |> tidyr::pivot_wider(id_cols = cf$table$hierarchy_keys(),
Expand All @@ -644,12 +639,13 @@ UpSet_interaction_missing_stats <- function(data, cf, tr = 2) {
#' @family plotting
#' @family imputation
#' @examples
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' stopifnot(nrow(bb$data) == 25780)
#' configur <- old2new(bb$config$clone(deep=TRUE))
#' data <- bb$data
#' pups <- UpSet_missing_stats(data, configur)
#' #UpSetR::upset(pups$data , order.by = "freq", nsets = pups$nsets)
#' istar <- sim_lfq_data_peptide_config()
#' config <- istar$config
#' analysis <- istar$data
#' pups <- UpSet_missing_stats(analysis, config)
#' \dontrun{
#' UpSetR::upset(pups$data , order.by = "freq", nsets = pups$nsets)
#' }
UpSet_missing_stats <- function(data, config){
data <- prolfqua::complete_cases(data, config)
responseName <- config$table$get_response()
Expand Down
16 changes: 9 additions & 7 deletions man/UpSet_interaction_missing_stats.Rd

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

13 changes: 7 additions & 6 deletions man/UpSet_missing_stats.Rd

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

2 changes: 1 addition & 1 deletion man/aggregate_contrast.Rd

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

20 changes: 9 additions & 11 deletions man/get_contrast.Rd

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

21 changes: 10 additions & 11 deletions man/get_imputed_contrasts.Rd

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

24 changes: 9 additions & 15 deletions man/missigness_histogram.Rd

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

14 changes: 7 additions & 7 deletions man/missingness_per_condition.Rd

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

13 changes: 6 additions & 7 deletions man/missingness_per_condition_cumsum.Rd

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

0 comments on commit 8df0ff2

Please sign in to comment.