Load data

Load summary table for the number of nuclei. Note that some samples are not included in this table, and those are the ones that contain no signal at all at the first pass of edge detection. The summary table contains three columns:

plate: labeled by the mix of individual cell lines
well: labels assigned by the JULI imaging system. These will be converted to correspond to C1 plate labels (rows and columns).
nnuclei: number of nuclei detected in a single cell sample

nuclei_table <- readRDS("/project2/gilad/joycehsiao/fucci-seq/output_tmp/nuclei_table.rds")

with(nuclei_table, table(nnuclei))
## nnuclei
##    0    1    2    3    4    5    6    7    8   12   20 
##    4 1264  141   53   21   14    2    2    2    1    1

Inspect samples with 12 nuclei.

nuclei_table[which(nuclei_table$nnuclei == 12),]
##         nnuclei  well       plate
## 0004811      12 00048 19160_18870

Inspect samples with 20 nuclei.

nuclei_table[which(nuclei_table$nnuclei == 20),]
##        nnuclei  well       plate
## 000636      20 00063 18870_19160

Printing images for inspection

This section is for record keeping. All images for samples with more than 1 nucleus detected have been converted to PNG format and stored in /project2/gilad/fucci-seq/images_inspect.

First select samples for inspection. The code below selects from plate 18511_18855 the samples that have two nuclei detected.

cases <- nuclei_table[which(nuclei_table$nnuclei == 2 & nuclei_table$plate == "18511_18855"),]

Extract the wells labels and convert to a character variable.

wells <- as.character(cases$well)

wells <- c("00012","00032","00044","00047","00051","00052","00067","00076","00085","00088","00096")

print(wells)
##  [1] "00012" "00032" "00044" "00047" "00051" "00052" "00067" "00076"
##  [9] "00085" "00088" "00096"

The code below will save images in png format at /project2/gilad/fucci-seq/images_inspect.

#' @param wells vector of wells ID (use the format specified above).
#' @param plate plate ID

print_png <- function(plate, wells) {
  for (index in 1:length(wells)) {
    id <- wells[index]
    dir_images_data_pl <- paste0("/project2/gilad/fucci-seq/images_curated/",plate,"/")
    dir_output <- "/project2/gilad/fucci-seq/images_inspect/"
    bright <- readImage(paste0(dir_images_data_pl, "BRIGHT/", id, ".TIFF"))
    dapi <- readImage(paste0(dir_images_data_pl, "DAPI/", id, ".TIFF"))
    gfp <- readImage(paste0(dir_images_data_pl, "GFP/", id, ".TIFF"))
    rfp <- readImage(paste0(dir_images_data_pl, "RFP/", id, ".TIFF"))
    
    writeImage(bright, paste0(dir_output, plate,".",id,".bright.png"))
    writeImage(dapi, paste0(dir_output, plate,".",id,".dapi.png"))
    writeImage(gfp, paste0(dir_output, plate,".",id,".gfp.png"))
    writeImage(rfp, paste0(dir_output, plate,".",id,".rfp.png"))
    # combo <- combine(dapi, bright, gfp, rfp)
    # writeImage(combo, paste0(dir_output, plate,".",id,".combo.png"))
  }
}


plates <- c("18511_18855","18855_19101","18855_19160","18870_18511",
            "18870_18855","18870_19101","18870_19160","19098_18511",
            "19098_18870","19098_19160","19101_18511","19101_19098",
            "19160_18870","18855_19098","19101_19160","19160_18511")

for (index in 1:length(plates)) {
  plate <- plates[index]
  cases <- nuclei_table[which(nuclei_table$nnuclei > 1 & nuclei_table$plate == plate),]
  wells <- as.character(cases$well)
  print_png(plate, wells) 
}

Session information

sessionInfo()
## R version 3.4.1 (2017-06-30)
## Platform: x86_64-redhat-linux-gnu (64-bit)
## Running under: Scientific Linux 7.2 (Nitrogen)
## 
## Matrix products: default
## BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] compiler_3.4.1  backports_1.1.1 magrittr_1.5    rprojroot_1.2  
##  [5] tools_3.4.1     htmltools_0.3.6 yaml_2.1.14     Rcpp_0.12.13   
##  [9] stringi_1.1.5   rmarkdown_1.6   knitr_1.17      stringr_1.2.0  
## [13] digest_0.6.12   evaluate_0.10.1

This R Markdown site was created with workflowr