aggregate_intensity_topN: Aggregates top N intensities

View source: R/tidyMS_aggregation.R

aggregate_intensity_topNR Documentation

Aggregates top N intensities

Description

run rank_peptide_by_intensity first

Usage

aggregate_intensity_topN(pdata, config, .func, N = 3)

Arguments

pdata

data.frame

config

AnalysisConfiguration

N

default 3 top intensities.

func

function to use for aggregation

Value

list with data and new reduced configuration (config)

See Also

Other aggregation: INTERNAL_FUNCTIONS_BY_FAMILY, estimate_intensity(), intensity_summary_by_hkeys(), medpolish_estimate(), medpolish_estimate_df(), medpolish_estimate_dfconfig(), medpolish_protein_estimates(), plot_estimate(), plot_hierarchies_add_quantline(), plot_hierarchies_line(), plot_hierarchies_line_df(), rlm_estimate(), rlm_estimate_dfconfig()

Examples


dd <- prolfqua::sim_lfq_data_peptide_config()
config <- dd$config
res <- dd$data
ranked <- rank_peptide_by_intensity(res,config)

mean_f <- function(x, name = FALSE){
 if(name){return("mean")};mean(x, na.rm=TRUE)
 }
sum_f <- function(x, name =FALSE){
 if(name){return("sum")};sum(x, na.rm = TRUE)
 }

resTOPN <- aggregate_intensity_topN(
 ranked,
 config,
 .func = mean_f,
  N=3)

print(dim(resTOPN$data))
# stopifnot(dim(resTOPN$data) == c(3260, 8))
stopifnot( names(resTOPN) %in% c("data", "config") )
config$table$get_response()
#debug(plot_estimate)
tmpRob <- plot_estimate(ranked,
 config,
 resTOPN$data,
 resTOPN$config,
 show.legend=TRUE)
stopifnot( "ggplot" %in% class(tmpRob$plots[[4]]) )


wolski/prolfqua documentation built on May 2, 2024, 7:23 p.m.