apply_to_response_matrix: Apply function requiring a matrix to tidy table

View source: R/tidyMS_R6_TransitionCorrelations.R

apply_to_response_matrixR Documentation

Apply function requiring a matrix to tidy table

Description

Apply function requiring a matrix to tidy table

Usage

apply_to_response_matrix(data, config, .func, .funcname = NULL)

Arguments

data

data.frame

config

AnalysisConfiguration

.func

function

.funcname

name of function (used for creating new column)

See Also

Other preprocessing: INTERNAL_FUNCTIONS_BY_FAMILY, filter_proteins_by_peptide_count(), get_robscales(), normalize_log2_robscale(), robust_scale(), scale_with_subset(), scale_with_subset_by_factors()

Examples



bb <- prolfqua_data('data_ionstar')$filtered()
bb$config <- old2new(bb$config)
stopifnot(nrow(bb$data) == 25780)
conf <- bb$config$clone(deep=TRUE)
data <- bb$data
res <- apply_to_response_matrix(data, conf, .func = base::scale)
stopifnot("peptide.intensity_base..scale" %in% colnames(res))
stopifnot("peptide.intensity_base..scale" == conf$table$get_response())
conf <- bb$config$clone(deep=TRUE)
conf$table$workIntensity <- "peptide.intensity"
res <- apply_to_response_matrix(data, conf$clone(deep=TRUE), .func = robust_scale)

# Normalize data using the vsn method from bioconductor

if( require("vsn")){
 res <- apply_to_response_matrix(data, conf$clone(deep=TRUE), .func = vsn::justvsn)
}


wolski/prolfqua documentation built on April 27, 2024, 4:09 p.m.