updated lineage dist for LIG for consistency
This commit is contained in:
parent
4f06e42ee4
commit
bcf822d6e4
1 changed files with 35 additions and 15 deletions
|
@ -75,6 +75,29 @@ if (max(my_df$Dis_lig_Ang) < 10){
|
|||
########################################################################
|
||||
# end of data extraction and cleaning for plots #
|
||||
########################################################################
|
||||
#==========================
|
||||
# Data for plot: assign as
|
||||
# necessary
|
||||
#===========================
|
||||
|
||||
# uncomment as necessary
|
||||
#!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# REASSIGNMENT
|
||||
|
||||
#==================
|
||||
# data 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
|
||||
#=======================
|
||||
#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
|
||||
|
@ -117,10 +140,10 @@ if(sum(table(my_df$lineage)[r1]) == nrow(df_lin)) {
|
|||
print("Error!: check your numbers")
|
||||
}
|
||||
|
||||
#<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
#!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# REASSIGNMENT
|
||||
df <- df_lin
|
||||
#<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
#!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
rm(df_lin)
|
||||
|
||||
|
@ -131,15 +154,15 @@ rm(df_lin)
|
|||
library(plotly)
|
||||
library(ggridges)
|
||||
|
||||
fooNames = c('Lineage 1', 'Lineage 2', 'Lineage 3', 'Lineage 4')
|
||||
names(fooNames) = c('lineage1', 'lineage2', 'lineage3', 'lineage4')
|
||||
my_labels = c('Lineage 1', 'Lineage 2', 'Lineage 3', 'Lineage 4')
|
||||
names(my_labels) = c('lineage1', 'lineage2', 'lineage3', 'lineage4')
|
||||
|
||||
g <- ggplot(df, aes(x = ratioPredAff)) +
|
||||
geom_density(aes(fill = Lig_outcome)
|
||||
, alpha = 0.5) +
|
||||
facet_wrap( ~ lineage
|
||||
, scales = "free"
|
||||
, labeller = labeller(lineage = fooNames) ) +
|
||||
, labeller = labeller(lineage = my_labels) ) +
|
||||
coord_cartesian(xlim = c(-1, 1)
|
||||
# , ylim = c(0, 6)
|
||||
# , clip = "off"
|
||||
|
@ -153,15 +176,18 @@ ggplotly(g)
|
|||
my_ats = 15 # axis text size
|
||||
my_als = 20 # axis label size
|
||||
|
||||
fooNames = c('Lineage 1', 'Lineage 2', 'Lineage 3', 'Lineage 4')
|
||||
names(fooNames) = c('lineage1', 'lineage2', 'lineage3', 'lineage4')
|
||||
my_labels = c('Lineage 1', 'Lineage 2', 'Lineage 3', 'Lineage 4')
|
||||
names(my_labels) = c('lineage1', 'lineage2', 'lineage3', 'lineage4')
|
||||
|
||||
# set output dir for plots
|
||||
getwd()
|
||||
setwd("~/git/Data/pyrazinamide/output/plots")
|
||||
getwd()
|
||||
|
||||
svg('lineage_dist_LIG.svg')
|
||||
# check plot name
|
||||
my_plot_name
|
||||
|
||||
svg(my_plot_name)
|
||||
|
||||
printFile = ggplot( df, aes(x = ratioPredAff
|
||||
, y = Lig_outcome) ) +
|
||||
|
@ -172,7 +198,7 @@ printFile = ggplot( df, aes(x = ratioPredAff
|
|||
facet_wrap( ~lineage
|
||||
, scales = "free"
|
||||
# , switch = 'x'
|
||||
, labeller = labeller(lineage = fooNames) ) +
|
||||
, labeller = labeller(lineage = my_labels) ) +
|
||||
coord_cartesian( xlim = c(-1, 1)
|
||||
# , ylim = c(0, 6)
|
||||
# , clip = "off"
|
||||
|
@ -202,12 +228,6 @@ printFile = ggplot( df, aes(x = ratioPredAff
|
|||
|
||||
print(printFile)
|
||||
dev.off()
|
||||
|
||||
#=!=!=!=!=!=!
|
||||
# COMMENT: When you look at all mutations, the lineage differences disappear...
|
||||
# The pattern we are interested in is possibly only for dr_mutations
|
||||
#=!=!=!=!=!=!
|
||||
|
||||
#===================================================
|
||||
|
||||
# COMPARING DISTRIBUTIONS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue