Skip to contents

R6 class representing a limma modelling result

R6 class representing a limma modelling result

Details

Same API as Model: get_anova(), get_coefficients(), coef_histogram(), coef_volcano(), anova_histogram().

Super class

prolfqua::ModelInterface -> ModelLimma

Public fields

fit

limma MArrayLM object from lmFit

design

design matrix

formula

model formula

subject_Id

protein ID column name(s)

modelName

model name

rowdata

protein ID mapping from to_wide()$rowdata

trend

passed to eBayes

robust

passed to eBayes

dummy_model

one fitted lm for linfct extraction

p.adjust

function to adjust p-values

Methods


Method new()

initialize ModelLimma

Usage

ModelLimma$new(
  fit,
  design,
  formula,
  subject_Id,
  modelName,
  rowdata,
  trend = FALSE,
  robust = FALSE,
  dummy_model = NULL,
  p.adjust = prolfqua::adjust_p_values
)

Arguments

fit

limma MArrayLM from lmFit

design

design matrix

formula

model formula

subject_Id

protein ID column name(s)

modelName

model name

rowdata

protein ID mapping

trend

passed to eBayes

robust

passed to eBayes

dummy_model

one fitted lm for linfct extraction

p.adjust

function to adjust p-values


Method get_coefficients()

return model coefficient table in long format

Usage

ModelLimma$get_coefficients()

Returns

data.frame


Method get_anova()

return anova table (F-test per protein across all non-intercept coefficients)

Usage

ModelLimma$get_anova()

Returns

data.frame


Method coef_histogram()

histogram of model coefficient p-values

Usage

ModelLimma$coef_histogram()


Method coef_volcano()

volcano plot of non-intercept coefficients

Usage

ModelLimma$coef_volcano()


Method coef_pairs()

pairs plot of coefficients

Usage

ModelLimma$coef_pairs()


Method anova_histogram()

histogram of ANOVA F-test p-values

Usage

ModelLimma$anova_histogram(what = c("p.value", "FDR"))

Arguments

what

show either "p.value" or "FDR"


Method clone()

The objects of this class are cloneable with this method.

Usage

ModelLimma$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
#> completing cases done
#> setup done
lProt <- LFQData$new(istar$data, istar$config)
lProt$rename_response("transformedIntensity")
strat <- strategy_limma("transformedIntensity ~ group_")
mod <- build_model_limma(lProt, strat)
#> Warning: Partial NA coefficients for 1 probe(s)

coeffs <- mod$get_coefficients()
head(coeffs)
#> # A tibble: 6 × 6
#>   protein_Id  factor      Estimate Std..Error t.value  Pr...t..
#>   <chr>       <chr>          <dbl>      <dbl>   <dbl>     <dbl>
#> 1 0EfVhX~7161 (Intercept)     20.3      0.482    42.1 5.89e-143
#> 2 0m5WN4~3543 (Intercept)     20.5      0.482    42.6 1.17e-144
#> 3 76k03k~9735 (Intercept)     20.2      0.481    41.9 3.21e-142
#> 4 7QuTub~5556 (Intercept)     22.8      0.482    47.4 7.08e-159
#> 5 7cbcrd~0495 (Intercept)     17.2      0.681    25.2 3.32e- 82
#> 6 7soopj~3451 (Intercept)     26.3      0.481    54.7 3.79e-179
anova_tbl <- mod$get_anova()
head(anova_tbl)
#> # A tibble: 6 × 5
#>   protein_Id  F.value  p.value factor                  FDR
#>   <chr>         <dbl>    <dbl> <chr>                 <dbl>
#> 1 0EfVhX~7161    9.95 4.81e- 5 group_B+group_Ctrl 2.14e- 4
#> 2 0m5WN4~3543   26.8  2.57e-12 group_B+group_Ctrl 1.80e-11
#> 3 76k03k~9735    1.57 2.09e- 1 group_B+group_Ctrl 5.38e- 1
#> 4 7QuTub~5556    1.40 2.46e- 1 group_B+group_Ctrl 5.48e- 1
#> 5 7cbcrd~0495    6.12 2.22e- 3 group_B+group_Ctrl 8.35e- 3
#> 6 7soopj~3451    1.51 2.21e- 1 group_B+group_Ctrl 5.41e- 1
mod$coef_histogram()
#> $plot
#> Warning: Removed 1 row containing non-finite outside the scale range (`stat_bin()`).

#> 
#> $name
#> [1] "Coef_Histogram_limma.pdf"
#> 
mod$coef_volcano()
#> $plot
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_point()`).

#> 
#> $name
#> [1] "Coef_VolcanoPlot_limma.pdf"
#> 
mod$anova_histogram()
#> $plot
#> Warning: Removed 1 row containing non-finite outside the scale range (`stat_bin()`).

#> 
#> $name
#> [1] "Anova_p.values_limma.pdf"
#>