added script to test af_or_calcs
This commit is contained in:
parent
931f8ec2f9
commit
7686aa39b4
3 changed files with 55 additions and 0 deletions
55
scripts/functions/test_af_or_calcs.R
Normal file
55
scripts/functions/test_af_or_calcs.R
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/env Rscript
|
||||||
|
#########################################################
|
||||||
|
# TASK: To calculate Allele Frequency and
|
||||||
|
# Odds Ratio from master data
|
||||||
|
#########################################################
|
||||||
|
# load libraries
|
||||||
|
#source("Header_TT.R")
|
||||||
|
require("getopt", quietly = TRUE) # cmd parse arguments
|
||||||
|
|
||||||
|
|
||||||
|
# load functions
|
||||||
|
source("functions/plotting_globals.R")
|
||||||
|
source("functions/mychisq_or.R")
|
||||||
|
source("functions/myaf_or_calcs.R")
|
||||||
|
|
||||||
|
# cmd options + sensible defaults
|
||||||
|
drug = "streptomycin"
|
||||||
|
gene = "gid"
|
||||||
|
|
||||||
|
# call function
|
||||||
|
import_dirs(drug, gene)
|
||||||
|
|
||||||
|
# input file 1: master data
|
||||||
|
#in_filename_master = 'original_tanushree_data_v2.csv' #19K
|
||||||
|
in_filename_master = 'mtb_gwas_meta_v6.csv' #35k
|
||||||
|
infile_master = paste0(datadir, in_filename_master)
|
||||||
|
cat(paste0('Reading infile1: raw data', ' ', infile_master) )
|
||||||
|
|
||||||
|
# input file 2: gene associated meta data file to extract valid snps and add calcs to.
|
||||||
|
# This is outfile_metadata from data_extraction.py
|
||||||
|
in_filename_metadata = paste0(tolower(gene), '_metadata.csv')
|
||||||
|
infile_metadata = paste0(outdir, '/', in_filename_metadata)
|
||||||
|
cat(paste0('Reading input file 2 i.e gene associated metadata:', infile_metadata))
|
||||||
|
|
||||||
|
# out_filename_af_or = paste0(tolower(gene), '_meta_data_with_AF_OR.csv')
|
||||||
|
out_filename_af_or = paste0(tolower(gene), '_af_or.csv')
|
||||||
|
outfile_af_or = paste0(outdir, '/', out_filename_af_or)
|
||||||
|
cat(paste0('Output file with full path:', outfile_af_or))
|
||||||
|
|
||||||
|
cat("master data:", infile_master)
|
||||||
|
cat("gene data:", infile_metadata)
|
||||||
|
|
||||||
|
dr_muts_col # comes from global (dr_mutations_<drug>)
|
||||||
|
other_muts_col # comes from global (other_mutations_<drug>)
|
||||||
|
#################################################
|
||||||
|
my_afor ( infile_master
|
||||||
|
, infile_metadata
|
||||||
|
, outfile = outfile_af_or
|
||||||
|
#, outfile = "FOO_TEST.csv"
|
||||||
|
, drug
|
||||||
|
, gene
|
||||||
|
, idcol = "id"
|
||||||
|
, dr_muts_col
|
||||||
|
, other_muts_col
|
||||||
|
)
|
Loading…
Add table
Add a link
Reference in a new issue