changes made to combining_dfs_plotting.R

This commit is contained in:
Tanushree Tunstall 2021-06-23 16:15:15 +01:00
parent c6d1260f74
commit 2aec79af31
9 changed files with 258 additions and 126 deletions

View file

@ -1,4 +1,4 @@
# #!/usr/bin/env Rscript
#!/usr/bin/env Rscript
# working dir and loading libraries
getwd()
@ -33,14 +33,20 @@ source("plotting_globals.R")
source("plotting_data.R")
source("combining_dfs_plotting.R")
gene = 'gid'
drug = 'streptomycin'
#---------------------
# call: import_dirs()
#---------------------
import_dirs(drug, gene)
gene = 'gid'
drug = 'streptomycin'
import_dirs(drug_name = drug, gene_name = gene)
#-------------------------------
# test function: plotting_data()
#-------------------------------
#============================
# Input 1: plotting_data()
#============================
if (!exists("infile_params") && exists("gene")){
#if (!is.character(infile_params) && exists("gene")){
#in_filename_params = paste0(tolower(gene), "_all_params.csv")
@ -49,6 +55,13 @@ if (!exists("infile_params") && exists("gene")){
cat("\nInput file for mcsm comb data not specified, assuming filename: ", infile_params, "\n")
}
mcsm_comb_data = read.csv(infile_params, header = T)
pd_df = plotting_data(df = mcsm_comb_data, lig_dist_cutoff = 10)
my_df_u = pd_df[[2]]
#======================================
# Input 2: read <gene>_meta data.csv
#======================================
if (!exists("infile_metadata") && exists("gene")){
#if (!is.character(infile_params) && exists("gene")){{
in_filename_metadata = paste0(tolower(gene), "_metadata.csv") # part combined for gid
@ -56,18 +69,6 @@ if (!exists("infile_metadata") && exists("gene")){
cat("\nInput file for gene metadata not specified, assuming filename: ", infile_metadata, "\n")
}
#============================
# Input 1: plotting_data()
#============================
#---------------------
# call: plotting_data()
#---------------------
pd_df = plotting_data(infile_params)
my_df = pd_df[[1]] # this forms one of the input for combining_dfs_plotting()
#======================================
# Input 2: read <gene>_meta data.csv
#======================================
cat("\nReading meta data file:", infile_metadata)
gene_metadata <- read.csv(infile_metadata
@ -79,9 +80,11 @@ all_plot_dfs = combining_dfs_plotting(my_df_u
, lig_dist_colname = 'ligand_distance'
, lig_dist_cutoff = 10)
merged_df2 = all_plot_dfs[[1]]
merged_df3 = all_plot_dfs[[2]]
merged_df2_comp = all_plot_dfs[[3]]
merged_df3_comp = all_plot_dfs[[4]]
merged_df2_lig = all_plot_dfs[[5]]
merged_df3_lig = all_plot_dfs[[6]]
merged_df2 = all_plot_dfs[[1]]
merged_df3 = all_plot_dfs[[2]]
merged_df2_comp = all_plot_dfs[[3]]
merged_df3_comp = all_plot_dfs[[4]]
merged_df2_lig = all_plot_dfs[[5]]
merged_df3_lig = all_plot_dfs[[6]]
merged_df2_comp_lig = all_plot_dfs[[7]]
merged_df3_comp_lig = all_plot_dfs[[8]]