The `logPosteriors` function can be used to extract the log-posteriors at each iteration of the EM algorithm to check for convergence.
Source:R/machinelearning-framework-map.R
, R/machinelearning-functions-tagm-map.R
tagm-map.Rd
These functions implement the T augmented Gaussian mixture (TAGM) model for mass spectrometry-based spatial proteomics datasets using the maximum a posteriori (MAP) optimisation routine.
Usage
# S4 method for class 'MAPParams'
show(object)
logPosteriors(x)
tagmMapTrain(
object,
fcol = "markers",
method = "MAP",
numIter = 100,
mu0 = NULL,
lambda0 = 0.01,
nu0 = NULL,
S0 = NULL,
beta0 = NULL,
u = 2,
v = 10,
seed = NULL
)
tagmMapPredict(
object,
params,
fcol = "markers",
probJoint = FALSE,
probOutlier = TRUE
)
Arguments
- object
An
MSnbase::MSnSet
containing the spatial proteomics data to be passed totagmMapTrain
andtagmPredict
.- x
An object of class `MAPParams`.
- fcol
The feature meta-data containing marker definitions. Default is
markers
.- method
A
charachter()
describing the inference method for the TAGM algorithm. Default is"MAP"
.- numIter
The number of iterations of the expectation-maximisation algorithm. Default is 100.
- mu0
The prior mean. Default is
colMeans
of the expression data.- lambda0
The prior shrinkage. Default is 0.01.
- nu0
The prior degreed of freedom. Default is
ncol(exprs(object)) + 2
- S0
The prior inverse-wishary scale matrix. Empirical prior used by default.
- beta0
The prior Dirichlet distribution concentration. Default is 1 for each class.
- u
The prior shape parameter for Beta(u, v). Default is 2
- v
The prior shape parameter for Beta(u, v). Default is 10.
- seed
The optional random number generator seed.
- params
An instance of class
MAPParams
, as generated bytagmMapTrain()
.- probJoint
A
logical(1)
indicating whether to return the joint probability matrix, i.e. the probability for all classes as a newtagm.map.joint
feature variable.- probOutlier
A
logical(1)
indicating whether to return the probability of being an outlier as a newtagm.map.outlier
feature variable. A high value indicates that the protein is unlikely to belong to any annotated class (and is hence considered an outlier).
Value
tagmMapTrain
returns an instance of class MAPParams()
.
tagmPredict
returns an instance of class
MSnbase::MSnSet
containing the localisation predictions as
a new tagm.map.allocation
feature variable.
Details
The tagmMapTrain
function generates the MAP parameters (object or class
MAPParams
) based on an annotated quantitative spatial proteomics dataset
(object of class MSnbase::MSnSet
). Both are then passed to the
tagmPredict
function to predict the sub-cellular localisation of protein
of unknown localisation. See the pRoloc-bayesian vignette for details and
examples. In this implementation, if numerical instability is detected in
the covariance matrix of the data a small multiple of the identity is
added. A message is printed if this conditioning step is performed.
Slots
method
A
character()
storing the TAGM method name.priors
A
list()
with the priors for the parametersseed
An
integer()
with the random number generation seed.posteriors
A
list()
with the updated posterior parameters and log-posterior of the model.datasize
A
list()
with details about size of data
References
A Bayesian Mixture Modelling Approach For Spatial Proteomics Oliver M Crook, Claire M Mulvey, Paul D. W. Kirk, Kathryn S Lilley, Laurent Gatto bioRxiv 282269; doi: https://doi.org/10.1101/282269
See also
The plotEllipse()
function can be used to visualise
TAGM models on PCA plots with ellipses. The tagmMapTrain()
function to use the TAGM MAP method.