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)

Examples


dd <- prolfqua::sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> Warning: no nr_children column specified in the data, adding column nr_children and setting to 1.
#> completing cases
config <- dd$config
res <- dd$data
ranked <- rank_peptide_by_intensity(res,config)
#> Joining with `by = join_by(protein_Id, peptide_Id)`
#> Columns added : srm_meanInt srm_meanIntRank

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))
#> [1] 116   8
# stopifnot(dim(resTOPN$data) == c(3260, 8))
stopifnot( names(resTOPN) %in% c("data", "config") )
config$table$get_response()
#> [1] "abundance"
#debug(plot_estimate)
tmpRob <- plot_estimate(ranked,
 config,
 resTOPN$data,
 resTOPN$config,
 show.legend=TRUE)
stopifnot( "ggplot" %in% class(tmpRob$plots[[4]]) )