From 59430a49ddc6ddb7ff2c499c959a02aba30c5d9d Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Wed, 3 Mar 2021 11:54:48 +0000 Subject: [PATCH] updated counts.py with wt seq counts --- scripts/count.py | 17 +++++++++++++++++ scripts/plotting/ggcorr_all_PS_LIG.R | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/count.py b/scripts/count.py index 9121cda..c82f805 100755 --- a/scripts/count.py +++ b/scripts/count.py @@ -310,3 +310,20 @@ n_stop = tot3/len(meta_data) n_stop*100 #0.11 all_tot = n_del*100 + n_ins*100 + n_stop*100 #1.2 +#%% count pncA WT + +wt_gene = meta_data.loc[meta_data[dr_muts_col].str.contains('WT', na = False, regex = True, case = False) | meta_data[other_muts_col].str.contains('WT', na = False, regex = True, case = False) ] + +meta_data['muts_and_lineage'] = meta_data[dr_muts_col] + meta_data[other_muts_col] + meta_data['lineage'] + +wt_gene_v2 = meta_data.loc[meta_data['muts_and_lineage'].str.contains('*WT*lineage1', na = False, regex = True, case = False)] + + +lin1_wt_gene = wt_gene.loc[wt_gene['lineage'].str.contains('lineage1', na = False, regex = True, case = False)] + +dr_lin1 = wt_gene.groupby(['lineage'])[dr_muts_col].apply(lambda x: x[x.str.contains('WT')].count()) +other_lin1 = wt_gene.groupby(['lineage'])[other_muts_col].apply(lambda x: x[x.str.contains('WT')].count()) + +dr_lin1_v2 = wt_gene.groupby(['lineage'])[dr_muts_col].value_counts() + +other_lin1_v2 = wt_gene.groupby(['lineage'])[other_muts_col].value_counts() diff --git a/scripts/plotting/ggcorr_all_PS_LIG.R b/scripts/plotting/ggcorr_all_PS_LIG.R index d6fe43b..ed68401 100644 --- a/scripts/plotting/ggcorr_all_PS_LIG.R +++ b/scripts/plotting/ggcorr_all_PS_LIG.R @@ -221,7 +221,8 @@ head(my_ggcorr_ps) corr1 <- round(cor(my_ggcorr_ps, method = "spearman", use = "pairwise.complete.obs"), 1) # p-value matrix -pmat1 <- cor_pmat(my_ggcorr_ps, method = "spearman", use = "pairwise.complete.obs") +pmat1 <- cor_pmat(my_ggcorr_ps, method = "spearman", use = "pairwise.complete.obs" + , conf.level = 0.99) corr2 = psych::corr.test(my_ggcorr_ps , method = "spearman"