renamed files for lineage_diff_sensitivites.R
This commit is contained in:
parent
69a0da0a59
commit
1dacebbaf6
5 changed files with 179 additions and 39 deletions
|
@ -45,20 +45,10 @@ lef_snps_df = df2[df2$mutationinformation%in%left_snps,]
|
|||
table(lef_snps_df$lineage)
|
||||
|
||||
##################################
|
||||
# selected lineage plos
|
||||
cols_to_subset = c("mutationinformation"
|
||||
, "lineage"
|
||||
, "dst2"
|
||||
, "sens2")
|
||||
|
||||
|
||||
# selected lineage plots
|
||||
##################################
|
||||
#-----------------------------------------------
|
||||
# step 0: Subset a smaller df
|
||||
#-----------------------------------------------
|
||||
plot_df_gene = df2_lin[, cols_to_subset]
|
||||
|
||||
#-----------------------------------------------
|
||||
# step 1: Select muts for each target
|
||||
# step 0: Select muts for each target
|
||||
#-----------------------------------------------
|
||||
# embb
|
||||
#sel_mutsP = c("D354N", "Y319D", "Y319D", "A962P", "S651N", "A201S")
|
||||
|
@ -69,6 +59,18 @@ sel_mutsP = c("P75R", "A19G", "A133P", "R154W", "R118L") #G30D)
|
|||
# rpob
|
||||
#sel_mutsP = c("")
|
||||
#-----------------------------------------------
|
||||
# step 1: Subset a smaller df
|
||||
#-----------------------------------------------
|
||||
# selected lineage plos
|
||||
cols_to_subset = c("mutationinformation"
|
||||
, "lineage"
|
||||
, "dst2"
|
||||
, "sens2")
|
||||
|
||||
|
||||
|
||||
plot_df_gene = df2_lin[, cols_to_subset]
|
||||
#-----------------------------------------------
|
||||
# step 2: Subset data with just those genes
|
||||
#-----------------------------------------------
|
||||
plot_df_gene = plot_df_gene[plot_df_gene$mutationinformation%in%sel_mutsP,]
|
||||
|
@ -82,40 +84,8 @@ plot_df = plot_df_gene
|
|||
|
||||
#-----------------------------------------------
|
||||
# step 4: Add p-value
|
||||
# NOT NEEDED, get it from lineage_diff_sensitivities.R if needed
|
||||
#-----------------------------------------------
|
||||
plot_df$pval = NULL
|
||||
for (i in sel_mutsP) {
|
||||
#print (i)
|
||||
s_mut = plot_df[plot_df$mutationinformation == i,]
|
||||
#print(s_mut)
|
||||
s_tab = table(s_mut$lineage, s_mut$sens2)
|
||||
#print(s_tab)
|
||||
#ft_pvalue_i = round(fisher.test(s_tab)$p.value, 3)
|
||||
ft_pvalue_i = fisher.test(s_tab
|
||||
#, workspace=2e9
|
||||
#, simulate.p.value=TRUE,B=1e7
|
||||
)$p.value
|
||||
#print(ft_pvalue_i)
|
||||
plot_df$pval[plot_df$mutationinformation == i] <- ft_pvalue_i
|
||||
#print(s_tab)
|
||||
}
|
||||
|
||||
plot_df$pvalR = round(plot_df$pval, 3)
|
||||
|
||||
# round P-values
|
||||
plot_df$pvalRF = plot_df$pvalR
|
||||
plot_df = dplyr::mutate(plot_df
|
||||
, pvalRF = case_when(pvalRF == 0.05 ~ "P ."
|
||||
, pvalRF <=0.0001 ~ 'P ****'
|
||||
, pvalRF <=0.001 ~ 'P ***'
|
||||
, pvalRF <=0.01 ~ 'P **'
|
||||
, pvalRF <0.05 ~ 'P *'
|
||||
, TRUE ~ 'ns'))
|
||||
|
||||
plot_df
|
||||
|
||||
head(plot_df)
|
||||
table(plot_df$pvalR<0.05)
|
||||
|
||||
#-----------------------------------------------
|
||||
# step 5: Plot
|
Loading…
Add table
Add a link
Reference in a new issue