starting corr plots

This commit is contained in:
Tanushree Tunstall 2022-08-09 21:55:24 +01:00
parent cd86fcf8e8
commit a6d93b3fa8
2 changed files with 92 additions and 107 deletions

View file

@ -1,28 +1,7 @@
#!/usr/bin/env Rscript #!/usr/bin/env Rscript
######################################################### #########################################################
# TASK: Script to format data for Correlation plots: # TASK: Script to format data for Correlation plots:
# corr_data_extract() # corr_data_extract()
# INPUT:
# df: data with all parameters (my_use case)
# merged_df3 or merged_df2!?
# gene: [sanity check]
# drug: relates to a column name that will need to extracted
# ligand_dist_colname = LigDist_colname (variable from plotting_globals()
# colnames_to_extract = c("mutationinformation", "duet_affinity_change")
# display_colnames_key = c(mutationinformation = "MUT" , duet_affinity_change = "DUET")
# extract_scaled_cols = T or F, so that parameters with the _scaled suffix can be extracted.
# NOTE*: No formatting applied to these cols i.e display name
# RETURNS: DF
# containing all the columns required for generating downstream correlation plots
# TODO: ADD
#lineage_count_all
#lineage_count_unique
#my_df['lineage_proportion'] = my_df['lineage_count_unique']/my_df['lineage_count_all']
#my_df['dist_lineage_proportion'] = my_df['lineage_count_unique']/total_mtblineage_uc
################################################################## ##################################################################
# LigDist_colname #from globals: plotting_globals.R # LigDist_colname #from globals: plotting_globals.R
@ -31,14 +10,11 @@
corr_data_extract <- function(df corr_data_extract <- function(df
, gene , gene
, drug , drug
#, ligand_dist_colname = LigDist_colname
, colnames_to_extract , colnames_to_extract
, colnames_display_key , colnames_display_key
, extract_scaled_cols = F){ , extract_scaled_cols = F){
if ( missing(colnames_to_extract) || missing(colnames_display_key) ){ if ( missing(colnames_to_extract) || missing(colnames_display_key) ){
#if ( missing(colnames_to_extract) ){
cat("\n==========================================" cat("\n=========================================="
, "\nCORR PLOTS data: ALL params" , "\nCORR PLOTS data: ALL params"
, "\n=========================================") , "\n=========================================")

View file

@ -127,6 +127,7 @@ dev.off()
#================ #================
# ppi2 affinity # ppi2 affinity
#================ #================
if (tolower(gene)%in%geneL_ppi2){
corr_ppi2_colnames = c("mCSM-PPI2" corr_ppi2_colnames = c("mCSM-PPI2"
, "MAF" , "MAF"
, "Log(OR)" , "Log(OR)"
@ -169,6 +170,7 @@ my_corr_pairs(corr_data_all = corr_df_ppi2
, corr_value_size = 1) , corr_value_size = 1)
dev.off() dev.off()
}
# FIXME: ADD distance # FIXME: ADD distance
#================== #==================
@ -177,6 +179,8 @@ dev.off()
#================ #================
# NA affinity # NA affinity
#================ #================
if (tolower(gene)%in%geneL_na){
corr_na_colnames = c("mCSM-NA" corr_na_colnames = c("mCSM-NA"
, "MAF" , "MAF"
, "Log(OR)" , "Log(OR)"
@ -219,6 +223,8 @@ my_corr_pairs(corr_data_all = corr_df_na
, corr_value_size = 1) , corr_value_size = 1)
dev.off() dev.off()
}
#################################################### ####################################################
# CONSERVATION # CONSERVATION
@ -265,3 +271,6 @@ my_corr_pairs(corr_data_all = corr_df_cons
, corr_value_size = 1) , corr_value_size = 1)
dev.off() dev.off()
#