tidy code and saving work for the day
This commit is contained in:
parent
69e2567ffc
commit
afd6ca8881
6 changed files with 307 additions and 284 deletions
|
@ -46,7 +46,8 @@ indir = datadir + '/' + drug + '/' + 'input'
|
|||
in_filename = 'merged_df3.csv'
|
||||
infile = outdir + '/' + in_filename
|
||||
print('Input filename: ', in_filename
|
||||
, '\nInput path: ', indir)
|
||||
, '\nInput path: ', indir
|
||||
, '\n============================================================')
|
||||
|
||||
#=======
|
||||
# output
|
||||
|
@ -56,7 +57,8 @@ outdir = datadir + '/' + drug + '/' + 'output'
|
|||
out_filename = 'mut_elec_changes.txt'
|
||||
outfile = outdir + '/' + out_filename
|
||||
print('Output filename: ', out_filename
|
||||
, '\nOutput path: ', outdir)
|
||||
, '\nOutput path: ', outdir
|
||||
, '\n============================================================')
|
||||
|
||||
#%% end of variable assignment for input and output files
|
||||
#=======================================================================
|
||||
|
@ -65,10 +67,11 @@ print('Reading input file (merged file):', infile)
|
|||
|
||||
comb_df = pd.read_csv(infile, sep = ',')
|
||||
|
||||
print('Input filename: ', in_filename,
|
||||
'\nPath :', outdir,
|
||||
'\nNo. of rows: ', len(comb_df),
|
||||
'\nNo. of cols: ', infile)
|
||||
print('Input filename: ', in_filename
|
||||
, '\nPath :', outdir
|
||||
, '\nNo. of rows: ', len(comb_df)
|
||||
, '\nNo. of cols: ', infile
|
||||
, '\n============================================================')
|
||||
|
||||
# column names
|
||||
list(comb_df.columns)
|
||||
|
@ -81,15 +84,18 @@ df = comb_df.drop_duplicates(['Mutationinformation'], keep = 'first')
|
|||
|
||||
total_muts = df.Mutationinformation.nunique()
|
||||
#df.Mutationinformation.count()
|
||||
print('Total mutations associated with structure: ', total_muts)
|
||||
print('Total mutations associated with structure: ', total_muts
|
||||
, '\n===============================================================')
|
||||
|
||||
#%% combine aa_calcprop cols so that you can count the changes as value_counts
|
||||
# check if all muts have been categorised
|
||||
print('Checking if all muts have been categorised: ')
|
||||
if df['wt_calcprop'].isna().sum() == 0 & df['mut_calcprop'].isna().sum():
|
||||
print('PASS: No. NA detected i.e all muts have aa prop associated')
|
||||
print('PASS: No. NA detected i.e all muts have aa prop associated'
|
||||
, '\n===============================================================')
|
||||
else:
|
||||
print('FAIL: NAs detected i.e some muts remain unclassified')
|
||||
print('FAIL: NAs detected i.e some muts remain unclassified'
|
||||
, '\n===============================================================')
|
||||
|
||||
df['wt_calcprop'].head()
|
||||
df['mut_calcprop'].head()
|
||||
|
@ -151,11 +157,11 @@ print('======================\n'
|
|||
, '\n============================\n'
|
||||
, all_prop_change)
|
||||
|
||||
print('========================================================================'
|
||||
print('================================================================='
|
||||
, '\nTotal number of electrostatic changes resulting from Mtation is (%):', elec_changes
|
||||
, '\nTotal no. of muts: ', total_muts
|
||||
, '\nTotal no. of changed muts: ', all_prop_change.mut_count.sum()
|
||||
, '\nTotal no. of unchanged muts: ', no_change_muts.mut_count.sum()
|
||||
, '\n=========================================================================')
|
||||
, '\n===================================================================')
|
||||
#%% end of script
|
||||
#=======================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue