knitr::opts_chunk$set(comment = NA,
  fig.path = '04_figures_aim3_out/',
  fig.width = 20,
  fig.height = 12,
  results = 'markup',
  tidy = F,
  message = F,
  warning = F,
  echo = F)
alpha <- 0.05

r packages


setwd('~/Documents/git/chmitools') # mac
source('~/Documents/git/myR_setup/myR.profile') # mac
# source('~/git/myR_setup/myR.profile') # home

load data

Main bullet points in load data section. chmi.phen() load data by group and aim. filter data by isotype_igg, antigen and t_point/t2_point columns. * split data by gr_hbs different to naive group.

# load data
dat <- chmi.phen(group = 'mfi', aim_chmi = 'aim_3') %>% filter(gr_hbs != 'naive')

# list
  n_igg <- sort(unique(dat$isotype_igg))

differences in mfi vs gr_hbs and t2_point after/before challenge

Main bullet points in load data section. chmi.stat.oneway_test() obtain raw and adjusted p-values. we are used p.adjust() function to adjust p-values by Benjamini & Hochberg method. tab_1 or before challenge all: filtered by t_point C-1. tab_2 or after challenge within 3 t_point: filtered by t2_point D7, D13 & D28. * tab_3 or after challenge within 4 t_point: filtered by t2_point C-1, D7, D13 & D28.

# list
  l_vars1 <- c('isotype_igg', 'antigen')
  l_vars2 <- c('isotype_igg', 'antigen', 't2_point')

# filer data by 't_point' & 't2_point'
  dat_1 <- dat %>% filter(t2_point == 'C-1')
  dat_2 <- dat %>% filter(t2_point %in% c('D7', 'D13', 'D28'))
  dat_3 <- dat %>% filter(t2_point %in% c('C-1', 'D7', 'D13', 'D28'))

# p_value tab_1
  tab_1 <- chmi.stat.oneway_test(dat_1, group_by = l_vars1, test_var = 'gr_hbs')

# p_value tab_2
  tab_2 <- chmi.stat.oneway_test(dat_2, group_by = l_vars2, test_var = 'gr_hbs')

# p_value tab_3
  tab_3 <- chmi.stat.oneway_test(dat_3, group_by = l_vars2, test_var = 'gr_hbs')


# datatable `tab_1`
  datatable(tab_1, class = 'cell-border stripe',
    extensions = 'Buttons',
    options = list(dom = 'Bfrtip', buttons = c('csv', 'pdf'), text = 'Download')) %>%
  formatSignif(c('raw_pval', 'adjust_pval'), 3)

# datatable `tab_2`
  datatable(tab_2, class = 'cell-border stripe',
    extensions = 'Buttons',
    options = list(dom = 'Bfrtip', buttons = c('csv', 'pdf'), text = 'Download')) %>%
  formatSignif(c('raw_pval', 'adjust_pval'), 3)

# datatable `tab_3`
  datatable(tab_3, class = 'cell-border stripe',
    extensions = 'Buttons',
    options = list(dom = 'Bfrtip', buttons = c('csv', 'pdf'), text = 'Download')) %>%
  formatSignif(c('raw_pval', 'adjust_pval'), 3)

boxplot mfi vs gr_hbs after/before challenge

by t_point = C-1

# plots
  boxplot_1 <- chmi.stat_plot.pval_boxplot(dat_1, tab_1,
    l_igg = n_igg, aes_var = 'gr_hbs', aes_color = 'gr_hbs')

# print
  print(boxplot_1)

by t2_point = c(D7, D13, D28)

# plots
  boxplot_2 <- chmi.stat_plot.pval_boxplot(dat_2, tab_2,
    l_igg = n_igg, aes_var = 't2_point', aes_color = 'gr_hbs')

# print
  print(boxplot_2)

by t2_point = c('C-1', 'D7', 'D13', 'D28')

# plots
  boxplot_3 <- chmi.stat_plot.pval_boxplot(dat_3, tab_3,
    l_igg = n_igg, aes_var = 't2_point', aes_color = 'gr_hbs')

# print
  print(boxplot_3)

line_plot mfi vs gr_hbs after/before challenge

by t2_point = c(D7, D13, D28)

# plots
  lineplot_1 <- chmi.stat_plot.median_line(dat_2, n_igg)

# print
  print(lineplot_1)

by t2_point = c('C-1', 'D7', 'D13', 'D19', 'D28')

# plots
  lineplot_2 <- chmi.stat_plot.median_line(dat_3, n_igg)

# print
  print(lineplot_2)

problems to be solve in aim_3

Main problems appear in some plot sections. chmi.stat_plot.pval_boxplot() did not shown the p_values centered. chmi.stat_plot.median_line() did not shown the same original format.

save in r_data folder

# save
 save.image(file = '/Users/migvazquez/Documents/git/chmitools/projects/01_aim1/r_data/01_aim3_out.RData')


mvazquezs/chmitools documentation built on May 1, 2020, 2:06 a.m.