added untracked files in scripts and dynamut
This commit is contained in:
parent
00b84ccb1c
commit
3ab6a3dbc1
6 changed files with 1187 additions and 0 deletions
63
scripts/functions/test_aa_prop_bp.R
Normal file
63
scripts/functions/test_aa_prop_bp.R
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env Rscript
|
||||
library(ggplot2)
|
||||
library(tidyverse)
|
||||
library(data.table)
|
||||
|
||||
setwd("~/git/LSHTM_analysis/scripts/functions/")
|
||||
getwd()
|
||||
#############################################################
|
||||
#===========================================
|
||||
# load functions, data, dirs, hardocded vars
|
||||
# that will be used in testing the functions
|
||||
#===========================================
|
||||
source("plotting_data.R")
|
||||
infile = "/home/tanu/git/Data/streptomycin/output/"
|
||||
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]]
|
||||
|
||||
source("../plotting_globals.R")
|
||||
drug = "streptomycin"
|
||||
gene = "gid"
|
||||
|
||||
import_dirs(drug, gene)
|
||||
|
||||
#=====================
|
||||
# functions to test
|
||||
#=====================
|
||||
source("stability_count_bp.R")
|
||||
source("position_count_bp.R")
|
||||
#################################################################
|
||||
##############################################
|
||||
# read a sample file containing muts and prop
|
||||
###############################################
|
||||
df<- read.csv(file.choose())
|
||||
|
||||
setDT(df)[, pos_count := .N, by = .(position)]
|
||||
foo = data.frame(df$position, df$pos_count)
|
||||
|
||||
#snpsBYpos_df <- df %>%
|
||||
# group_by(position) %>%
|
||||
# summarize(snpsBYpos = mean(pos_count))
|
||||
|
||||
# subset df without duplicates for position
|
||||
df2 = df[!duplicated(df$position)]
|
||||
##################################################################
|
||||
# ---------------------------------------
|
||||
# barplot for nssnps, coloured by aa prop
|
||||
# ---------------------------------------
|
||||
pos_colname = "position"
|
||||
aa_prop_colname = "mut_prop_water"
|
||||
aa_prop_colours = c("black", "blue")
|
||||
my_legname = "aa_prop: water"
|
||||
|
||||
# call function
|
||||
aa_prop_bp(plotdf = df
|
||||
, position_colname = pos_colname
|
||||
, fill_colname = aa_prop_colname
|
||||
, fill_colours = aa_prop_cols
|
||||
, leg_name = my_legname)
|
||||
|
||||
#===============================================================
|
Loading…
Add table
Add a link
Reference in a new issue