tidying script for lineage dist PS and separating KS test results

This commit is contained in:
Tanushree Tunstall 2020-02-02 11:11:49 +00:00
parent 8df0491721
commit 31383e945b

View file

@ -66,34 +66,37 @@ table(my_df$mutation_info); str(my_df$mutation_info)
# subset df with dr muts only
my_df_dr = subset(my_df, mutation_info == "dr_mutations_pyrazinamide")
table(my_df_dr$mutation_info)
########################################################################
# end of data extraction and cleaning for plots #
########################################################################
#==========================
# Data for plot: assign as
# necessary
# Run two times:
# uncomment as necessary
# 1) for all muts
# 2) for dr_muts
#===========================
# uncomment as necessary
#!!!!!!!!!!!!!!!!!!!!!!!
#%%%%%%%%%%%%%%%%%%%%%%%%
# REASSIGNMENT
#==================
# data for ALL muts
#==================
#================
# for ALL muts
#================
plot_df = my_df
my_plot_name = 'lineage_dist_PS.svg'
#my_plot_name = 'lineage_dist_PS_comp.svg'
#=======================
# data for dr_muts ONLY
#=======================
#================
# for dr muts ONLY
#================
#plot_df = my_df_dr
#my_plot_name = 'lineage_dist_dr_PS.svg'
#my_plot_name = 'lineage_dist_dr_PS_comp.svg'
#!!!!!!!!!!!!!!!!!!!!!!!
#%%%%%%%%%%%%%%%%%%%%%%%%
#==========================
# Plot: Lineage Distribution
@ -219,24 +222,8 @@ dev.off()
#=!=!=!=!=!=!=!
#===================================================
# COMPARING DISTRIBUTIONS
head(df$lineage)
df$lineage = as.character(df$lineage)
lin1 = df[df$lineage == "lineage1",]$ratioDUET
lin2 = df[df$lineage == "lineage2",]$ratioDUET
lin3 = df[df$lineage == "lineage3",]$ratioDUET
lin4 = df[df$lineage == "lineage4",]$ratioDUET
# ks test
ks.test(lin1,lin2)
ks.test(lin1,lin3)
ks.test(lin1,lin4)
ks.test(lin2,lin3)
ks.test(lin2,lin4)
ks.test(lin3,lin4)
# COMPARING DISTRIBUTIONS: KS test
# run: "../KS_test_PS.R"