Please log in first.

Clear message

Using R to process Plate Data

R is good for reading, processing, and re-arranging data from 96 or 384 well plates. Often plate readers generate data which resembles the following:

Example Data from plate reader

[Plate: M 410  #1]
Time=00:00:00
;1;2;3;4;5;6;7;8;9;10;11;12
A;0.125;0.123;0.145;0.148;0.138;0.146;0.145;0.150;0.049;0.050;0.050;0.052
B;0.124;0.123;0.144;0.147;0.137;0.147;0.146;0.147;0.050;0.051;0.050;0.051
C;0.123;0.122;0.145;0.145;0.137;0.147;0.147;0.148;0.050;0.051;0.052;0.051
D;0.123;0.123;0.149;0.150;0.137;0.148;0.146;0.147;0.050;0.050;0.051;0.050
E;0.123;0.123;0.145;0.147;0.137;0.148;0.148;0.147;0.050;0.050;0.051;0.051
F;0.123;0.123;0.148;0.149;0.140;0.148;0.148;0.149;0.049;0.051;0.050;0.050
G;0.123;0.123;0.143;0.150;0.139;0.149;0.149;0.150;0.051;0.051;0.050;0.051
H;0.125;0.123;0.146;0.152;0.140;0.151;0.150;0.154;0.050;0.051;0.050;0.051

[Plate: M 410  #2]
Time=00:01:00
;1;2;3;4;5;6;7;8;9;10;11;12
A;0.125;0.123;0.174;0.176;0.154;0.174;0.173;0.178;0.050;0.050;0.050;0.052
B;0.124;0.123;0.172;0.174;0.153;0.173;0.172;0.176;0.051;0.051;0.050;0.052
C;0.124;0.123;0.174;0.171;0.151;0.172;0.172;0.176;0.050;0.051;0.052;0.051
[...] etc.

Data such as the above in a text file can be read into R using read.table(), and with some re-arrangement visualized with the prada library.

x <- read.table(file="410 clear.TXT", sep=";", fill=T)
# The first data line of eachplate is on the 4th line 
# and then re-occurs every 11 lines.
# Create an index vector to find the first data line
# of each plate.
iv <- seq(4,176,11)

# fix the data by converting all the plates to indivudal columns
d <- matrix(0,ncol=16, nrow=96)
cindex <- 1
for( i in iv ){
    column <- c()
    for(k in 0:7){
       column <- c(column, x[i + k, 2:13])
    }
    d[,cindex] <- as.numeric(column)
    cindex <- cindex + 1
}

# view the first column of data
library(prada)
plotPlate(d[,1], nrow=8, ncol=12, main="scan 1, t=0")

The code above reads in the text file from the plate reader, and converts each plate of data into a single column. The first column represents a reading of the entire plate at time t=0. To visualize the data, the first column of data is handed to plotPlate().

As described, the blocks of data in the original file are separated by 4 lines. I used seq() to create an index refrencing the starting row of each block of plate data, and then a loop to start at each of those positions and convert the plate data to a column in the final matrix d.


CategoryR