# Introduction

The package has been documented mostly with Axion multi-well MEA data, but it can work with any data. Here we show how data can be read in using a generic text reader, with a simple data format. To read in the data, we need two data files, and we need to provide information about the layout of the plate.

require(meaRtools)
## Loading required package: meaRtools
show_top_file <- function(file) {
}

# Data format

The text reader requires two text files to be prepared: one with the spike times and one with the channel positions.

## Spike times

A CSV file is used to store at least two columns: Channel containing the channel name, and Time containing the time (in seconds) at which a spike was detected on that channel. The rows of the CSV do not need to be ordered by channel, but the times for each channel should be ordered, earliest spike first.

## Channel positions

A second CSV contains the (x,y) spatial location each channel. If the recording is from a multi-well array, then an extra Well column determines the name of the well. (If no Well column is provided, the package assumes a plate with one well.)

## Plate information

The package by default has information about just two plates, the Axion 12 and 48 well systems. As shown in the examples below, in addition we need to provide information regarding the plate. If any information is missing, the system will revert to defaults.

## Example 1: a single-well MEA recording

Here there is just a single MEA recording, from a hexagonal MEA (Wong et al., 1993). As there is only one well, the Well information is absent from the position file. The data files are provided within the package, and the top of each file looks as follows:

times = system.file("extdata/textreader/wong1993_p0.times", package="meaRtools")
show_top_file(times)
Channel,Time
c1,14.51755
c1,14.56795
c1,78.75835
c1,78.7723
c1,78.7951
c1,78.80975
c1,78.83945
c1,78.86245
c1,78.90175
show_top_file(pos)
"Channel","x","y"
"c1",70,-242.48
"c2",0,-242.48
"c3",0,-242.48
"c4",-140,-242.48
"c5",175,-181.86
"c6",175,-181.86
"c7",105,-181.86
"c8",-35,-181.86
"c9",-35,-181.86
hex_platelayout = list(n_well = 1, #number of wells
wells = c("w1"), #names of those wells.
n_well_r = 1, # number of wells / row
n_well_c = 1, # number of wells / col
layout = c(1, 1), # layout when plotting
n_elec_r = 8,
n_elec_c = 8,
xlim = c(-400, 400), # xlimits for plotting
ylim = c(-400, 400), # ylimits for plotting
spacing = 50,  # distance (um) separating electrodes
corr_breaks = 0 # vector of correlation distances
)

add_plateinfo("hex-1well", hex_platelayout)
## [1] "Axion 48 well" "Axion 12 well" "hex-1well"
s = read_spikelist_text(times, pos, array="hex-1well")

# References

The test data come from the following two references:

Demas J, Eglen SJ, Wong ROL (2003) Developmental loss of synchronous spontaneous activity in the mouse retina is independent of visual experience. Journal of Neuroscience 23:2851–2860 Available at: https://www.ncbi.nlm.nih.gov/pubmed/12684472.

Wong RO, Meister M, Shatz CJ (1993) Transient period of correlated bursting activity during development of the mammalian retina. Neuron 11:923–938 http://dx.doi.org/10.1016/0896-6273(93)90122-8.