Skip to contents

ROPECA contrast analysis facade

ROPECA contrast analysis facade

Details

Encapsulates the pipeline: strategy_lm -> build_model -> Contrasts -> ContrastsROPECA.

ROPECA operates on peptide-level data and aggregates peptide-level p-values to the protein level. The lfqdata object must contain peptide-level data (i.e. hierarchyDepth >= 2).

Public fields

model

Model object (peptide-level)

contrast

ContrastsROPECA object

Methods


Method new()

initialize

Usage

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

Arguments

lfqdata

LFQData object with peptide-level data (hierarchyDepth >= 2)

modelstr

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

contrasts

named character vector of contrasts

...

passed to strategy_lm


Method get_contrasts()

Get contrast results with standardized column names.

ROPECA's beta.based.significance is mapped to p.value and FDR.beta.based.significance to FDR.

Columns not directly produced by ROPECA are derived heuristically:

  • std.error = diff / statistic (algebraic: t = estimate / SE)

  • sigma = mad.estimate (MAD of peptide fold changes)

  • df = n_not_na (number of contributing peptides)

  • conf.low/conf.high via diff ± qt(0.975, df) * |std.error|

Usage

ContrastsROPECAFacade$get_contrasts()


Method get_Plotter()

get ContrastsPlotter (uses standardized column names)

Usage

ContrastsROPECAFacade$get_Plotter(FCthreshold = 2, FDRthreshold = 0.1)

Arguments

FCthreshold

fold change threshold

FDRthreshold

FDR threshold


Method to_wide()

convert results to wide format

Usage

ContrastsROPECAFacade$to_wide(columns = c("p.value", "FDR", "statistic"))

Arguments

columns

value columns to pivot, default c("p.value", "FDR", "statistic")


Method clone()

The objects of this class are cloneable with this method.

Usage

ContrastsROPECAFacade$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

istar <- sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
istar$config <- old2new(istar$config)
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata <- lfqdata$get_Transformer()$log2()$lfq
#> Column added : log2_abundance
contrasts <- c("A_vs_Ctrl" = "group_A - group_Ctrl")
fa <- ContrastsROPECAFacade$new(lfqdata, "~ group_", contrasts)
#> Joining with `by = join_by(protein_Id, peptide_Id)`
head(fa$get_contrasts())
#> determine linear functions:
#> get_contrasts -> contrasts_linfct
#> contrasts_linfct
#> Joining with `by = join_by(protein_Id, peptide_Id, contrast)`
#> # A tibble: 6 × 14
#> # Groups:   contrast [1]
#>   facade protein_Id  modelName contrast  avgAbd    diff        FDR statistic
#>   <chr>  <chr>       <chr>     <chr>      <dbl>   <dbl>      <dbl>     <dbl>
#> 1 ropeca 0EfVhX~0087 ROPECA    A_vs_Ctrl   4.27 -0.0742 0.0528         -1.75
#> 2 ropeca 7cbcrd~5725 ROPECA    A_vs_Ctrl   4.51  0.741  0.0000991       8.79
#> 3 ropeca 9VUkAq~4703 ROPECA    A_vs_Ctrl   4.47 -0.598  0.00000691    -12.7 
#> 4 ropeca BEJI92~5282 ROPECA    A_vs_Ctrl   4.23  0.277  0.00187         3.94
#> 5 ropeca CGzoYe~2147 ROPECA    A_vs_Ctrl   4.76 -0.310  0.0000374      -9.26
#> 6 ropeca DoWup2~5896 ROPECA    A_vs_Ctrl   4.43  0.295  0.00000138     14.7 
#> # ℹ 6 more variables: std.error <dbl>, df <int>, p.value <dbl>, conf.low <dbl>,
#> #   conf.high <dbl>, sigma <dbl>
fa$to_wide()
#> # A tibble: 10 × 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~00…        -0.0742       0.0423         0.0528                   -1.75
#>  2 7cbcrd~57…         0.741        0.0000496      0.0000991                 8.79
#>  3 9VUkAq~47…        -0.598        0.00000138     0.00000691              -12.7 
#>  4 BEJI92~52…         0.277        0.00112        0.00187                   3.94
#>  5 CGzoYe~21…        -0.310        0.0000150      0.0000374                -9.26
#>  6 DoWup2~58…         0.295        0.000000138    0.00000138               14.7 
#>  7 Fl4JiV~86…         0.0700       0.740          0.823                     2.08
#>  8 HvIpHG~90…        -0.384        0.00000389     0.0000130                -7.28
#>  9 JcKVfU~96…        -0.0634       0.00218        0.00312                  -1.87
#> 10 SGIVBl~57…        -0.122        0.993          0.993                    -3.88