knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(rSeahorse)
library(tidyverse)

Description:

Work flow

1. Import data

file <-  system.file("extdata", "XFAssay.xls", package="rSeahorse" ) 
layout <- system.file("extdata", "layout.csv", package="rSeahorse" ) 

group_info <- rSeahorse::convert_layout_to_long(layout)
knitr::kable(group_info)


group_info$Group <- dplyr::recode_factor(group_info$Group,
                     Fresh = "Fresh",
                     TCP = "TCP",
                     BM_ECM = "BM-ECM",
                     ECMplus = "ECMplus")

rsh <- import_seahorse(file = file, group_info = group_info)



for (i in seq_along(rsh)) {
  print(knitr::kable(head(rsh[[i]]), caption = names(rsh)[i]))
}

2. Quick View and exclude wells

qview_seahorse(rsh$data_min, rsh$well_label)
wells_exclude <- c("6", "11", "15", "18", "20", "23")

3. Plot the main figure

plot_seahorse(data_min = rsh$data_min,
              wells_exclude = wells_exclude,
              event_label = rsh$event_label,
              group_info = group_info,
              size_group = 6)

4. Calculate OCR subtype

bin_list <- make_time_bin(rsh$event_label)


p <- calculate_OCR_subtype(data_min = rsh$data_min,
                      bin_list = bin_list, 
                      return_type = "plot")
p

p + ggtitle("OCR subtype") +
  ggplot2::theme(axis.text.x = element_text(angle = 45, vjust = .5, hjust = .5))

calculate_OCR_subtype(data_min = rsh$data_min,
                      bin_list = bin_list, 
                      return_type = "df")


whzemuch/rSeahorse documentation built on Jan. 12, 2022, 3:31 a.m.