From 0c3645705d5a817fc66dbf0b72fae92b1eb59101 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Thu, 10 Jun 2021 16:18:08 +0100 Subject: [PATCH] moved old bp scripts to redundant --- scripts/plotting/basic_barplots_foldx.R | 129 ------------------ .../{ => redundant}/basic_barplots_LIG.R | 0 .../{ => redundant}/basic_barplots_PS.R | 0 scripts/plotting/running_plotting_scripts.txt | 31 +++-- 4 files changed, 23 insertions(+), 137 deletions(-) delete mode 100755 scripts/plotting/basic_barplots_foldx.R rename scripts/plotting/{ => redundant}/basic_barplots_LIG.R (100%) rename scripts/plotting/{ => redundant}/basic_barplots_PS.R (100%) diff --git a/scripts/plotting/basic_barplots_foldx.R b/scripts/plotting/basic_barplots_foldx.R deleted file mode 100755 index 68621c6..0000000 --- a/scripts/plotting/basic_barplots_foldx.R +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env Rscript -######################################################### -# TASK: producing barplots -# basic barplots with count of mutations -# basic barplots with frequency of count of mutations - -# Depends on -## plotting_globals.R (previously dir.R) -## plotting_data.R -######################################################### -# working dir -getwd() -setwd("~/git/LSHTM_analysis/scripts/plotting") -getwd() - -# load libraries -#source("Header_TT.R") -library(ggplot2) -library(data.table) -library(dplyr) -require("getopt", quietly = TRUE) # cmd parse arguments - -# load functions -source("plotting_globals.R") -source("plotting_data.R") -source("functions/stability_count_bp.R") -######################################################### -# command line args -#******************** -# !!!FUTURE TODO!!! -# Can pass additional params of output/plot dir by user. -# Not strictly required for my workflow since it is optimised -# to have a streamlined input/output flow without filename worries. -#******************** -spec = matrix(c( - "drug" ,"d", 1, "character", - "gene" ,"g", 1, "character", - "data" ,"f", 2, "character" -), byrow = TRUE, ncol = 4) - -opt = getopt(spec) - -#FIXME: detect if script running from cmd, then set these -drug = opt$drug -gene = opt$gene -infile = opt$data - -# hardcoding when not using cmd -#drug = "streptomycin" -#gene = "gid" - -if(is.null(drug)|is.null(gene)) { - stop("Missing arguments: --drug and --gene must both be specified (case-sensitive)") -} -######################################################### -# call functions with relevant args -#------------------------------------------ -# import_dirs(); returns - # datadir - # indir - # outdir - # plotdir - # dr_muts_col - # other_muts_col - # resistance_col -#-------------------------------------------- -import_dirs(drug, gene) -#--------------------------------------------- -# plotting_data(): returns - # my_df - # my_df_u - # my_df_u_lig - # dup_muts -#---------------------------------------------- -#infile = "/home/tanu/git/Data/streptomycin/output/gid_comb_stab_struc_params.csv" -#infile = "" - -#if (!exists("infile") && exists("gene")){ -if (!is.character(infile) && exists("gene")){ - #in_filename_params = paste0(tolower(gene), "_all_params.csv") - in_filename_params = paste0(tolower(gene), "_comb_stab_struc_params.csv") # part combined for gid - infile = paste0(outdir, "/", in_filename_params) - cat("\nInput file not specified, assuming filename: ", infile, "\n") -} - -# Get the DFs out of plotting_data() -pd_df = plotting_data(infile) -my_df = pd_df[[1]] -my_df_u = pd_df[[2]] -my_df_u_lig = pd_df[[3]] -dup_muts = pd_df[[4]] - -######################################################### -cat(paste0("Directories imported:" - , "\ndatadir:", datadir - , "\nindir:", indir - , "\noutdir:", outdir - , "\nplotdir:", plotdir)) - - cat(paste0("\nVariables imported:" - , "\ndrug:", drug - , "\ngene:", gene - , "\n")) - #, "\ngene_match:", gene_match - #, "\nLength of upos:", length(upos) - #, "\nAngstrom symbol:", angstroms_symbol)) - -#======= -# output filenames -#======= - -basic_bp_foldx = paste0(tolower(gene), "_basic_barplot_foldx.svg") -plot_basic_bp_foldx = paste0(plotdir,"/", basic_bp_foldx) - -#**************** -# Plot 1: Count of stabilising and destabilsing muts -#**************** -svg(plot_basic_bp_foldx) -print(paste0("plot1 filename:", plot_basic_bp_foldx)) - -stability_count_bp(plotdf = my_df_u - , df_colname = "foldx_outcome" - , leg_title = "FoldX outcome") -dev.off() - -table(my_df_u$foldx_outcome) -######################################################################## -# end of foldx barplot -######################################################################## diff --git a/scripts/plotting/basic_barplots_LIG.R b/scripts/plotting/redundant/basic_barplots_LIG.R similarity index 100% rename from scripts/plotting/basic_barplots_LIG.R rename to scripts/plotting/redundant/basic_barplots_LIG.R diff --git a/scripts/plotting/basic_barplots_PS.R b/scripts/plotting/redundant/basic_barplots_PS.R similarity index 100% rename from scripts/plotting/basic_barplots_PS.R rename to scripts/plotting/redundant/basic_barplots_PS.R diff --git a/scripts/plotting/running_plotting_scripts.txt b/scripts/plotting/running_plotting_scripts.txt index 9bae858..08d4a25 100644 --- a/scripts/plotting/running_plotting_scripts.txt +++ b/scripts/plotting/running_plotting_scripts.txt @@ -1,23 +1,38 @@ -#======== -# basic_barplot.R: -#======== -./basic_barplots.R -d streptomycin -g gid -f /home/tanu/gid_test_file.csv +######################################################################### +#=================== +# basic_barplot.R +#=================== + It replaces + basic_barplot_PS.R + basic_barplot_LIG.R + basic_barplot_foldx.R + These have been moved to redundant/ sources: ## plotting_globals.R (previously dir.R) ## plotting_data.R ## position_count_bp.R ## stability_count_bp.R + + outputs: + ##5 svgs in the plotdir + + note: + -f flag has default if not supplied +#----------------------------------------------------------------------- +./basic_barplots.R -d streptomycin -g gid -f /home/tanu/gid_test_file.csv +#----------------------------------------------------------------------- -outputs: - #5 svgs in the plotdir + + + +######################################################################## # TODO Delete: dirs.R after grepping barplots_subcolours_aa_combined.R:source("dirs.R") basic_barplots_PS.R:source("dirs.R") resolving_ambiguous_muts.R:source("dirs.R") - -#======================================================================= +########################################################################