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

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.

Examples


istar <- sim_lfq_data_protein_config(Nprot = 50)
#> creating sampleName from fileName column
#> completing cases
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)
#> Joining with `by = join_by(protein_Id)`

Contr <- c("dil.b_vs_a" = "group_A - group_Ctrl")
contrast <- prolfqua::Contrasts$new(mod,
 Contr)
contrast <- ContrastsModerated$new(contrast)
bb <- contrast$get_contrasts()
#> determine linear functions:
#> Warning: Warn 'linfct_matrix_contrasts':In argument: `dil.b_vs_a = group_A - group_Ctrl`.
#> Warning: Warn 'linfct_matrix_contrasts':In argument: `avg_dil.b_vs_a = (group_A + group_Ctrl)/2`.
#> compute contrasts:
#> computing contrasts.
#> Joining with `by = join_by(protein_Id, contrast)`
csi <- ContrastsMissing$new(lProt, contrasts = Contr)

contrast$get_contrasts() |> dim()
#> [1] 49 13
(xx <- csi$get_contrasts())   |> dim()
#> [1] "group_"
#> completing cases
#> dil.b_vs_a=group_A - group_Ctrl
#> dil.b_vs_a=group_A - group_Ctrl
#> dil.b_vs_a=group_A - group_Ctrl
#> [1] 50 20
merged <- merge_contrasts_results(contrast, csi)
#> Joining with `by = join_by(protein_Id, contrast)`
#> Joining with `by = join_by(protein_Id, contrast)`

merged$more$get_contrasts() |> dim()
#> [1]  1 13
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()
#> $FDR

#> 
cp$ma_plot()