updated kd.py to relfect a merging col for combining num params later

This commit is contained in:
Tanushree Tunstall 2020-03-25 15:20:54 +00:00
parent d44ab57f5a
commit 37e1d43b76
3 changed files with 137 additions and 82 deletions

View file

@ -7,29 +7,25 @@ Created on Tue Aug 6 12:56:03 2019
'''
# FIXME: import dirs.py to get the basic dir paths available
#%% load libraries
###################
# load libraries
import os, sys
import pandas as pd
#import numpy as np
#====================================================
#=======================================================================
# TASK: calculate how many mutations result in
# electrostatic changes wrt wt
# Input: mcsm and AF_OR file
# Output: mut_elec_changes_results.txt
#========================================================
#=======================================================================
#%% load libraries
import os, sys
import pandas as pd
#import numpy as np
#%% specify homedir as python doesn't recognise tilde
homedir = os.path.expanduser('~')
# my working dir
# set working dir
os.getcwd()
os.chdir(homedir + '/git/LSHTM_analysis/meta_data_analysis')
os.getcwd()
#========================================================
#=======================================================================
#%% variable assignment: input and output paths & filenames
drug = 'pyrazinamide'
gene = 'pncA'
@ -41,28 +37,29 @@ gene_match = gene + '_p.'
#indir = 'git/Data/pyrazinamide/input/original'
datadir = homedir + '/' + 'git/Data'
#==========
# input dir
#==========
#=======
# input
#=======
indir = datadir + '/' + drug + '/' + 'input'
in_filename = 'merged_df3.csv'
infile = outdir + '/' + in_filename
print('Input filename: ', in_filename
, '\nInput path: ', indir)
#============
# output dir
#============
# several output files
#=======
# output
#=======
outdir = datadir + '/' + drug + '/' + 'output'
# specify output file
out_filename = 'mut_elec_changes.txt'
outfile = outdir + '/' + out_filename
print('Output path: ', outdir)
print('Output filename: ', out_filename
, '\nOutput path: ', outdir)
#%% end of variable assignment for input and output files
#=============================================================
#=======================================================================
#%% Read input files
#in_filename = gene.lower() + '_meta_data_with_AFandOR.csv'
in_filename = 'merged_df3.csv'
infile = outdir + '/' + in_filename
print('Reading input file (merged file):', infile)
comb_df = pd.read_csv(infile, sep = ',')