Created
July 23, 2019 16:55
-
-
Save npjc/0baa553d929a576423101821e4f267a7 to your computer and use it in GitHub Desktop.
Quick and Dirty Example of Converting CG12 formatted data into Precog formatted data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert cg-12 raw data into generic growth data that can be imported into | |
# precog-lite | |
library(tidyverse) | |
library(lubridate) | |
# devtools::install_github("npjc/cg12r") | |
library(cg12r) | |
# how do you take raw data from the cg-12 and turn it into growth curves | |
path <- "2018-04-19_800drugscreen_plate-1-of-11_BY4743=replica-plates-1-4-7-10_YPS128=replica-plates-2-5-8-11_YPS138=replica-plate-3-6-9-12.txt" | |
l <- read_cg12(path) %>% bind_rows() | |
slim <- l %>% | |
mutate(datetime = ymd_hms(paste(date, time), tz= "Canada/Pacific")) %>% | |
select(-instrument_header, -wavelength, -date, -time) | |
out <- slim %>% | |
group_by(plate) %>% | |
mutate(secs = as.numeric(datetime), | |
min_secs = min(secs), | |
t_since_start = secs - min_secs, | |
time = as.integer(t_since_start * 10)) %>% | |
select(-datetime, -secs, -min_secs, -t_since_start) %>% | |
ungroup() %>% | |
unite(sample, plate, plate_row_int, plate_col_int) | |
out %>% | |
select(time, sample, measurment) %>% | |
filter(str_detect(sample, "S1L1")) %>% | |
spread(sample, measurment) %>% | |
write_tsv("sample-precog-input.txt") | |
out %>% | |
select(time, sample, measurment) %>% | |
filter(str_detect(sample, "S1L2")) %>% | |
spread(sample, measurment) %>% | |
write_tsv("sample-precog-input2.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment