Milo-methods {miloR} | R Documentation

## Get and set methods for Milo objects

### Description

Get and set methods for Milo object slots. Generally speaking these methods are used internally, but they allow the user to assign their own externally computed values - should be used with caution.

### Getters

In the following descriptions `x` is always a Milo object.

`graph(x)`:

  Returns an `igraph` object representation of the KNN-graph, with number of vertices equal to the number of single-cells.

`nhoodDistances(x)`:

  Returns a list of sparse matrix of cell-to-cell distances between nearest neighbours, one list entry per neighbourhood. Largely used internally for computing the k-distance weighting in `graphSpatialFDR`.

`nhoodCounts(x)`:

  Returns a NxM sparse matrix of cell counts in each of `N` neighbourhoods with respect to the `M` experimental samples defined.

`nhoodExpression(x)`:

  Returns a GxN matrix of gene expression values.

`nhoodIndex(x)`:

  Returns a list of the single-cells that are the neighbourhood indices.

`nhoodReducedDim(x)`:

  Returns an NxP matrix of reduced dimension positions. Either generated by `projectNhoodExpression(x)` or by providing an NxP matrix (see setter method below).

`nhoods(x)`:

  Returns a sparse matrix of `CxN` mapping of `C` single-cells to`N` neighbourhoods.

`nhoodGraph(x)`:

  Returns an `igraph` object representation of the graph of neighbourhoods, with number of vertices equal to the number of neighbourhoods.

`nhoodAdjacency(x)`:

  Returns a matrix of `N` by `N` neighbourhoods with entries of 1 where neighbourhods share cells, and 0 elsewhere.

### Setters

In the following descriptions `x` is always a Milo object.

`graph(x) <- value`:

  Populates the graph slot with `value` - this should be a valid graph representation in either `igraph` or `list` format.

`nhoodDistances(x) <- value`:

  Replaces the internally comptued neighbourhood distances. This is normally computed internally during graph building, but can be defined externally. Must be a list with one entry per neighbourhood containing the cell-to-cell distances for the cells within that neighbourhood.

`nhoodCounts(x) <- value`:

  Replaces the neighbourhood counts matrix. This is normally computed and assigned by `countCells`, however, it can also be user-defined.

`nhoodExpression(x) <- value`:

  Replaces the `nhoodExpression` slot. This is calculated internally by `calcNhoodExpression`, which calculates the `mean` expression. An alternative summary function can be used to assign an alternative in this way.

`nhoodIndex(x) <- value`:

  Replaces the list of neighbourhood indices. This is provided purely for completeness, and is usually only set internally in `makeNhoods`.

`nhoodReducedDim(x) <- value`:

  Replaces the reduced dimensional representation or projection of neighbourhoods. This can be useful for externally computed projections or representations.

`nhoods(x) <- value`:

  Replaces the neighbourhood matrix. Generally use of this function is discouraged, however, it may be useful for users to define their own bespoke neighbourhoods by some means.

`nhoodGraph(x) <- value`:

  Populates the nhoodGraph slot with `value` - this should be a valid graph representation in either `igraph` or `list` format.

`nhoodAdjacency(x) <- value`:

  Populates the nhoodAdjacency slot with `value` - this should be a `N` by `N` matrix with elements denoting which neighbourhoods share cells

### Miscellaneous

A collection of non-getter and setter methods that operate on Milo objects.

`show(x)`:

  Prints information to the console regarding the `Milo` object.

### Author(s)

Mike Morgan

### Examples

    example(Milo, echo=FALSE)
    show(milo)

[Package miloR version 1.2.0 Index]