View cell images

Shantanu SIngh

2016-09-20

library(cytoplot)
library(dplyr)
library(magrittr)

The minimal set of columns are:

ljosa2013 %>%
  slice(1:5) %>%
  select(Metadata_Plate, Metadata_Well, Metadata_Site, Metadata_pert_id, 
         matches("URL")) %>%
  knitr::kable()
Metadata_Plate Metadata_Well Metadata_Site Metadata_pert_id URL_DAPI URL_Tubulin URL_Actin
Week1_22123 B04 3 cytochalasin_b_10 https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s3_w135D66B4C-0548-4AB8-A57B-9CC39666813B.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s3_w2D81AEFB9-9DD4-4B59-9177-2093F0815C94.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s3_w408BE006A-BF34-457E-81A9-FAB019FE8996.tif
Week1_22123 B04 4 cytochalasin_b_10 https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s4_w1EB720AD1-83BA-48A7-8C47-73A4F7EC5F1A.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s4_w261B79A05-7534-46F3-8C80-D67A89A3A125.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s4_w49FF7E7B1-F049-4994-BCA2-ABE5D4A3C761.tif
Week1_22123 B04 1 cytochalasin_b_10 https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s1_w11323931B-BDA7-4F42-870E-7174BFBF3643.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s1_w2F8F7EA7A-EC57-49CA-A556-22AE0E990BF1.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s1_w494DCA5C4-3531-497D-A8B0-D53AA25DB02B.tif
Week1_22123 B04 2 cytochalasin_b_10 https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s2_w1F649C703-6FA8-406F-8575-CBEAC160B4BD.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s2_w2802CC81E-56F9-41C5-A6C2-E5A0F233ED3B.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22123/Week1_150607_B04_s2_w4342F300D-60F8-4256-A637-F1367E14BE5E.tif
Week1_22141 B04 3 cytochalasin_b_10 https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22141/Week1_150607_B04_s3_w1B0B8AAC7-F2AD-4756-939C-6151431D5637.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22141/Week1_150607_B04_s3_w25C7FD77E-FDC4-471F-A512-6018D98F1D6A.tif https://s3.amazonaws.com/imaging-platform/projects/dp_treatment-classification_az/workspace/images/Week1/Week1_22141/Week1_150607_B04_s3_w42BD03411-D32F-4179-A6C5-C4D27E937A93.tif

Compute robust maximum intensity per channel to normalize the intensities (otherwise the images appear too dim).

# B02 is DMSO
max_intensity <- 
ljosa2013 %>%
  filter(Metadata_Plate %in% c("Week1_22123", 
                               "Week1_22141", 
                               "Week1_22161") & 
           Metadata_Well == "B02") %>%
  group_by(Metadata_Plate) %>%
  arrange(Metadata_Well, Metadata_Site) %>%
  slice(1:4) %>%
  ungroup() %>% 
  sample_max_intensity()

Select images from a single well

df <-
ljosa2013 %>%
  filter(Metadata_Plate == "Week1_22123" & 
           Metadata_Well %in% c("B03", "B04"))

df %>% 
  select(Metadata_Plate, Metadata_Well, Metadata_Site, 
         Metadata_Compound, Metadata_Concentration) %>%
  arrange(Metadata_Plate, Metadata_Well, Metadata_Site) %>%
  knitr::kable()
Metadata_Plate Metadata_Well Metadata_Site Metadata_Compound Metadata_Concentration
Week1_22123 B03 1 cytochalasin B 30
Week1_22123 B03 2 cytochalasin B 30
Week1_22123 B03 3 cytochalasin B 30
Week1_22123 B03 4 cytochalasin B 30
Week1_22123 B04 1 cytochalasin B 10
Week1_22123 B04 2 cytochalasin B 10
Week1_22123 B04 3 cytochalasin B 10
Week1_22123 B04 4 cytochalasin B 10

Save image montage per well

images <- 
  df %>%
  save_images(per_row = 2, max_intensity = max_intensity)

View one of the montages:

print(images$Week1_22123_B03)
## $Actin
## [1] "./cytochalasin_b_30_Week1_22123_B03_Actin.jpg"
## 
## $DAPI
## [1] "./cytochalasin_b_30_Week1_22123_B03_DAPI.jpg"
## 
## $Tubulin
## [1] "./cytochalasin_b_30_Week1_22123_B03_Tubulin.jpg"
EBImage::rgbImage(
  images$Week1_22123_B03$Actin %>% EBImage::readImage(),
  images$Week1_22123_B03$Tubulin %>% EBImage::readImage(),
  images$Week1_22123_B03$DAPI %>% EBImage::readImage()) %>%
  EBImage::display()