checked and tidy up scripts for plots for non-severe
This commit is contained in:
parent
f2b778ace7
commit
dde2cc9494
3 changed files with 63 additions and 64 deletions
|
@ -1,60 +0,0 @@
|
||||||
#!/usr/bin/Rscript
|
|
||||||
getwd()
|
|
||||||
setwd("~/git/mosaic_2020/")
|
|
||||||
getwd()
|
|
||||||
############################################################
|
|
||||||
# TASK: boxplots at T1
|
|
||||||
# FIXME: currently not rendering, problem with NAs for stats?
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
#=============
|
|
||||||
# Input
|
|
||||||
#=============
|
|
||||||
source("data_extraction_formatting_non_asthmatics.R")
|
|
||||||
|
|
||||||
# check: adult variable and age variable discrepancy!
|
|
||||||
metadata_all$mosaic[metadata_all$adult==1 & metadata_all$age<=18]
|
|
||||||
|
|
||||||
#===============================
|
|
||||||
# data assignment for plots
|
|
||||||
#================================
|
|
||||||
#-----------
|
|
||||||
# npa
|
|
||||||
#-----------
|
|
||||||
wf_fp_npa = npa_wf[npa_wf$flustat == 1,]
|
|
||||||
lf_fp_npa = npa_lf[npa_lf$flustat == 1,]
|
|
||||||
lf_fp_npa$timepoint = paste0("t", lf_fp_npa$timepoint)
|
|
||||||
lf_fp_npa$timepoint = as.factor(lf_fp_npa$timepoint)
|
|
||||||
lf_fp_npa$obesity = as.factor(lf_fp_npa$obesity)
|
|
||||||
|
|
||||||
table(lf_fp_npa$mediator)
|
|
||||||
head(lf_fp_npa$value[lf_fp_npa$mediator == "vitd"])
|
|
||||||
lf_fp_npa = lf_fp_npa[!lf_fp_npa$mediator == "vitd",]
|
|
||||||
table(lf_fp_npa$mediator)
|
|
||||||
|
|
||||||
#-----------
|
|
||||||
# sam
|
|
||||||
#-----------
|
|
||||||
wf_fp_sam = sam_wf[sam_wf$flustat == 1,]
|
|
||||||
lf_fp_sam = sam_lf[sam_lf$flustat == 1,]
|
|
||||||
lf_fp_sam$timepoint = paste0("t", lf_fp_sam$timepoint)
|
|
||||||
lf_fp_sam$timepoint = as.factor(lf_fp_sam$timepoint)
|
|
||||||
lf_fp_sam$obesity = as.factor(lf_fp_sam$obesity)
|
|
||||||
|
|
||||||
table(lf_fp_sam$mediator)
|
|
||||||
head(lf_fp_sam$value[lf_fp_sam$mediator == "vitd"])
|
|
||||||
lf_fp_sam = lf_fp_sam[!lf_fp_sam$mediator == "vitd",]
|
|
||||||
table(lf_fp_sam$mediator)
|
|
||||||
|
|
||||||
#-----------
|
|
||||||
# serum
|
|
||||||
#-----------
|
|
||||||
wf_fp_serum = serum_wf[serum_wf$flustat == 1,]
|
|
||||||
lf_fp_serum = serum_lf[serum_lf$flustat == 1,]
|
|
||||||
lf_fp_serum$timepoint = paste0("t", lf_fp_serum$timepoint)
|
|
||||||
lf_fp_serum$timepoint = as.factor(lf_fp_serum$timepoint)
|
|
||||||
lf_fp_serum$obesity = as.factor(lf_fp_serum$obesity)
|
|
||||||
|
|
||||||
head(lf_fp_sam$value[lf_fp_serum$mediator == "vitd"])
|
|
||||||
########################################################################
|
|
||||||
|
|
|
@ -12,21 +12,23 @@ source("Header_TT.R")
|
||||||
# Input
|
# Input
|
||||||
#=============
|
#=============
|
||||||
source("data_extraction_mediators.R")
|
source("data_extraction_mediators.R")
|
||||||
source("read_data.R")
|
#source("read_data.R")
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#=============
|
#=============
|
||||||
# Data extraction for non-severe
|
# Data extraction for non-severe
|
||||||
#=============
|
#=============
|
||||||
table(fp_adults$T1_resp_score)
|
table(fp_adults_ics$T1_resp_score)
|
||||||
table(fp_adults$obesity)
|
table(fp_adults_ics$obesity)
|
||||||
|
|
||||||
df = fp_adults[fp_adults$T1_resp_score<3,]
|
df = fp_adults_ics[fp_adults_ics$T1_resp_score<3,]
|
||||||
table(df$obesity)
|
table(df$obesity)
|
||||||
|
|
||||||
df_ob = df[df$obesity == 1,]
|
df_ob = df[df$obesity == 1,]
|
||||||
df_nob = df[df$obesity == 0,]
|
df_nob = df[df$obesity == 0,]
|
||||||
|
|
||||||
|
rm(npa_lf, npa_wf, sam_lf, sam_wf, serum_lf, serum_wf, fp_adults_ics)
|
||||||
|
|
||||||
#============
|
#============
|
||||||
# npa
|
# npa
|
||||||
#============
|
#============
|
||||||
|
@ -38,6 +40,8 @@ foo = data.frame(df$obesity, df$vl_pfu_ul_npa2)
|
||||||
na_c = sum(is.na(foo$df.vl_pfu_ul_npa2))
|
na_c = sum(is.na(foo$df.vl_pfu_ul_npa2))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$vl_pfu_ul_npa2, df$obesity, median, na.rm = T)
|
||||||
|
tapply(df$vl_pfu_ul_npa2, df$obesity, summary, na.rm = T)
|
||||||
|
|
||||||
# 1l29: t1
|
# 1l29: t1
|
||||||
wilcox.test(df_ob$il29_npa1, df_nob$il29_npa1)
|
wilcox.test(df_ob$il29_npa1, df_nob$il29_npa1)
|
||||||
|
@ -46,6 +50,8 @@ foo = data.frame(df$obesity, df$il29_npa1)
|
||||||
na_c = sum(is.na(foo$df.il29_npa1))
|
na_c = sum(is.na(foo$df.il29_npa1))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$il29_npa1, df$obesity, median, na.rm = T)
|
||||||
|
tapply(df$il29_npa1, df$obesity, summary, na.rm = T)
|
||||||
|
|
||||||
# tnfr1: t3
|
# tnfr1: t3
|
||||||
wilcox.test(df_ob$tnfr1_npa3, df_nob$tnfr1_npa3)
|
wilcox.test(df_ob$tnfr1_npa3, df_nob$tnfr1_npa3)
|
||||||
|
@ -55,6 +61,11 @@ na_c = sum(is.na(foo$df.tnfr1_npa3))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
|
||||||
|
tapply(df$tnfr1_npa3, df$obesity, median, na.rm = T)
|
||||||
|
tapply(df$tnfr1_npa3, df$obesity, summary, na.rm = T)
|
||||||
|
|
||||||
|
boxplot(df_ob$tnfr1_npa3, df_nob$tnfr1_npa3)
|
||||||
|
|
||||||
# rantes: t1
|
# rantes: t1
|
||||||
wilcox.test(df_ob$rantes_npa1, df_nob$rantes_npa1)
|
wilcox.test(df_ob$rantes_npa1, df_nob$rantes_npa1)
|
||||||
|
|
||||||
|
@ -73,6 +84,9 @@ foo = data.frame(df$obesity, df$tarc_sam3)
|
||||||
na_c = sum(is.na(foo$df.tarc_sam3))
|
na_c = sum(is.na(foo$df.tarc_sam3))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$tarc_sam3, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
# il13: t3
|
# il13: t3
|
||||||
wilcox.test(df_ob$il13_sam3
|
wilcox.test(df_ob$il13_sam3
|
||||||
, df_nob$il13_sam3)
|
, df_nob$il13_sam3)
|
||||||
|
@ -81,6 +95,9 @@ foo = data.frame(df$obesity, df$il13_sam3)
|
||||||
na_c = sum(is.na(foo$df.il13_sam3))
|
na_c = sum(is.na(foo$df.il13_sam3))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$il13_sam3, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
# eotaxin: t1
|
# eotaxin: t1
|
||||||
wilcox.test(df_ob$eotaxin_sam1
|
wilcox.test(df_ob$eotaxin_sam1
|
||||||
, df_nob$eotaxin_sam1)
|
, df_nob$eotaxin_sam1)
|
||||||
|
@ -89,6 +106,8 @@ foo = data.frame(df$obesity, df$eotaxin_sam1)
|
||||||
na_c = sum(is.na(foo$df.eotaxin_sam1))
|
na_c = sum(is.na(foo$df.eotaxin_sam1))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$eotaxin_sam1, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
#============
|
#============
|
||||||
# serum
|
# serum
|
||||||
|
@ -101,6 +120,9 @@ foo = data.frame(df$obesity, df$ifna2a_serum1)
|
||||||
na_c = sum(is.na(foo$df.ifna2a_serum1))
|
na_c = sum(is.na(foo$df.ifna2a_serum1))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$ifna2a_serum1, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
# mip17: t1
|
# mip17: t1
|
||||||
wilcox.test(df_ob$mip17_serum1,
|
wilcox.test(df_ob$mip17_serum1,
|
||||||
df_nob$mip17_serum1)
|
df_nob$mip17_serum1)
|
||||||
|
@ -109,6 +131,8 @@ foo = data.frame(df$obesity, df$mip17_serum1)
|
||||||
na_c = sum(is.na(foo$df.mip17_serum1))
|
na_c = sum(is.na(foo$df.mip17_serum1))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$mip17_serum1, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
# il1: t1
|
# il1: t1
|
||||||
wilcox.test(df_ob$il1_serum1
|
wilcox.test(df_ob$il1_serum1
|
||||||
, df_nob$il1_serum1)
|
, df_nob$il1_serum1)
|
||||||
|
@ -117,6 +141,11 @@ foo = data.frame(df$obesity, df$il1_serum1)
|
||||||
na_c = sum(is.na(foo$df.il1_serum1))
|
na_c = sum(is.na(foo$df.il1_serum1))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$il1_serum1, df$obesity, median, na.rm = T)
|
||||||
|
tapply(df$il1_serum1, df$obesity, summary, na.rm = T)
|
||||||
|
boxplot(df_ob$il1_serum1, df_nob$il1_serum1)
|
||||||
|
|
||||||
|
|
||||||
# ifna2a: t2
|
# ifna2a: t2
|
||||||
wilcox.test(df_ob$ifna2a_serum2,
|
wilcox.test(df_ob$ifna2a_serum2,
|
||||||
df_nob$ifna2a_serum2)
|
df_nob$ifna2a_serum2)
|
||||||
|
@ -125,6 +154,9 @@ foo = data.frame(df$obesity, df$ifna2a_serum2)
|
||||||
na_c = sum(is.na(foo$df.ifna2a_serum2))
|
na_c = sum(is.na(foo$df.ifna2a_serum2))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
|
||||||
|
tapply(df$ifna2a_serum2, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
# ifna2a: t3
|
# ifna2a: t3
|
||||||
wilcox.test(df_ob$ifna2a_serum3,
|
wilcox.test(df_ob$ifna2a_serum3,
|
||||||
df_nob$ifna2a_serum3)
|
df_nob$ifna2a_serum3)
|
||||||
|
@ -133,6 +165,9 @@ foo = data.frame(df$obesity, df$ifna2a_serum3)
|
||||||
na_c = sum(is.na(foo$df.ifna2a_serum3))
|
na_c = sum(is.na(foo$df.ifna2a_serum3))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$ifna2a_serum3, df$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
# ifnb: t3
|
# ifnb: t3
|
||||||
wilcox.test(df_ob$ifnb_serum3
|
wilcox.test(df_ob$ifnb_serum3
|
||||||
, df_nob$ifnb_serum3)
|
, df_nob$ifnb_serum3)
|
||||||
|
@ -141,3 +176,4 @@ foo = data.frame(df$obesity, df$ifnb_serum3)
|
||||||
na_c = sum(is.na(foo$df.ifnb_serum3))
|
na_c = sum(is.na(foo$df.ifnb_serum3))
|
||||||
nrow(df) - na_c
|
nrow(df) - na_c
|
||||||
|
|
||||||
|
tapply(df$ifnb_serum3, df$obesity, median, na.rm = T)
|
||||||
|
|
|
@ -12,6 +12,12 @@ wf_npa = wf_fp_npa
|
||||||
wf_sam = wf_fp_sam
|
wf_sam = wf_fp_sam
|
||||||
wf_serum = wf_fp_serum
|
wf_serum = wf_fp_serum
|
||||||
############################################################
|
############################################################
|
||||||
|
# Numbers
|
||||||
|
table(fp_adults_ics$asthma, fp_adults_ics$obesity)
|
||||||
|
|
||||||
|
table(fp_adults_ics$obesity)
|
||||||
|
|
||||||
|
|
||||||
#=========
|
#=========
|
||||||
# t1
|
# t1
|
||||||
#=========
|
#=========
|
||||||
|
@ -24,6 +30,23 @@ length(wf_npa$il12p70_npa1) - sum(is.na(wf_npa$il12p70_npa1))
|
||||||
tapply(wf_npa$eotaxin3_npa1, wf_npa$obesity, mean, na.rm = T)
|
tapply(wf_npa$eotaxin3_npa1, wf_npa$obesity, mean, na.rm = T)
|
||||||
tapply(wf_npa$eotaxin3_npa1, wf_npa$obesity, median, na.rm = T)
|
tapply(wf_npa$eotaxin3_npa1, wf_npa$obesity, median, na.rm = T)
|
||||||
|
|
||||||
|
|
||||||
|
npa_wf_a = npa_wf[npa_wf$asthma == 1,]
|
||||||
|
npa_wf_na = npa_wf[npa_wf$asthma == 0,]
|
||||||
|
|
||||||
|
wilcox.test(npa_wf_a$il4_npa1[npa_wf_a$obesity == 1]
|
||||||
|
, npa_wf_a$il4_npa1[npa_wf_a$obesity == 0], paired = F)
|
||||||
|
|
||||||
|
length(npa_wf_a$il4_npa1) - sum(is.na(npa_wf_a$il4_npa1))
|
||||||
|
|
||||||
|
wilcox.test(npa_wf_a$il13_npa1[npa_wf_a$obesity == 1]
|
||||||
|
, npa_wf_a$il13_npa1[npa_wf_a$obesity == 0], paired = F)
|
||||||
|
|
||||||
|
wilcox.test(npa_wf_na$il4_npa1[npa_wf_na$obesity == 1]
|
||||||
|
, npa_wf_na$il4_npa1[npa_wf_na$obesity == 0], paired = F)
|
||||||
|
wilcox.test(npa_wf_na$il13_npa1[npa_wf_na$obesity == 1]
|
||||||
|
, npa_wf_na$il13_npa1[npa_wf_na$obesity == 0], paired = F)
|
||||||
|
|
||||||
#=========
|
#=========
|
||||||
# t2
|
# t2
|
||||||
#=========
|
#=========
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue