added log10 OR and P values to myaf_or_calcs.R

This commit is contained in:
Tanushree Tunstall 2021-08-23 20:01:01 +01:00
parent 0c16937b68
commit 1e3670f935
4 changed files with 32 additions and 12 deletions

View file

@ -297,14 +297,14 @@ print('Output filename:', outfile_stab_struc
, '\n===================================================================') , '\n===================================================================')
# write csv # write csv
print('Writing file: combined stability and structural parameters') print('\nWriting file: combined stability and structural parameters')
combined_df_clean.to_csv(outfile_stab_struc, index = False) combined_df_clean.to_csv(outfile_stab_struc, index = False)
print('\nFinished writing file:' print('\nFinished writing file:'
, '\nNo. of rows:', combined_df_clean.shape[0] , '\nNo. of rows:', combined_df_clean.shape[0]
, '\nNo. of cols:', combined_df_clean.shape[1]) , '\nNo. of cols:', combined_df_clean.shape[1])
#%%===================================================================== #%%=====================================================================
print('=======================================' print('\n======================================='
, '\nFifth merge: , '\nFifth merge:'
, '\ncombined_df_clean + afor_df ' , '\ncombined_df_clean + afor_df '
, '\n=======================================') , '\n=======================================')
@ -372,4 +372,4 @@ combined_stab_afor.to_csv(outfile_comb_afor, index = False)
print('\nFinished writing file:' print('\nFinished writing file:'
, '\nNo. of rows:', combined_stab_afor.shape[0] , '\nNo. of rows:', combined_stab_afor.shape[0]
, '\nNo. of cols:', combined_stab_afor.shape[1]) , '\nNo. of cols:', combined_stab_afor.shape[1])
#%% end of script #%% end of script

View file

@ -180,6 +180,12 @@ my_afor <- function ( drug
ci_lower_fisher = fisher.test(table(dst, mut))$conf.int[1] ci_lower_fisher = fisher.test(table(dst, mut))$conf.int[1]
ci_upper_fisher = fisher.test(table(dst, mut))$conf.int[2] ci_upper_fisher = fisher.test(table(dst, mut))$conf.int[2]
#--------------------
# adding log cols : NEW
#--------------------
log10_or_mychisq = log10(or_mychisq)
neglog_pval_fisher = -log10(pval_fisher)
#------------------- #-------------------
# chi sq estimates # chi sq estimates
#------------------- #-------------------
@ -198,9 +204,11 @@ my_afor <- function ( drug
, zval_logistic = zval_logistic , zval_logistic = zval_logistic
, ci_low_logistic = ci_lower_logistic , ci_low_logistic = ci_lower_logistic
, ci_hi_logistic = ci_upper_logistic , ci_hi_logistic = ci_upper_logistic
, or_mychisq = or_mychisq , or_mychisq = or_mychisq
, log10_or_mychisq = log10_or_mychisq # NEW
, or_fisher = or_fisher , or_fisher = or_fisher
, pval_fisher = pval_fisher , pval_fisher = pval_fisher
, neglog_pval_fisher = neglog_pval_fisher # NEW
, ci_low_fisher= ci_lower_fisher , ci_low_fisher= ci_lower_fisher
, ci_hi_fisher = ci_upper_fisher , ci_hi_fisher = ci_upper_fisher
, est_chisq = est_chisq , est_chisq = est_chisq

View file

@ -76,6 +76,14 @@ if ( all(c1 == c2) ){
exit() exit()
} }
#------------------------------
# renaming foldx column from
# "ddg" --> "ddg_foldx"
#------------------------------
# change name to foldx
colnames(df)[n] <- "ddg_foldx"
#================================== #==================================
# extract unique mutation entries # extract unique mutation entries
#================================== #==================================

View file

@ -101,7 +101,7 @@ cols_to_select = c("mutationinformation", "drtype"
, "chain", "ligand_id", "ligand_distance" , "chain", "ligand_id", "ligand_distance"
, "duet_stability_change", "duet_outcome", "duet_scaled" , "duet_stability_change", "duet_outcome", "duet_scaled"
, "ligand_affinity_change", "ligand_outcome", "affinity_scaled" , "ligand_affinity_change", "ligand_outcome", "affinity_scaled"
, "ddg", "foldx_scaled", "foldx_outcome" , "ddg_foldx", "foldx_scaled", "foldx_outcome"
, "deepddg", "deepddg_outcome" # comment out as not available for pnca , "deepddg", "deepddg_outcome" # comment out as not available for pnca
, "asa", "rsa", "rd_values", "kd_values" , "asa", "rsa", "rd_values", "kd_values"
, "af", "or_mychisq", "pval_fisher" , "af", "or_mychisq", "pval_fisher"
@ -375,10 +375,10 @@ cat("\n=========================================="
df_ps = merged_df2 df_ps = merged_df2
#-------------------- #--------------------
# adding log cols # adding log cols : NEW UNCOMMENT
#-------------------- #--------------------
df_ps$log10_or_mychisq = log10(df_ps$or_mychisq) #df_ps$log10_or_mychisq = log10(df_ps$or_mychisq)
df_ps$neglog_pval_fisher = -log10(df_ps$pval_fisher) #df_ps$neglog_pval_fisher = -log10(df_ps$pval_fisher)
##df_ps$log10_or_kin = log10(df_ps$or_kin) ##df_ps$log10_or_kin = log10(df_ps$or_kin)
##df_ps$neglog_pwald_kin = -log10(df_ps$pwald_kin) ##df_ps$neglog_pwald_kin = -log10(df_ps$pwald_kin)
@ -484,10 +484,10 @@ df_lig = merged_df2_lig
table(df_lig$ligand_outcome) table(df_lig$ligand_outcome)
#-------------------- #--------------------
# adding log cols # adding log cols : NEW UNCOMMENT
#-------------------- #--------------------
df_lig$log10_or_mychisq = log10(df_lig$or_mychisq) #df_lig$log10_or_mychisq = log10(df_lig$or_mychisq)
df_lig$neglog_pval_fisher = -log10(df_lig$pval_fisher) #df_lig$neglog_pval_fisher = -log10(df_lig$pval_fisher)
##df_lig$log10_or_kin = log10(df_lig$or_kin) ##df_lig$log10_or_kin = log10(df_lig$or_kin)
##df_lig$neglog_pwald_kin = -log10(df_lig$pwald_kin) ##df_lig$neglog_pwald_kin = -log10(df_lig$pwald_kin)
@ -583,3 +583,7 @@ identical(corr_data_ps, corr_ps_df2)
# End of script # End of script
######################################################################## ########################################################################
rm(foo) rm(foo)
cat("\n===================================================\n"
, "\nSuccessful: get_plotting_dfs.R worked!"
, "\n====================================================")