added commonly used mutation format for missense muts in the gene_specific nssnp_info file

This commit is contained in:
Tanushree Tunstall 2020-06-24 13:34:35 +01:00
parent a9498f8e08
commit 27a656dba1
4 changed files with 194 additions and 568 deletions

View file

@ -57,12 +57,17 @@ print('Input filename:', in_filename
#%% end of variable assignment for input and output files
#=======================================================================
#%% Read input file
my_aa = pd.read_csv(infile) #20, 6
aa_table = pd.read_csv(infile) #20, 6
#------------------------
#1) 3-letter (lower) code as key
#-------------------------
# assign the one_letter code as the row names so that it is easier to create
# a dict of dicts using index
#my_aa = pd.read_csv('aa_codes.csv', index_col = 0) #20, 6 #a way to it since it is the first column
my_aa = my_aa.set_index('three_letter_code_lower') #20, 5
my_aa = aa_table.set_index('three_letter_code_lower') #20, 5
my_aa.columns
my_aa.index
#==================
# convert file
@ -75,6 +80,40 @@ my_aa = my_aa.set_index('three_letter_code_lower') #20, 5
my_aa_dict = my_aa.to_dict('index') #20, with 5 subkeys
print('Printing my_aa_dict:', my_aa_dict.keys())
#FIXME : use the below in all code
low_3letter_dict = my_aa.to_dict('index') #20, with 5 subkeys
print('Printing lower-case 3 letter aa dict:',low_3letter_dict.keys())
#------------------------
#2) 1-letter code as key
#-------------------------
aa_1let = aa_table.set_index('one_letter_code') #20, 5
aa_1let.columns
aa_1let.index
oneletter_aa_dict = aa_1let.to_dict('index') #20, with 5 subkeys
print('Printing one letter aa dict:', oneletter_aa_dict.keys())
#------------------------
#3) amino acid name as key
#-------------------------
aa_name = aa_table.set_index('amino_acid_name') #20, 5
aa_name.columns
aa_name.index
aa_name_dict = aa_name.to_dict('index') #20, with 5 subkeys
print('Printing amino acid names aa dict:', aa_name_dict.keys())
#------------------------
#3) 3 letter uppercase as key
#-------------------------
aa_up3let = aa_table.set_index('three_letter_code_upper') #20, 5
aa_up3let.columns
aa_up3let.index
up_3letter_aa_dict = aa_up3let.to_dict('index') #20, with 5 subkeys
print('Printing upper case 3 letter aa dict:', up_3letter_aa_dict.keys())
#================================================
# dict of aa with their corresponding properties
# This is defined twice