generateNeighbours {beadarray} | R Documentation |
Generates a Neighbours matrix from the X and Y co-ordinates in a BeadLevelList
object.
generateNeighbours(BLData, array, window = 30, margin = 10, thresh = 2.2)
BLData |
BeadLevelList |
array |
integer specifying which strip/array to plot |
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) |
generateNeighbours determines, for each bead on the array, which beads are next to it. It assumes that the beads are in a hexagonal lattice.
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.
The Neighbours matrix is designed for use with the BASH functions.
A matrix with 6 columns, and a number of rows equal to the number of beads on the array. The neighbours of bead i are found in row i. 0 denotes a deleted link. (For example, if row 15 consists of 20, 35, 0, 0, 60, 4, then bead 15 is considered a neighbour of beads 4, 20, 35 and 60.)
Jonathan Cairns
data(BLData) neighbours <- generateNeighbours(BLData, 1)