ContrastsModerated: Limma moderated contrasts

ContrastsModeratedR Documentation

Limma moderated contrasts

Description

Limma moderated contrasts

Limma moderated contrasts

Super class

prolfqua::ContrastsInterface -> ContrastsModerated

Public fields

Contrast

Class implementing the Contrast interface

modelName

name of model

subject_Id

columns with subject_Id (proteinID)

p.adjust

function to adjust p-values

Methods

Public methods

Inherited methods

Method new()

initialize

Usage
ContrastsModerated$new(
  Contrast,
  modelName = paste0(Contrast$modelName, "_moderated"),
  p.adjust = prolfqua::adjust_p_values
)
Arguments
Contrast

class implementing the ContrastInterface

modelName

name of the model

p.adjust

function to adjust p-values - default BH


Method get_contrast_sides()

get both sides of contrasts

Usage
ContrastsModerated$get_contrast_sides()

Method get_linfct()

get linear functions from contrasts

Usage
ContrastsModerated$get_linfct(global = TRUE)
Arguments
global

logical TRUE - get the a linear functions for all models, FALSE - linear function for each model


Method get_contrasts()

applies limma moderation

Usage
ContrastsModerated$get_contrasts(all = FALSE)
Arguments
all

should all columns be returned (default FALSE)

global

use a global linear function (determined by get_linfct)


Method get_Plotter()

get ContrastsPlotter

Usage
ContrastsModerated$get_Plotter(FCthreshold = 1, FDRthreshold = 0.1)
Arguments
FCthreshold

fold change threshold to show in plots

FDRthreshold

FDR threshold to show in plots


Method to_wide()

convert to wide format

Usage
ContrastsModerated$to_wide(columns = c("p.value", "FDR", "statistic"))
Arguments
columns

value column default moderated.p.value

Returns

data.frame


Method clone()

The objects of this class are cloneable with this method.

Usage
ContrastsModerated$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

moderated_p_limma_long

Other modelling: Contrasts, ContrastsMissing, ContrastsPlotter, ContrastsProDA, ContrastsROPECA, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, LR_test(), Model, build_model(), contrasts_fisher_exact(), get_anova_df(), get_complete_model_fit(), get_p_values_pbeta(), isSingular_lm(), linfct_all_possible_contrasts(), linfct_factors_contrasts(), linfct_from_model(), linfct_matrix_contrasts(), merge_contrasts_results(), model_analyse(), model_summary(), moderated_p_limma(), moderated_p_limma_long(), my_contest(), my_contrast(), my_contrast_V1(), my_contrast_V2(), my_glht(), pivot_model_contrasts_2_Wide(), plot_lmer_peptide_predictions(), sim_build_models_lm(), sim_build_models_lmer(), sim_make_model_lm(), sim_make_model_lmer(), strategy_lmer(), summary_ROPECA_median_p.scaled()

Examples


istar <- sim_lfq_data_protein_config(Nprot = 50)
protIntensity <- istar$data
config <- istar$config


lProt <- LFQData$new(protIntensity, config)
lProt$rename_response("transformedIntensity")
modelFunction <-
  strategy_lm("transformedIntensity  ~ group_")
mod <- build_model(
 lProt,
 modelFunction)

Contr <- c("dil.b_vs_a" = "group_A - group_Ctrl")
contrast <- prolfqua::Contrasts$new(mod,
 Contr)
contrast <- ContrastsModerated$new(contrast)
bb <- contrast$get_contrasts()
csi <- ContrastsMissing$new(lProt, contrasts = Contr)

contrast$get_contrasts() |> dim()
(xx <- csi$get_contrasts())   |> dim()
merged <- merge_contrasts_results(contrast, csi)

merged$more$get_contrasts() |> dim()
stopifnot(all(dim(merged$merged$get_contrasts() == c(50,13))))
stopifnot(all(dim(merged$same$get_contrasts()) == c(49,13)))

cs <- contrast$get_contrast_sides()
cslf <- contrast$get_linfct()
ctr <- contrast$get_contrasts()
ctrwide <- contrast$to_wide()
cp <- contrast$get_Plotter()

print(cp$histogram()$p.value, vp=NULL)
print(cp$histogram()$FDR, vp = NULL)

cp$volcano()
cp$ma_plot()




wolski/prolfqua documentation built on Dec. 4, 2024, 11:18 p.m.