getIndex.Layout: Gets the index of a spot given its location

Description Usage Author(s) See Also Examples

Description

Gets the index of a spot given its location. The location can either be a vector containing the grid row and the grid column and the spot row and the spot column in that grid, or it can be the same fields as seperate arguments.

Usage

1
2
## S3 method for class 'Layout'
getIndex(this, gridRow, gridColumn=NULL, spotRow=NULL, spotColumn=NULL, ...)

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

This method corresponds to image2id (see id2image) in the sma package. For more information see Layout.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  # Example 1
  layout <- Layout(4,4, 18,18)
  idx <- getIndex(layout, 2, 3, 4, 3)     # 2001
  idx <- getIndex(layout, c(2, 3, 4, 3))  # 2001 (equivalent)
  loc <- getLocation(layout, idx)         # 2 3 4 3

  # Example 2
  SMA$loadData(c("mouse.data", "mouse.setup"))
  raw <- RawData(mouse.data, layout=as.Layout(mouse.setup))
  ma <- getSignal(raw)
  layout <- getLayout(ma)

  plotSpatial(ma)

  # Highlights spot number 2462
  idx <- 2462
  highlight(ma, idx, col="purple")

  # Highlights the spot at grid (2,3) and its spot (4,3)
  idx <- getIndex(layout, 2, 3, 4, 3);  # Spot #2460
  highlight(ma, idx, col="purple")

  # Highlights all spots in grid (1,2)
  idx <- getIndices(layout, 1,2, NULL,NULL)
  highlight(ma, idx, col="purple")

HenrikBengtsson/aroma documentation built on May 7, 2019, 12:56 a.m.