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 632b78320a
commit 8c7c389562

View file

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