Skip to contents

LM + missing-value imputation contrast analysis facade

LM + missing-value imputation contrast analysis facade

Details

Encapsulates the pipeline: strategy_lm -> build_model -> Contrasts -> merge with ContrastsMissing -> ContrastsModerated.

Proteins without a fitted model get their contrasts filled in from the group-mean imputation method (ContrastsMissing).

Public fields

model

Model object

contrast

ContrastsModerated object (merged with ContrastsMissing)

missing_contrast

ContrastsMissing object

merged

merged contrast result list from merge_contrasts_results

Methods


Method new()

initialize

Usage

ContrastsLMMissingFacade$new(lfqdata, modelstr, contrasts, ...)

Arguments

lfqdata

LFQData object

modelstr

model formula string (e.g. "~ group_")

contrasts

named character vector of contrasts

...

passed to strategy_lm


Method get_contrasts()

get contrast results

Usage

ContrastsLMMissingFacade$get_contrasts(...)

Arguments

...

passed to ContrastsTable$get_contrasts


Method get_Plotter()

get ContrastsPlotter

Usage

ContrastsLMMissingFacade$get_Plotter(...)

Arguments

...

passed to ContrastsTable$get_Plotter


Method to_wide()

convert results to wide format

Usage

ContrastsLMMissingFacade$to_wide(...)

Arguments

...

passed to ContrastsTable$to_wide


Method clone()

The objects of this class are cloneable with this method.

Usage

ContrastsLMMissingFacade$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# ContrastsMissing requires protein-level data (hierarchyDepth == len(hierarchy_keys()))
istar <- sim_lfq_data_protein_config(Nprot = 30)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$rename_response("transformedIntensity")
contrasts <- c("A_vs_Ctrl" = "group_A - group_Ctrl")
fa <- ContrastsLMMissingFacade$new(lfqdata, "~ group_", contrasts)
#> Joining with `by = join_by(protein_Id)`
#> determine linear functions:
#> Warning: linfct_matrix_contrasts: computed 0/2 contrasts; failed 2: A_vs_Ctrl, avg_A_vs_Ctrl.  In argument: `A_vs_Ctrl = group_A - group_Ctrl`.
#> Caused by error:
#> ! object 'group_A' not found;  In argument: `avg_A_vs_Ctrl = (group_A + group_Ctrl)/2`.
#> Caused by error:
#> ! object 'group_A' not found
#> get_contrasts -> contrasts_linfct
#> contrasts_linfct
#> Joining with `by = join_by(protein_Id, contrast)`
#> completing cases
#> A_vs_Ctrl=group_A - group_Ctrl
#> A_vs_Ctrl=group_A - group_Ctrl
#> A_vs_Ctrl=group_A - group_Ctrl
#> Joining with `by = join_by(protein_Id, contrast)`
#> Joining with `by = join_by(protein_Id, contrast)`
head(fa$get_contrasts())
#> # A tibble: 6 × 14
#>   facade  modelName protein_Id contrast    diff std.error avgAbd statistic    df
#>   <chr>   <fct>     <chr>      <chr>      <dbl>     <dbl>  <dbl>     <dbl> <dbl>
#> 1 lm_mis… WaldTest… 0EfVhX~29… A_vs_Ct…  1.24       0.731   22.6    1.63    31.8
#> 2 lm_mis… WaldTest… 0m5WN4~67… A_vs_Ct… -0.0361     0.614   20.8   -0.0412  29.8
#> 3 lm_mis… WaldTest… 7QuTub~61… A_vs_Ct… -0.680      0.806   16.6   -0.831   29.8
#> 4 lm_mis… WaldTest… 7cbcrd~26… A_vs_Ct…  0.704      0.718   22.0    0.929   31.8
#> 5 lm_mis… WaldTest… 9VUkAq~34… A_vs_Ct…  0.768      1.42    20.0    0.939   30.8
#> 6 lm_mis… WaldTest… At886V~77… A_vs_Ct… -1.86       0.706   29.1   -2.46    31.8
#> # ℹ 5 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
#> #   sigma <dbl>, FDR <dbl>
fa$to_wide()
#> # A tibble: 30 × 5
#>    protein_Id diff.A_vs_Ctrl p.value.A_vs_Ctrl FDR.A_vs_Ctrl statistic.A_vs_Ctrl
#>    <chr>               <dbl>             <dbl>         <dbl>               <dbl>
#>  1 0EfVhX~29…         1.24              0.113          0.509              1.63  
#>  2 0m5WN4~67…        -0.0361            0.967          0.967             -0.0412
#>  3 7QuTub~61…        -0.680             0.413          0.630             -0.831 
#>  4 7cbcrd~26…         0.704             0.360          0.630              0.929 
#>  5 9VUkAq~34…         0.768             0.355          0.630              0.939 
#>  6 At886V~77…        -1.86              0.0196         0.164             -2.46  
#>  7 BEJI92~27…        -0.721             0.348          0.630             -0.952 
#>  8 CGzoYe~08…        -0.389             0.611          0.770             -0.514 
#>  9 CtOJ9t~91…        -0.0717            0.925          0.958             -0.0946
#> 10 DoWup2~28…        -1.82              0.0226         0.164             -2.40  
#> # ℹ 20 more rows