updated running_plotting_scripts.R

This commit is contained in:
Tanushree Tunstall 2021-09-07 11:16:41 +01:00
parent ebca0f4221
commit bc89534f64
24 changed files with 49 additions and 11 deletions

0
scripts/plotting/basic_barplots_combined.R Normal file → Executable file
View file

0
scripts/plotting/corr_adjusted_PS_LIG.R Normal file → Executable file
View file

0
scripts/plotting/dirs.R Normal file → Executable file
View file

0
scripts/plotting/dist_plots_check.R Normal file → Executable file
View file

0
scripts/plotting/extreme_muts.R Normal file → Executable file
View file

8
scripts/plotting/get_plotting_dfs.R Normal file → Executable file
View file

@ -39,8 +39,8 @@ import_dirs(drug, gene)
#--------------------------- #---------------------------
# call: plotting_data() # call: plotting_data()
#--------------------------- #---------------------------
if (!exists("infile_params") && exists("gene")){ #if (!exists("infile_params") && exists("gene")){
#if (!is.character(infile_params) && exists("gene")){ # when running as cmd if (!is.character(infile_params) && exists("gene")){ # when running as cmd
#in_filename_params = paste0(tolower(gene), "_all_params.csv") #for pncA #in_filename_params = paste0(tolower(gene), "_all_params.csv") #for pncA
in_filename_params = paste0(tolower(gene), "_comb_afor.csv") # part combined for gid in_filename_params = paste0(tolower(gene), "_comb_afor.csv") # part combined for gid
infile_params = paste0(outdir, "/", in_filename_params) infile_params = paste0(outdir, "/", in_filename_params)
@ -67,8 +67,8 @@ cat("\nLigand distance cut off, colname:", LigDist_colname
#-------------------------------- #--------------------------------
# call: combining_dfs_plotting() # call: combining_dfs_plotting()
#-------------------------------- #--------------------------------
if (!exists("infile_metadata") && exists("gene")){ #if (!exists("infile_metadata") && exists("gene")){
#if (!is.character(infile_metadata) && exists("gene")){ # when running as cmd if (!is.character(infile_metadata) && exists("gene")){ # when running as cmd
in_filename_metadata = paste0(tolower(gene), "_metadata.csv") # part combined for gid in_filename_metadata = paste0(tolower(gene), "_metadata.csv") # part combined for gid
infile_metadata = paste0(outdir, "/", in_filename_metadata) infile_metadata = paste0(outdir, "/", in_filename_metadata)
cat("\nInput file for gene metadata not specified, assuming filename: ", infile_metadata, "\n") cat("\nInput file for gene metadata not specified, assuming filename: ", infile_metadata, "\n")

0
scripts/plotting/get_plotting_dfs_with_lig.R Normal file → Executable file
View file

0
scripts/plotting/ggcorr_all_PS_LIG.R Normal file → Executable file
View file

0
scripts/plotting/hist_af_or_base.R Normal file → Executable file
View file

0
scripts/plotting/hist_af_or_combined.R Normal file → Executable file
View file

0
scripts/plotting/legend_adjustment.R Normal file → Executable file
View file

24
scripts/plotting/lineage_basic_barplots_combined.R Normal file → Executable file
View file

@ -3,9 +3,10 @@ getwd()
setwd("~/git/LSHTM_analysis/scripts/plotting/") setwd("~/git/LSHTM_analysis/scripts/plotting/")
getwd() getwd()
######################################################### #########################################################
# TASK: Basic lineage barplot showing numbers # TASK: Basic lineage barplots showing numbers
# Output: Basic barplot with lineage samples and mut count # Output: Basic barplot with lineage samples and mut count
# + SNP diversity
########################################################## ##########################################################
# Installing and loading required packages # Installing and loading required packages
@ -16,6 +17,27 @@ source("../functions/bp_lineage.R")
#=========== #===========
# input # input
#=========== #===========
#drug = 'streptomycin'
#gene = 'gid'
spec = matrix(c(
"drug" , "d", 1, "character",
"gene" , "g", 1, "character",
"data_file1" , "fa", 2, "character",
"data_file2" , "fb", 2, "character"
), byrow = TRUE, ncol = 4)
opt = getopt(spec)
drug = opt$drug
gene = opt$gene
infile_params = opt$data_file1
infile_metadata = opt$data_file2
if(is.null(drug)|is.null(gene)) {
stop("Missing arguments: --drug and --gene must both be specified (case-sensitive)")
}
source ('get_plotting_dfs.R') source ('get_plotting_dfs.R')
cat("Directories imported:" cat("Directories imported:"

0
scripts/plotting/lineage_bp_data.R Normal file → Executable file
View file

0
scripts/plotting/lineage_dist_combined_PS.R Normal file → Executable file
View file

0
scripts/plotting/lineage_dist_dm_om_combined_PS.R Normal file → Executable file
View file

0
scripts/plotting/opp_mcsm_muts.R Normal file → Executable file
View file

0
scripts/plotting/or_plots_combined.R Normal file → Executable file
View file

0
scripts/plotting/other_plots_combined.R Normal file → Executable file
View file

0
scripts/plotting/other_plots_data.R Normal file → Executable file
View file

0
scripts/plotting/output_tables.R Normal file → Executable file
View file

0
scripts/plotting/ps_plots_combined.R Normal file → Executable file
View file

0
scripts/plotting/resolving_ambiguous_muts.R Normal file → Executable file
View file

View file

@ -113,12 +113,28 @@ note:
- fb flag has default if not supplied - fb flag has default if not supplied
#=================== #====================================
# Add LINEAGE ONE # lineage_basic_barplots_combined.R
#=================== #====================================
# Lineage_bp.R #-----------------------------------------------------------------------
creates Count and Diversity plot ./lineage_basic_barplots_combined.R-d streptomycin -g gid
#-----------------------------------------------------------------------
It replaces
## lineage_basic_barplot.R
These have been moved to redundant/
sources:
## get_plotting_dfs.R
## functions//bp_lineage.R"
outputs: 1 svg in the plotdir
## basic_lineage_barplots_combined.svg
note:
- fa flag has default if not supplied
- fb flag has default if not supplied
######################################################################## ########################################################################
# TODO # TODO