Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ENH: Create control well filelist to optimize CellProfiler pipeline
  • Loading branch information
pan14001 committed Feb 21, 2017
1 parent d5f9931 commit 1c9c81a
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/filelist-controls.R
@@ -0,0 +1,67 @@
suppressPackageStartupMessages({
library(tidyverse)
library(magrittr)
library(readxl)
library(stringr)
library(methods) # For Rscript per http://stackoverflow.com/a/41797025
})

## Configuration values.
files_plate <- "../data/DRSC_TF_Library_Distribution.xls"
path_images <- "../results/z_projection"
file_filelist <- "../results/cellprofiler/2017-02-20/filelist"

## Plate 504 was run at the last minute, and so the controls are not
## reflected in the Excel spreadsheet provided by the core facility.
## Therefore below is the list of added wells, which we will later
## merge with the spreadsheet data:
wells_control <- tibble::tribble(
~well, ~symbol,
##---|------
"I04", "BROWN",
"E09", "CAL1",
"L03", "FACT",
"E16", "Rho1",
"L16", "Thread",
"H21", "water") %>%
bind_rows(tibble(
symbol = "LacZ",
well = c("C03", "C22", "D12", "D13", "E05", "E20", "F11",
"F14", "G07", "G18", "H09", "H16", "I09", "I16",
"J07", "J18", "K11", "K14", "L05", "L20", "M12",
"M13", "N03", "N22"))) %>%
rename(symbol_control = symbol) %>% # Prepare for join.
arrange(well)
## FIXME: Need to confirm what type of control Thread is.
wells_layout <-
read_excel(files_plate, sheet = 3) %>%
setNames(tolower(names(.))) %>%
select(plate, well, `symbol(s)`, `fbgn(s)`, amplicon) %>%
rename(symbol = `symbol(s)`,
fbgn = `fbgn(s)`) %>% arrange(plate, well)
wells_layout %<>%
left_join(wells_control) %>%
mutate(symbol = ifelse(is.na(symbol_control), symbol, symbol_control)) %>%
select(-symbol_control) %>%
mutate(control = ifelse(
symbol %in% c("CAL1", "FACT", "Rho1"), ## Rho1 gives binucleates
"positive", NA)) %>%
mutate(control = ifelse(
symbol %in% c("LacZ", "Empty", "BROWN", "water"),
"negative", control)) %>%
mutate(control = ifelse(
is.na(control) & is.na(amplicon),
"unknown", control))

## List all controls
wells_control <- wells_layout %>%
filter(!is.na(control)) %>%
mutate(plate = ifelse(plate == "504", "160415_015529-V", plate)) %>%
mutate(file_glob = paste0(plate, "*_", well, "_*"))

## Glob for files
filelist <- Sys.glob(file.path(normalizePath(path_images),
wells_control$file_glob))

## Save the list
writeLines(filelist, file_filelist)

0 comments on commit 1c9c81a

Please sign in to comment.