From e822f9f6901e1c9864fbb32d4f5aaecd0634ba9f Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Thu, 24 Jun 2021 10:02:14 +0100 Subject: [PATCH] added first line to all func to run from --- scripts/functions/aa_prop_bp.R | 3 +-- scripts/functions/myaf_or_calcs.R | 4 ++++ scripts/functions/mychisq_or.R | 3 +-- scripts/functions/plotting_data.R | 1 - scripts/functions/test_aa_prop_bp.R | 1 + scripts/functions/test_bp.R | 1 + scripts/functions/test_plotting_data.R | 3 ++- scripts/plotting/logo_multiple_muts.R | 5 +++-- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/functions/aa_prop_bp.R b/scripts/functions/aa_prop_bp.R index 3eb9da6..3915c52 100644 --- a/scripts/functions/aa_prop_bp.R +++ b/scripts/functions/aa_prop_bp.R @@ -1,3 +1,4 @@ +#!/usr/bin/env Rscript library(ggplot2) library(tidyverse) library(data.table) @@ -18,5 +19,3 @@ aa_prop_bp <- function(plotdf , name = leg_name) return(mp) } - - diff --git a/scripts/functions/myaf_or_calcs.R b/scripts/functions/myaf_or_calcs.R index 484c907..78acc84 100644 --- a/scripts/functions/myaf_or_calcs.R +++ b/scripts/functions/myaf_or_calcs.R @@ -1,3 +1,7 @@ +#!/usr/bin/env Rscript +######################################################################## +# TASK:calculate af and or for gwas data +######################################################################## my_afor <- function ( drug , gene , infile_master diff --git a/scripts/functions/mychisq_or.R b/scripts/functions/mychisq_or.R index a7b2ac5..4b1c664 100644 --- a/scripts/functions/mychisq_or.R +++ b/scripts/functions/mychisq_or.R @@ -9,5 +9,4 @@ mychisq_or = function(dst_numeric, mut_numeric){ d = tab[1,1] if (d==0){ d<-0.5} (a/b)/(c/d) - -} +} \ No newline at end of file diff --git a/scripts/functions/plotting_data.R b/scripts/functions/plotting_data.R index cdcd8b3..73f450c 100755 --- a/scripts/functions/plotting_data.R +++ b/scripts/functions/plotting_data.R @@ -117,7 +117,6 @@ all_df = list(my_df, my_df_u, my_df_u_lig, dup_muts) return(all_df) } - ######################################################################## # end of data extraction and cleaning for plots # ######################################################################## diff --git a/scripts/functions/test_aa_prop_bp.R b/scripts/functions/test_aa_prop_bp.R index e793091..fa1a218 100644 --- a/scripts/functions/test_aa_prop_bp.R +++ b/scripts/functions/test_aa_prop_bp.R @@ -1,3 +1,4 @@ +#!/usr/bin/env Rscript library(ggplot2) library(tidyverse) library(data.table) diff --git a/scripts/functions/test_bp.R b/scripts/functions/test_bp.R index a2071c4..dc57452 100644 --- a/scripts/functions/test_bp.R +++ b/scripts/functions/test_bp.R @@ -1,3 +1,4 @@ +#!/usr/bin/env Rscript setwd("~/git/LSHTM_analysis/scripts/functions/") getwd() ############################################################# diff --git a/scripts/functions/test_plotting_data.R b/scripts/functions/test_plotting_data.R index 80e88da..9822d09 100644 --- a/scripts/functions/test_plotting_data.R +++ b/scripts/functions/test_plotting_data.R @@ -1,3 +1,4 @@ +#!/usr/bin/env Rscript getwd() setwd("~/git/LSHTM_analysis/scripts/functions/") getwd() @@ -26,4 +27,4 @@ my_df = pd_df[[1]] my_df_u = pd_df[[2]] my_df_u_lig = pd_df[[3]] dup_muts = pd_df[[4]] -#=============================================================== \ No newline at end of file +#=============================================================== diff --git a/scripts/plotting/logo_multiple_muts.R b/scripts/plotting/logo_multiple_muts.R index 8d645f8..bffd286 100755 --- a/scripts/plotting/logo_multiple_muts.R +++ b/scripts/plotting/logo_multiple_muts.R @@ -102,8 +102,9 @@ plot_logo_multiple_muts = paste0(plotdir,"/", logo_multiple_muts) #%%%%%%%%%%%%%%%%%%%%%%%%%%%% # REASSIGNMENT -my_df = merged_df3 +my_df = merged_df3 #%%%%%%%%%%%%%%%%%%%%%%%%%%%% + colnames(my_df) str(my_df) @@ -113,7 +114,7 @@ c1 = unique(my_df$position) nrow(my_df) # get freq count of positions so you can subset freq<1 -require(data.table) +#require(data.table) setDT(my_df)[, mut_pos_occurrence := .N, by = .(position)] #189, 36 table(my_df$position)