Using the image YDA306_AGA1y_PRM1r_Mating from IDR to model the replication of yeast cells.
library(romero.gateway) library(EBImage)
server <- OMEROServer(host = 'wss://idr.openmicroscopy.org/omero-ws', port = 443L, username='public', password='public') server <- connect(server) paste('Successfully logged in as', server@user$getUserName())
imageId <- 3491334 image <- loadObject(server, "ImageData", imageId)
(this information could be retrieved from the server too, but lets keep it simple)
tmax <- 42 # number of timepoints tInMinutes <- 5 # separation between timepoints in minutes
t <- as.integer(tmax / 2) # use half-time point pixels <- getPixelValues(image, 1, t, 2) ebi <- EBImage::Image(data = pixels, colormode = 'Grayscale') img <- normalize(ebi) EBImage::display(img)
threshImg <- thresh(img, w=20, h=20, offset=0.05) threshImg <- medianFilter(threshImg, 3) threshImg <- fillHull(threshImg) threshImg <- bwlabel(threshImg) EBImage::display(colorLabels(threshImg))
count <- range(threshImg) count[2]
countCells <- function (t) { pixels <- getPixelValues(image, 1, t, 2) ebi <- EBImage::Image(data = pixels, colormode = 'Grayscale') img <- normalize(ebi) threshImg <- thresh(img, w=20, h=20, offset=0.05) threshImg <- medianFilter(threshImg, 3) threshImg <- fillHull(threshImg) threshImg <- bwlabel(threshImg) count <- range(threshImg) as.integer(count[2]) }
#timepoints <- (1:tmax) # analyze every time point timepoints <- seq(1,tmax,4) # only use every fourth time point (faster) df <- data.frame(TimePoint=timepoints) df$CellCount <- sapply(df$TimePoint, countCells) df$TimePoint <- sapply(df$TimePoint, function(x) x * tInMinutes) df
plot(df$TimePoint, df$CellCount, ylab = "Number of cells", xlab = "Time (in min)")
model <- lm(log(df$CellCount)~ df$TimePoint) print(summary(model))
This gives us a model for the number of yeast cells N at time point t (in min): $N = e^{4.72710 + 0.00374 * t}$ .
plotTime <- as.list(df[,1]) predCounts <- exp(predict(model,plotTime)) plot(df$TimePoint, df$CellCount, ylab = "Number of cells", xlab = "Time (in min)") lines(plotTime, predCounts,lwd=2, col = "red")
disconnect(server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.