makeNhoods {miloR}R Documentation

Define neighbourhoods on a graph (fast)

Description

This function randomly samples vertcies on a graph to define neighbourhoods. These are then refined by computing the median profile for the neighbourhood in reduced dimensional space and selecting the nearest vertex to this position. Thus, multiple neighbourhoods may be collapsed down together to prevent over-sampling the graph space.

Usage

makeNhoods(x, prop = 0.1, k = 21, d = 30, refined = TRUE, reduced_dims = "PCA")

Arguments

x

A Milo object with a non-empty graph slot. Alternatively an igraph object on which neighbourhoods will be defined.

prop

A double scalar that defines what proportion of graph vertices to randomly sample. Must be 0 < prop < 1.

k

An integer scalar - the same k used to construct the input graph.

d

The number of dimensions to use if the input is a matrix of cells X reduced dimensions.

refined

A logical scalar that determines the sampling behaviour, default=TRUE implements the refined sampling scheme.

reduced_dims

If x is an Milo object, a character indicating the name of the reducedDim slot in the Milo object to use as (default: 'PCA'). If x is an igraph object, a matrix of vertices X reduced dimensions.

Details

This function randomly samples graph vertices, then refines them to collapse down the number of neighbourhoods to be tested. The refinement behaviour can be turned off by setting refine=FALSE, however, we do not recommend this as neighbourhoods will contain a lot of redundancy and lead to an unncecessarily larger multiple-testing burden.

Value

A Milo object containing a list of vertices and the indices of vertices that constitute the neighbourhoods in the isIndex slot. If the input is a igraph object then the output is a list of vertices and the indices of vertices that constitute the neighbourhoods.

Author(s)

Emma Dann, Mike Morgan

Examples


require(igraph)
m <- matrix(rnorm(100000), ncol=100)
milo <- buildGraph(m, d=10)

milo <- makeNhoods(milo, prop=0.1)
milo


[Package miloR version 1.0.0 Index]