added logo_plots.R that now produces all logo plots while sourcing the get_plotting_df.R script

This commit is contained in:
Tanushree Tunstall 2021-06-24 17:34:53 +01:00
parent 0e15c05d8b
commit 8de2686401
3 changed files with 271 additions and 4 deletions

View file

@ -108,8 +108,9 @@ cat("No. of rows in my_data:", nrow(logo_data)
, "\nDistinct positions corresponding to snps:", length(c1)
, "\n===========================================================")
#=======================================================================
#%% logo plots from dataframe
#==================
# logo data: OR
#==================
foo = logo_data[, c("position"
, "mutant_type","duet_scaled", "or_mychisq"
, "mut_prop_polarity", "mut_prop_water")]
@ -132,7 +133,6 @@ position_or = as.numeric(colnames(wide_df_or))
#==================
# logo data: logOR
#==================
# extracting data with log10R
logo_data_plot_logor = logo_data[, c("position", "mutant_type", "log10or")]
wide_df_logor <- logo_data_plot_logor %>% spread(position, log10or, fill = 0.0)
@ -217,6 +217,20 @@ rownames(tab_wt)
identical(colnames(tab_mt), colnames(tab_wt))
identical(ncol(tab_mt), ncol(tab_wt))
#----------------------------------
# logo data OR: multiple nsSNPs (>1)
#----------------------------------
logo_data_or_mult = my_data_snp[, c("position", "mutant_type", "or_mychisq")]
#wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = 0.0)
wide_df_or_mult <- logo_data_or_mult %>% spread(position, or_mychisq, fill = NA)
wide_df_or_mult = as.matrix(wide_df_or_mult)
rownames(wide_df_or_mult) = wide_df_or_mult[,1]
wide_df_or_mult = wide_df_or_mult[,-1]
str(wide_df_or_mult)
position_or_mult = as.numeric(colnames(wide_df_or_mult))
########################################################################
# End of script
########################################################################