generateNeighbours {beadarray} | R Documentation

## Generate matrix of neighbouring beads

### Description

Generates a neighbours matrix from either a .locs file or the X and Y coordinates in a `beadLevelData` object.

### Usage

    generateNeighbours(BLData, array = 1, useLocs = TRUE, window = 30, margin = 10, thresh = 2.2)

### Arguments

`BLData` | An object of class `beadLevelData-class`
`array` | integer specifying which section/array to process
`useLocs` | logical value, specifiying whether the .locs file (if present) should be used to determine neighbours.
`window` | numeric value, specifying window size (see below)
`margin` | numeric value, specifying size of window margin (see below)
`thresh` | numeric value, which determines how large links are removed. (see below)

### Details

generateNeighbours determines, for each bead on the array, which beads are next to it. It assumes that the beads are in a hexagonal lattice.

If the `.locs` file is present and `useLocs = TRUE` then the ordering of the `.locs` file is used to infere the grid layout. This is far quicker than the alternative and is thus recommended, but can only be used on BeadChip platforms. If the data is from a Sentrix Array `useLocs` is automatically set to `FALSE` and the following algorithm is applied instead.

The algorithm used first links each bead to its 6 closest neighbours. It then removes the longest link if its squared length is more than `thresh` multiplied by the squared length of the next longest link. A similar process is applied to the 2nd and 3rd longest links.

Finally, any one way links are removed (i.e. a link between two beads is only preserved if each bead considers the other to be its neighbour).

To ease computation, the algorithm only computes neighbours of beads in a square window of side length `2*(window)` which travels across the array. Beads in a margin around the square, of width `(margin)`, are also considered as possible neighbours.

### Value

A matrix with 6 columns. Each row corresponds to a bead in the passed `beadLevelData-class` and the six entries are the indices of the 6 neighbouring beads. Values of NA indicate that the neighbouring bead appears to be missing, either due to failing Illumina's decoding or being at the edge of the array.

### Author(s)

Jonathan Cairns, Mike Smith

### References

Lynch AG, Smith ML, Dunning MJ, Cairns JM, Barbosa-Morais NL, Tavare S. beadarray, BASH and HULK - tools to increase the value of Illumina BeadArray experiments. In A. Gusnato, K.V. Mardia, & C.J. Fallaize (eds), Statistical Tools for Challenges in Bioinformatics. 2009 pp. 33-37. Leeds, Leeds University Press.

### See Also

`HULK`, `BASH`

### Examples

    ## Not run:
    if(require(beadarrayExampleData)){

    data(exampleBLData);
    neighbours <- generateNeighbours(exampleBLData, array = 1, useLocs = FALSE);
    }

    ## End(Not run)

[Package beadarray version 2.34.0 Index]