Class to store the results of single-cell proteomics modelling
Source:R/ScpModel-Class.R
ScpModel-class.RdAn ScpModel object must be always stored in the metadata() of
an object that inherits from the SummarizedExperiment class. The
ScpModel object should never be accessed directly by the
user. Instead, we provide several setter function to retrieve
information that may be useful to the user.The ScpModel class
contains several slots:
scpModelFormula: aformulaobject controlling which variables are to be modelled.scpModelInputIndex: anumeric(1), selecting the assay to use in theSummarizedExperimentobject as input matrix. Note that this slot serves as a pointer, meaning that the quantitative data is not duplicated. Any change to the assay in theSummarizedExperimentwill impact the estimation of theScpModelobject.scpModelFilterThreshold: Anumeric(1)indicating the minimal n/p ratio required for a feature to be included in further model exploration. n/p is the number of measured values for a features divided by the number of coefficients to estimate. n/p cannot be smaller than 1 because this would lead to over-specified models.scpModelFitList: AListthat contains the model results for each feature. Each element is aScpModelFitobject (seeScpModelFit)
Usage
scpModelFormula(object, name)
scpModelInput(object, name, filtered = TRUE)
scpModelFilterThreshold(object, name)
scpModelFilterNPRatio(object, name, filtered = TRUE)
scpModelResiduals(object, name, join = TRUE, filtered = TRUE)
scpModelEffects(object, name, join = TRUE, filtered = TRUE)
scpModelNames(object)
scpModelFilterThreshold(object, name) <- valueArguments
- object
An object that inherits from the
SummarizedExperimentclass.- name
A
character(1)providing the name to use to store or retrieve the modelling results. When retrieving a model andnameis missing, the name of the first model found inobjectis used.- filtered
A
logical(1)indicating whether the output should return all features (FALSE) or the features that comply to the n/p ratio threshold (TRUE).- join
A
logical(1)indicating whether the output should be combined in a single matrix (TRUE) or it should be returned as a list with one element for each feature (FALSE). WhenTRUE, any gaps across features will be filled with NA's.- value
An
numeric(1), the new value for the n/p ratio threshold
Getters
Each slot has a getter function associated:
scpModelNames(): returns a vector of names ofScpModelobjects stored in theSummarizedExperimentobject.scpModelFormula(): returns theformulaslot of theScpModelwithin an object that inherits from theSummarizedExperimentclass.scpModelFilterThreshold(): returns the n/p ration threshold used for feature filtering.scpModelInput(): returns amatrixwith the quantitative values used as input of the model. Hence, the matrix contains the data before modelling. Iffiltered = TRUE, the feature of the matrix are restricted to the features that satisfy the n/p ratio threshold.scpModelFilterNPRatio(): returns the computed n/p ratio for each feature. Iffiltered = TRUE, the function returns only the n/p of the features that satisfy the n/p ratio threshold.scpModelResiduals(): whenjoin = FALSE, the function returns a list where each element corresponds to a feature and contains the estimated residuals. Whenjoin = TRUE(default), the function combines the list into a matrix with features in rows and cells in columns, and filling the gaps withNA. Iffiltered = TRUE, the feature of the matrix are restricted to the features that satisfy the n/p ratio threshold.scpModelEffects(): whenjoin = FALSE, the function return a list where each element of the list corresponds to a feature. Each element contains another list with as many elements as variable in the model and each element contains the data effect vector for that vector. Whenjoin = TRUE(default), each element of the list is a matrix with features in rows and cells in columns where gaps are filled withNA. Iffiltered = TRUE, the feature of the matrix are restricted to the features that satisfy the n/p ratio threshold.
Setter:
scpModelFilterThreshold<-(): the function changes the n/p ratio threshold used for filtering features.
See also
ScpModelFit for a description of the class that store modelling results
ScpModel-Workflow that uses the class to store the estimated model.
Examples
data("leduc_minimal")
####---- Getters ----####
scpModelNames(leduc_minimal)
#> [1] "model"
scpModelFormula(leduc_minimal)
#> ~1 + Channel + Set + MedianIntensity + SampleType
dim(leduc_minimal)
#> [1] 200 73
dim(scpModelInput(leduc_minimal))
#> [1] 140 73
dim(scpModelInput(leduc_minimal, filtered = FALSE))
#> [1] 200 73
head(scpModelFilterNPRatio(leduc_minimal))
#> SAVEDEGLK APNVVVTR IVVVTAGVR GFQEVVTPNIFNSR ENAYDLEANLAVLK
#> 1.277778 3.476190 1.411765 2.333333 1.235294
#> IGPLGLSPK
#> 1.888889
dim(scpModelResiduals(leduc_minimal))
#> [1] 140 73
dim(scpModelResiduals(leduc_minimal, filtered = FALSE))
#> [1] 200 73
scpModelResiduals(leduc_minimal, join = FALSE)
#> NumericList of length 140
#> [["SAVEDEGLK"]] wAL00284RI5=0.699508268833165 ...
#> [["APNVVVTR"]] eAL00219RI5=-0.211268540934462 ...
#> [["IVVVTAGVR"]] wAL00284RI5=0.103674283809887 ...
#> [["GFQEVVTPNIFNSR"]] eAL00219RI5=0.637577960221826 ...
#> [["ENAYDLEANLAVLK"]] eAL00220RI5=0.340761402427571 ...
#> [["IGPLGLSPK"]] eAL00220RI5=-0.111917031828062 ...
#> [["VAETANEEEVKK"]] eAL00219RI5=-0.0862785009338332 ...
#> [["TADDPSLSLIK"]] eAL00220RI5=0.0148848162385562 ...
#> [["GPPPSYGGSSR"]] eAL00219RI5=-0.117374478914073 ...
#> [["IDATSASVLASR"]] eAL00219RI5=-0.145390183837019 ...
#> ...
#> <130 more elements>
scpModelEffects(leduc_minimal)
#> List of length 4
#> names(4): Channel Set MedianIntensity SampleType
dim(scpModelEffects(leduc_minimal)$Set)
#> [1] 140 73
dim(scpModelEffects(leduc_minimal, filtered = FALSE)$Set)
#> [1] 200 73
scpModelEffects(leduc_minimal, join = FALSE)[[1]]
#> NumericList of length 4
#> [["Channel"]] wAL00284RI5=-0.0371719605222012 ...
#> [["Set"]] wAL00284RI5=0.0994019567725992 ... wAL00286RI17=0.249998609880628
#> [["MedianIntensity"]] wAL00284RI5=0.119366566488542 ...
#> [["SampleType"]] wAL00284RI5=-0.382965748230049 ...
scpModelFilterThreshold(leduc_minimal)
#> [1] 1
####---- Setter ----####
scpModelFilterThreshold(leduc_minimal) <- 2
scpModelFilterThreshold(leduc_minimal)
#> [1] 2