addMarkers {pRoloc} | R Documentation

## Adds markers to the data

### Description

The function adds a 'markers' feature variable. These markers are read from a comma separated values (csv) spreadsheet file. This markers file is expected to have 2 columns (others are ignored) where the first is the name of the marker features and the second the group label. Alternatively, a markers named vector as provided by the `pRolocmarkers` function can also be used.

### Usage

    addMarkers(object, markers, mcol = "markers", fcol, verbose = TRUE)

### Arguments

`object` | An instance of class `MSnSet`.
`markers` | A `character` with the name the markers' csv file or a named character of markers as provided by `pRolocmarkers`.
`mcol` | A `character` of length 1 defining the feature variable label for the newly added markers. Default is `"markers"`.
`fcol` | An optional feature variable to be used to match against the markers. If missing, the feature names are used.
`verbose` | A `logical` indicating if number of markers and marker table should be printed to the console.

### Details

It is essential to assure that `featureNames(object)` (or `fcol`, see below) and marker names (first column) match, i.e. the same feature identifiers and case fold are used.

### Value

A new instance of class `MSnSet` with an additional `markers` feature variable.

### Author(s)

Laurent Gatto

### See Also

See `pRolocmarkers` for a list of spatial markers and `markers` for details about markers encoding.

### Examples

    library("pRolocdata")
    data(dunkley2006)
    atha <- pRolocmarkers("atha")
    try(addMarkers(dunkley2006, atha)) ## markers already exists
    fData(dunkley2006)$markers.org <- fData(dunkley2006)$markers
    fData(dunkley2006)$markers <- NULL
    marked <- addMarkers(dunkley2006, atha)
    fvarLabels(marked)
    ## if 'makers' already exists
    marked <- addMarkers(marked, atha, mcol = "markers2")
    fvarLabels(marked)
    stopifnot(all.equal(fData(marked)$markers, fData(marked)$markers2))
    plot2D(marked)
    addLegend(marked, where = "topleft", cex = .7)

[Package pRoloc version 1.24.1 Index]