added quick summary to see sig meds just before writing file
This commit is contained in:
parent
17aebc26e8
commit
1562a09631
8 changed files with 63 additions and 29 deletions
0
colnames_clinical_meds.R
Normal file → Executable file
0
colnames_clinical_meds.R
Normal file → Executable file
0
data_extraction_formatting_clinical.R
Normal file → Executable file
0
data_extraction_formatting_clinical.R
Normal file → Executable file
0
data_extraction_formatting_non_asthmatics.R
Normal file → Executable file
0
data_extraction_formatting_non_asthmatics.R
Normal file → Executable file
0
data_extraction_formatting_regression.R
Normal file → Executable file
0
data_extraction_formatting_regression.R
Normal file → Executable file
|
@ -43,12 +43,6 @@ rm(pivot_cols)
|
|||
# sanity checks
|
||||
table(lf$timepoint)
|
||||
|
||||
#if (table(lf$flustat) == table(npa_lf$flustat)[[2]]){
|
||||
# cat("Analysing Flu positive patients for:", my_sample_type)
|
||||
#}else{
|
||||
# cat("FAIL: problem with subsetting data for:", my_sample_type)
|
||||
# quit()
|
||||
#}
|
||||
########################################################################
|
||||
# Unpaired stats at each timepoint b/w groups: wilcoxon UNpaired analysis
|
||||
# with correction
|
||||
|
@ -366,16 +360,22 @@ colnames(combined_unpaired_stats_f) = c("mediator"
|
|||
|
||||
colnames(combined_unpaired_stats_f)
|
||||
|
||||
#---------------
|
||||
# quick summary
|
||||
#---------------
|
||||
# count how many meds are significant
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05])
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig)
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)])
|
||||
sig_meds = combined_unpaired_stats_f[(combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)),]
|
||||
|
||||
sig_meds = combined_unpaired_stats_f[combined_unpaired_stats_f$p_signif<0.05,]
|
||||
sig_meds$med_time = paste0(sig_meds$mediator, "@", sig_meds$timepoint)
|
||||
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig
|
||||
, "\nThese are:", sig_meds$med_time)
|
||||
|
||||
########################################################################
|
||||
#******************
|
||||
# write output file
|
||||
#******************
|
||||
cat("UNpaired stats for groups will be:", flu_stats_time_unpaired_na)
|
||||
write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired_na, row.names = FALSE)
|
||||
cat("\nUNpaired stats for groups will be:", flu_stats_time_unpaired_na)
|
||||
#write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired_na, row.names = FALSE)
|
||||
|
|
|
@ -366,16 +366,22 @@ colnames(combined_unpaired_stats_f) = c("mediator"
|
|||
|
||||
colnames(combined_unpaired_stats_f)
|
||||
|
||||
#---------------
|
||||
# quick summary
|
||||
#---------------
|
||||
# count how many meds are significant
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05])
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig)
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)])
|
||||
sig_meds = combined_unpaired_stats_f[(combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)),]
|
||||
|
||||
sig_meds = combined_unpaired_stats_f[combined_unpaired_stats_f$p_signif<0.05,]
|
||||
sig_meds$med_time = paste0(sig_meds$mediator, "@", sig_meds$timepoint)
|
||||
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig
|
||||
, "\nThese are:", sig_meds$med_time)
|
||||
|
||||
########################################################################
|
||||
#******************
|
||||
# write output file
|
||||
#******************
|
||||
cat("UNpaired stats for groups will be:", flu_stats_time_unpaired)
|
||||
write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
cat("\nUNpaired stats for groups will be:", flu_stats_time_unpaired)
|
||||
#write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
|
|
|
@ -71,8 +71,8 @@ foo = lf_t1[which(is.na(lf_t1$value)),]
|
|||
lf_t1_comp = lf_t1[-which(is.na(lf_t1$value)),]
|
||||
stats_un_t1 = compare_means(value~obesity
|
||||
, group.by = "mediator"
|
||||
, data = lf_t1
|
||||
#, data = lf_t1_comp
|
||||
#, data = lf_t1
|
||||
, data = lf_t1_comp
|
||||
, paired = FALSE
|
||||
, p.adjust.method = my_adjust_method)
|
||||
|
||||
|
@ -368,9 +368,23 @@ colnames(combined_unpaired_stats_f) = c("mediator"
|
|||
, "p_bon_signif")
|
||||
|
||||
colnames(combined_unpaired_stats_f)
|
||||
|
||||
#---------------
|
||||
# quick summary
|
||||
#---------------
|
||||
# count how many meds are significant
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)])
|
||||
sig_meds = combined_unpaired_stats_f[(combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)),]
|
||||
|
||||
sig_meds$med_time = paste0(sig_meds$mediator, "@", sig_meds$timepoint)
|
||||
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig
|
||||
, "\nThese are:", sig_meds$med_time)
|
||||
|
||||
#######################################################################
|
||||
#******************
|
||||
# write output file
|
||||
#******************
|
||||
cat("UNpaired stats for groups will be:", flu_stats_time_unpaired)
|
||||
write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
cat("\nUNpaired stats for groups will be:", flu_stats_time_unpaired)
|
||||
#write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
|
|
|
@ -67,8 +67,8 @@ ci = which(is.na(lf_t1$value))
|
|||
lf_t1_comp = lf_t1[-which(is.na(lf_t1$value)),]
|
||||
stats_un_t1 = compare_means(value~obesity
|
||||
, group.by = "mediator"
|
||||
, data = lf_t1
|
||||
#, data = lf_t1_comp
|
||||
#, data = lf_t1
|
||||
, data = lf_t1_comp
|
||||
, paired = FALSE
|
||||
, p.adjust.method = my_adjust_method)
|
||||
|
||||
|
@ -129,8 +129,8 @@ lf_t2_comp = lf_t2[-which(is.na(lf_t2$value)),]
|
|||
|
||||
stats_un_t2 = compare_means(value~obesity
|
||||
, group.by = "mediator"
|
||||
, data = lf_t2
|
||||
#, data = lf_t2_comp
|
||||
#, data = lf_t2
|
||||
, data = lf_t2_comp
|
||||
, paired = FALSE
|
||||
, p.adjust.method = my_adjust_method)
|
||||
# add timepoint and convert to df
|
||||
|
@ -188,8 +188,8 @@ lf_t3_comp = lf_t3[-which(is.na(lf_t3$value)),]
|
|||
|
||||
stats_un_t3 = compare_means(value~obesity
|
||||
, group.by = "mediator"
|
||||
, data = lf_t3
|
||||
#, data = lf_t3_comp
|
||||
#, data = lf_t3
|
||||
, data = lf_t3_comp
|
||||
, paired = FALSE
|
||||
, p.adjust.method = my_adjust_method)
|
||||
|
||||
|
@ -361,9 +361,23 @@ colnames(combined_unpaired_stats_f) = c("mediator"
|
|||
, "p_bon_signif")
|
||||
|
||||
colnames(combined_unpaired_stats_f)
|
||||
|
||||
#---------------
|
||||
# quick summary
|
||||
#---------------
|
||||
# count how many meds are significant
|
||||
n_sig = length(combined_unpaired_stats_f$mediator[combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)])
|
||||
sig_meds = combined_unpaired_stats_f[(combined_unpaired_stats_f$p_signif<0.05 & !is.na(combined_unpaired_stats_f$p_signif<0.05)),]
|
||||
|
||||
sig_meds$med_time = paste0(sig_meds$mediator, "@", sig_meds$timepoint)
|
||||
|
||||
cat("\nTotal no. of statistically significant mediators in", toupper(my_sample_type)
|
||||
, "are:", n_sig
|
||||
, "\nThese are:", sig_meds$med_time)
|
||||
|
||||
########################################################################
|
||||
#******************
|
||||
# write output file
|
||||
#******************
|
||||
cat("UNpaired stats for groups will be:", flu_stats_time_unpaired)
|
||||
write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
#write.csv(combined_unpaired_stats_f, flu_stats_time_unpaired, row.names = FALSE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue