R6 class representing modelling result

R6 class representing modelling result

Super class

prolfqua::ModelInterface -> Model

Public fields

modelDF

data.frame with modelling data and model.

modelName

name of model

subject_Id

e.g. protein_Id

model_strategy

function to create the models

anova_df

function to compute anova

p.adjust

function to adjust p-values

Methods


Method new()

initialize

Usage

Model$new(
  modelDF,
  model_strategy,
  modelName,
  subject_Id = "protein_Id",
  p.adjust = prolfqua::adjust_p_values
)

Arguments

modelDF

dataframe with modelling results

model_strategy

model_strategy see strategy_lmer

modelName

name of model

subject_Id

subject column name

p.adjust

method to adjust p-values


Method get_coefficients()

return model coefficient table

Usage

Model$get_coefficients()


Method get_anova()

return anova table

Usage

Model$get_anova()


Method write_coefficients()

writes model coefficients to file

Usage

Model$write_coefficients(path, format = "xlsx")

Arguments

path

folder to write to

format

default xlsx lfq_write_table


Method coef_histogram()

histogram of model coefficient

Usage

Model$coef_histogram()


Method coef_volcano()

volcano plot of non intercept coefficients

Usage

Model$coef_volcano()


Method coef_pairs()

pairs-plot of coefficients

Usage

Model$coef_pairs()


Method anova_histogram()

histogram of ANOVA results

Usage

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

Arguments

what

show either "Pr..F." or "FDR.Pr..F."


Method write_anova_figures()

write figures related to ANOVA into pdf file

Usage

Model$write_anova_figures(path, width = 10, height = 10)

Arguments

path

folder name

width

figure width

height

figure height


Method write_coef_figures()

write figures related to Coefficients into pdf file

Usage

Model$write_coef_figures(path, width = 10, height = 10)

Arguments

path

folder name

width

figure width

height

figure height


Method clone()

The objects of this class are cloneable with this method.

Usage

Model$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples




istar <- prolfqua_data('data_ionstar')$normalized()
istar$config <- old2new(istar$config)
istar_data <- dplyr::filter(istar$data ,protein_Id %in% sample(protein_Id, 100))
modelName <- "f_condtion_r_peptide"
formula_randomPeptide <-
  strategy_lmer("transformedIntensity  ~ dilution. + (1 | peptide_Id)",
   model_name = modelName)
pepIntensity <- istar_data
config <- istar$config
config$table$hierarchy_keys_depth()
#> [1] "protein_Id"
mod <- prolfqua::build_model(
 pepIntensity,
 formula_randomPeptide,
 modelName = modelName,
 subject_Id = config$table$hierarchy_keys_depth())
#> boundary (singular) fit: see help('isSingular')
#> Joining with `by = join_by(protein_Id)`

mod$modelDF
#> # A tibble: 68 × 9
#> # Groups:   protein_Id [68]
#>    protein_Id     data     linear_model exists_lmer isSingular df.residual sigma
#>    <chr>          <list>   <list>       <lgl>       <lgl>            <dbl> <dbl>
#>  1 sp|P21589|5NT… <tibble> <lmrMdLmT>   TRUE        FALSE              276 0.298
#>  2 sp|Q9NZM3|ITS… <tibble> <lmrMdLmT>   TRUE        FALSE               18 0.250
#>  3 sp|O43660|PLR… <tibble> <lmrMdLmT>   TRUE        FALSE               79 0.367
#>  4 sp|P0A908|MIP… <tibble> <lmrMdLmT>   TRUE        FALSE               26 0.312
#>  5 sp|P62857|RS2… <tibble> <lmrMdLmT>   TRUE        FALSE               53 0.695
#>  6 sp|Q9Y3A5|SBD… <tibble> <lmrMdLmT>   TRUE        FALSE              172 0.287
#>  7 sp|Q13838|DX3… <tibble> <lmrMdLmT>   TRUE        FALSE              199 0.305
#>  8 sp|O00148|DX3… <tibble> <lmrMdLmT>   TRUE        FALSE              178 0.338
#>  9 sp|P25789|PSA… <tibble> <lmrMdLmT>   TRUE        FALSE              142 0.435
#> 10 sp|P41252|SYI… <tibble> <lmrMdLmT>   TRUE        FALSE              508 0.299
#> # ℹ 58 more rows
#> # ℹ 2 more variables: nrcoef <int>, nrcoeff_not_NA <int>
aovtable  <- mod$get_anova()
mod$get_coefficients()
#> # A tibble: 340 × 9
#> # Groups:   protein_Id [68]
#>    protein_Id        isSingular nrcoef factor Estimate Std..Error     df t.value
#>    <chr>             <lgl>       <int> <chr>     <dbl>      <dbl>  <dbl>   <dbl>
#>  1 sp|P21589|5NTD_H… FALSE           5 (Inte…   0.883      0.358   15.3    2.47 
#>  2 sp|P21589|5NTD_H… FALSE           5 dilut…   0.0975     0.0559 263.     1.74 
#>  3 sp|P21589|5NTD_H… FALSE           5 dilut…   0.0700     0.0557 263.     1.26 
#>  4 sp|P21589|5NTD_H… FALSE           5 dilut…  -0.0232     0.0564 263.    -0.412
#>  5 sp|P21589|5NTD_H… FALSE           5 dilut…   0.127      0.0557 263.     2.27 
#>  6 sp|Q9NZM3|ITSN2_… FALSE           5 (Inte…  -1.60       0.124    2.71 -12.9  
#>  7 sp|Q9NZM3|ITSN2_… FALSE           5 dilut…  -0.299      0.139   19.0   -2.15 
#>  8 sp|Q9NZM3|ITSN2_… FALSE           5 dilut…  -0.201      0.146   19.0   -1.38 
#>  9 sp|Q9NZM3|ITSN2_… FALSE           5 dilut…  -0.250      0.206   19.8   -1.21 
#> 10 sp|Q9NZM3|ITSN2_… FALSE           5 dilut…   0.0464     0.146   19.0    0.318
#> # ℹ 330 more rows
#> # ℹ 1 more variable: Pr...t.. <dbl>
mod$coef_histogram()
#> $plot

#> 
#> $name
#> [1] "Coef_Histogram_f_condtion_r_peptide.pdf"
#> 
mod$coef_volcano()
#> $plot

#> 
#> $name
#> [1] "Coef_VolcanoPlot_f_condtion_r_peptide.pdf"
#> 
mod$coef_pairs()
#> $plot
#> # A tibble: 68 × 6
#>    subject_Id          `(Intercept)` dilution.b dilution.c dilution.d dilution.e
#>    <chr>                       <dbl>      <dbl>      <dbl>      <dbl>      <dbl>
#>  1 sp|P21589|5NTD_HUM…         0.883    0.0975     0.0700     -0.0232    0.127  
#>  2 sp|Q9NZM3|ITSN2_HU…        -1.60    -0.299     -0.201      -0.250     0.0464 
#>  3 sp|O43660|PLRG1_HU…        -1.15     0.0266    -0.0128      0.0302    0.00359
#>  4 sp|P0A908|MIPA_ECO…        -1.55     0.997      0.974       1.78      1.79   
#>  5 sp|P62857|RS28_HUM…         2.39    -0.325     -0.570      -0.0864   -0.155  
#>  6 sp|Q9Y3A5|SBDS_HUM…        -0.130   -0.0601    -0.108      -0.0289   -0.106  
#>  7 sp|Q13838|DX39B_HU…         1.89     0.00453    0.0587      0.0638    0.0208 
#>  8 sp|O00148|DX39A_HU…         1.34     0.0791     0.146       0.0983   -0.0395 
#>  9 sp|P25789|PSA4_HUM…         0.955   -0.0780    -0.0389     -0.188    -0.153  
#> 10 sp|P41252|SYIC_HUM…        -0.146    0.0179    -0.00398    -0.0451   -0.0704 
#> # ℹ 58 more rows
#> 
#> $name
#> [1] "Coef_Pairsplot_f_condtion_r_peptide.pdf"
#> 
mod$anova_histogram()
#> $plot

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