knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(tidyverse)

Lifecycle: maturing CRAN status

Read, ~~Validate~~, ~~Simulate~~ and ~~Write~~ GP1 instrument files

Installation

# install.packages("readgp1") # not yet
remotes::install_github("npjc/readgp1")

Example

Read the raw data into tidy tibble:

library(readgp1)
path <- gp1_example("gp1-example1.txt")
read_gp1(path)
read_gp1(path, all_fields = TRUE)

To visualize the parsed output with the mtpview pkg:

library(mtpview1)
library(ggplot2)
d <- read_gp1(path)

mtp_ggplot(d, aes(plate = plate, well = well)) + 
  mtp_spec_48well() + 
  geom_footprint() + 
  geom_notched_border() + 
  geom_row_label() + 
  geom_col_label()  +
  geom_well_rect(fill = 'white') + 
  geom_well_line(aes(x = runtime, y = measure)) + 
  facet_wrap(~plate, ncol = 1)

Or with vanilla ggplot2

library(tidyverse)
d %>%
    group_by(plate, well) %>%
    ggplot(aes(x = runtime, y = measure)) +
    geom_line(aes(color = plate, group = interaction(plate, well))) +
    geom_text(aes(x = 0, y = 3, label = well, group = well), alpha = 0.5,
              hjust = 'left', vjust = 'top', data = distinct(d, well)) +
    facet_wrap(~well, ncol = 8) +
    labs(x = 'time (elapsed, hours)', y = 'OD600 (raw, GP-1)',
         caption = paste0('source: ', basename(path))) +
    theme_minimal() +
    theme(panel.grid.minor = element_blank(),
          panel.grid.major = element_line(size = 0.1),
          strip.background = element_blank(),
          strip.text = element_blank(),
          panel.background = element_rect(fill = NULL, color = 'black'),
          plot.caption = element_text(family = 'mono', face = 'bold'))


npjc/readgp1 documentation built on Oct. 21, 2019, 4:58 p.m.