diff --git a/R/LFQDataSummariser.R b/R/LFQDataSummariser.R index 834b3de2a..7cd7210ff 100644 --- a/R/LFQDataSummariser.R +++ b/R/LFQDataSummariser.R @@ -16,6 +16,7 @@ #' sum$hierarchy_counts_sample("wide") #' sum$hierarchy_counts_sample("long") #' sum$plot_hierarchy_counts_sample() +#' sum$plot_hierarchy_counts_sample() #' tmp <- sum$interaction_missing_stats() #' #' sum$missingness_per_group() @@ -44,16 +45,20 @@ LFQDataSummariser <- R6::R6Class( #' @description #' number of elements at each level in every sample #' @param value wide - wide format, long - long format, plot - ggplot - hierarchy_counts_sample = function(value=c("wide","long")){ + #' @param nr_children get summary for 1,2 or more number of children + hierarchy_counts_sample = function(value=c("wide","long"), nr_children = 1){ value <- match.arg(value) - fun <- prolfqua::hierarchy_counts_sample(self$lfq$data, self$lfq$config) + fun <- prolfqua::hierarchy_counts_sample(self$lfq$data, self$lfq$config, + nr_children = nr_children) return(fun(value)) }, #' @description #' barplot showing number of elements at each level in every sample #' @param value wide - wide format, long - long format, plot - ggplot - plot_hierarchy_counts_sample = function(){ - fun <- prolfqua::hierarchy_counts_sample(self$lfq$data, self$lfq$config) + #' @param nr_children get summary for 1,2 or more number of children + plot_hierarchy_counts_sample = function(nr_children = 1){ + fun <- prolfqua::hierarchy_counts_sample(self$lfq$data, self$lfq$config, + nr_children = nr_children) return(fun("plot")) }, #' @description diff --git a/R/tidyMS_R6_TransitionCorrelations.R b/R/tidyMS_R6_TransitionCorrelations.R index 005adb374..5efc36318 100644 --- a/R/tidyMS_R6_TransitionCorrelations.R +++ b/R/tidyMS_R6_TransitionCorrelations.R @@ -226,7 +226,7 @@ tidy_to_wide <- function(data, #' testthat::expect_equal(nrow(res$rowdata), nrow(res$data)) #' testthat::expect_equal(ncol(res$data) - ncol(res$rowdata) , nrow(res$annotation)) #' res <- tidy_to_wide_config(data, config, as.matrix = TRUE) -#' stopifnot(all(dim(res$data) == c(28, 12)) +#' stopifnot(all(dim(res$data) == c(28, 12))) #' stopifnot(all(dim(res$annotation) == c(12, 4))) #' stopifnot(all(dim(res$rowdata) == c(28, 3))) #' diff --git a/man/LFQDataSummariser.Rd b/man/LFQDataSummariser.Rd index 25d6628cc..e76024e4c 100644 --- a/man/LFQDataSummariser.Rd +++ b/man/LFQDataSummariser.Rd @@ -20,6 +20,7 @@ sum$hierarchy_counts() sum$hierarchy_counts_sample("wide") sum$hierarchy_counts_sample("long") sum$plot_hierarchy_counts_sample() +sum$plot_hierarchy_counts_sample() tmp <- sum$interaction_missing_stats() sum$missingness_per_group() @@ -98,13 +99,18 @@ summarize hierarchy \subsection{Method \code{hierarchy_counts_sample()}}{ number of elements at each level in every sample \subsection{Usage}{ -\if{html}{\out{
}}\preformatted{LFQDataSummariser$hierarchy_counts_sample(value = c("wide", "long"))}\if{html}{\out{
}} +\if{html}{\out{
}}\preformatted{LFQDataSummariser$hierarchy_counts_sample( + value = c("wide", "long"), + nr_children = 1 +)}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ \item{\code{value}}{wide - wide format, long - long format, plot - ggplot} + +\item{\code{nr_children}}{get summary for 1,2 or more number of children} } \if{html}{\out{
}} } @@ -115,12 +121,14 @@ number of elements at each level in every sample \subsection{Method \code{plot_hierarchy_counts_sample()}}{ barplot showing number of elements at each level in every sample \subsection{Usage}{ -\if{html}{\out{
}}\preformatted{LFQDataSummariser$plot_hierarchy_counts_sample()}\if{html}{\out{
}} +\if{html}{\out{
}}\preformatted{LFQDataSummariser$plot_hierarchy_counts_sample(nr_children = 1)}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ +\item{\code{nr_children}}{get summary for 1,2 or more number of children} + \item{\code{value}}{wide - wide format, long - long format, plot - ggplot} } \if{html}{\out{
}} diff --git a/man/tidy_to_wide_config.Rd b/man/tidy_to_wide_config.Rd index addb02569..4aec419c6 100644 --- a/man/tidy_to_wide_config.Rd +++ b/man/tidy_to_wide_config.Rd @@ -28,7 +28,7 @@ res <- tidy_to_wide_config(data, config) testthat::expect_equal(nrow(res$rowdata), nrow(res$data)) testthat::expect_equal(ncol(res$data) - ncol(res$rowdata) , nrow(res$annotation)) res <- tidy_to_wide_config(data, config, as.matrix = TRUE) -stopifnot(all(dim(res$data) == c(28, 12)) +stopifnot(all(dim(res$data) == c(28, 12))) stopifnot(all(dim(res$annotation) == c(12, 4))) stopifnot(all(dim(res$rowdata) == c(28, 3))) diff --git a/vignettes/SimulateData.Rmd b/vignettes/SimulateData.Rmd index 3665849a1..55d0e5d5b 100644 --- a/vignettes/SimulateData.Rmd +++ b/vignettes/SimulateData.Rmd @@ -47,7 +47,7 @@ peptideAbundances <- prolfqua::sim_lfq_data(PEPTIDE = TRUE) library(prolfqua) atable <- AnalysisTableAnnotation$new() -atable$sampleName = "sample" +atable$fileName = "sample" atable$factors["group_"] = "group" atable$hierarchy[["protein_Id"]] = "proteinID" atable$hierarchy[["peptide_Id"]] = "peptideID"