Functions producing a new vector (matrix) marker vector set from an existing matrix (vector) marker set.
Usage
mrkVecToMat(object, vfcol = "markers", mfcol = "Markers")
mrkMatToVec(object, mfcol = "Markers", vfcol = "markers")
mrkMatAndVec(object, vfcol = "markers", mfcol = "Markers")
showMrkMat(object, mfcol = "Markers")
isMrkMat(object, fcol = "Markers")
isMrkVec(object, fcol = "markers")
mrkEncoding(object, fcol = "markers")
Details
Sub-cellular markers can be encoded in two different ways. Sets of
spatial markers can be represented as character vectors
(character
or factor
, to be accurate), stored as
feature metadata, and proteins of unknown or uncertain
localisation (unlabelled, to be classified) are marked with the
"unknown"
character. While very handy, this encoding
suffers from some drawbacks, in particular the difficulty to label
proteins that reside in multiple (possible or actual)
localisations. The markers vector feature data is typically named
markers
. A new matrix encoding is also
supported. Each spatial compartment is defined in a column in a
binary markers matrix and the resident proteins are encoded with
1s. The markers matrix feature data is typically named
Markers
. If proteins are assigned unique localisations only
(i.e. no multi-localisation) or their localisation is unknown
(unlabelled), then both encodings are equivalent. When the markers
are encoded as vectors, features of unknown localisation are
defined as fData(object)[, fcol] == "unknown"
. For
matrix-encoded markers, unlabelled proteins are defined as
rowSums(fData(object)[, fcol]) == 0
.
The mrkMatToVec
and mrkVecToMat
functions enable the
conversion from matrix (vector) to vector (matrix). The
mrkMatAndVec
function generates the missing encoding from
the existing one. If the destination encoding already exists, or,
more accurately, if the feature variable of the destination
encoding exists, an error is thrown. During the conversion from
matrix to vector, if multiple possible label exists, they are
dropped, i.e. they are converted to "unknown"
. Function
isMrkVec
and isMrkMat
can be used to test if a
marker set is encoded as a vector or a matrix. mrkEncoding
returns either "vector"
or "matrix"
depending on the
nature of the markers.
See also
Other functions that operate on markers are
getMarkers
, getMarkerClasses
and
markerMSnSet
. To add markers to an existing
MSnSet
, see the addMarkers
function and
pRolocmarkers
, for a list of suggested markers.
Examples
library("pRolocdata")
data(dunkley2006)
dunk <- mrkVecToMat(dunkley2006)
head(fData(dunk)$Markers)
#> ER lumen ER membrane Golgi Mitochondrion PM Plastid Ribosome TGN
#> AT1G09210 1 0 0 0 0 0 0 0
#> AT1G21750 1 0 0 0 0 0 0 0
#> AT1G51760 1 0 0 0 0 0 0 0
#> AT1G56340 1 0 0 0 0 0 0 0
#> AT2G32920 1 0 0 0 0 0 0 0
#> AT2G47470 1 0 0 0 0 0 0 0
#> vacuole
#> AT1G09210 0
#> AT1G21750 0
#> AT1G51760 0
#> AT1G56340 0
#> AT2G32920 0
#> AT2G47470 0
fData(dunk)$markers <- NULL
dunk <- mrkMatToVec(dunk)
stopifnot(all.equal(fData(dunkley2006)$markers,
fData(dunk)$markers))