sorted combining_dfs.py with all other data files and tidied up get_plotting_dfs.R
This commit is contained in:
parent
4ba4ff602e
commit
5c8a9e8f00
3 changed files with 111 additions and 76 deletions
|
@ -169,25 +169,31 @@ i_join = 'inner'
|
|||
#=====================
|
||||
# some preprocessing
|
||||
#=====================
|
||||
#-------------
|
||||
|
||||
#===========
|
||||
# FoldX
|
||||
#-------------
|
||||
#===========
|
||||
foldx_df.shape
|
||||
#=======================
|
||||
|
||||
#----------------------
|
||||
# scale foldx values
|
||||
#=======================
|
||||
#----------------------
|
||||
# rename ddg column to ddg_foldx
|
||||
foldx_df['ddg']
|
||||
foldx_df = foldx_df.rename(columns = {'ddg':'ddg_foldx'})
|
||||
foldx_df['ddg_foldx']
|
||||
|
||||
# Rescale values in Foldx_change col b/w -1 and 1 so negative numbers
|
||||
# stay neg and pos numbers stay positive
|
||||
foldx_min = foldx_df['ddg'].min()
|
||||
foldx_max = foldx_df['ddg'].max()
|
||||
foldx_min = foldx_df['ddg_foldx'].min()
|
||||
foldx_max = foldx_df['ddg_foldx'].max()
|
||||
foldx_min
|
||||
foldx_max
|
||||
|
||||
foldx_scale = lambda x : x/abs(foldx_min) if x < 0 else (x/foldx_max if x >= 0 else 'failed')
|
||||
|
||||
foldx_df['foldx_scaled'] = foldx_df['ddg'].apply(foldx_scale)
|
||||
print('Raw foldx scores:\n', foldx_df['ddg']
|
||||
foldx_df['foldx_scaled'] = foldx_df['ddg_foldx'].apply(foldx_scale)
|
||||
print('Raw foldx scores:\n', foldx_df['ddg_foldx']
|
||||
, '\n---------------------------------------------------------------'
|
||||
, '\nScaled foldx scores:\n', foldx_df['foldx_scaled'])
|
||||
|
||||
|
@ -195,8 +201,8 @@ print('Raw foldx scores:\n', foldx_df['ddg']
|
|||
fsmi = foldx_df['foldx_scaled'].min()
|
||||
fsma = foldx_df['foldx_scaled'].max()
|
||||
|
||||
c = foldx_df[foldx_df['ddg']>=0].count()
|
||||
foldx_pos = c.get(key = 'ddg')
|
||||
c = foldx_df[foldx_df['ddg_foldx']>=0].count()
|
||||
foldx_pos = c.get(key = 'ddg_foldx')
|
||||
|
||||
c2 = foldx_df[foldx_df['foldx_scaled']>=0].count()
|
||||
foldx_pos2 = c2.get(key = 'foldx_scaled')
|
||||
|
@ -209,20 +215,30 @@ else:
|
|||
, '\nGot:', foldx_pos2
|
||||
, '\n======================================================')
|
||||
|
||||
# rename ddg column to ddg_foldx
|
||||
foldx_df['ddg']
|
||||
foldx_df = foldx_df.rename(columns = {'ddg':'ddg_foldx'})
|
||||
foldx_df['ddg_foldx']
|
||||
#-------------------------
|
||||
# foldx outcome category
|
||||
#--------------------------
|
||||
foldx_df['foldx_outcome'] = foldx_df['ddg_foldx'].apply(lambda x: 'Stabilising' if x >= 0 else 'Destabilising')
|
||||
foldx_df[foldx_df['ddg_foldx']>=0].count()
|
||||
foc = foldx_df['foldx_outcome'].value_counts()
|
||||
|
||||
#-------------
|
||||
if foc['Stabilising'] == foldx_pos and foc['Stabilising'] == foldx_pos2:
|
||||
print('\nPASS: Foldx outcome category created')
|
||||
else:
|
||||
print('\nFAIL: Foldx outcome category could NOT be created'
|
||||
, '\nExpected number:', foldx_pos
|
||||
, '\nGot:', foc[0]
|
||||
, '\n======================================================')
|
||||
sys.exit()
|
||||
|
||||
#=======================
|
||||
# Deepddg
|
||||
#-------------
|
||||
#=======================
|
||||
deepddg_df.shape
|
||||
|
||||
#=======================
|
||||
#-------------------------
|
||||
# scale Deepddg values
|
||||
#=======================
|
||||
|
||||
#-------------------------
|
||||
# Rescale values in deepddg_change col b/w -1 and 1 so negative numbers
|
||||
# stay neg and pos numbers stay positive
|
||||
deepddg_min = deepddg_df['deepddg'].min()
|
||||
|
@ -252,6 +268,23 @@ else:
|
|||
, '\nExpected number:', deepddg_pos
|
||||
, '\nGot:', deepddg_pos2
|
||||
, '\n======================================================')
|
||||
|
||||
#--------------------------
|
||||
# Deepddg outcome category
|
||||
#--------------------------
|
||||
deepddg_df['deepddg_outcome'] = deepddg_df['deepddg'].apply(lambda x: 'Stabilising' if x >= 0 else 'Destabilising')
|
||||
deepddg_df[deepddg_df['deepddg']>=0].count()
|
||||
doc = deepddg_df['deepddg_outcome'].value_counts()
|
||||
|
||||
if doc['Stabilising'] == deepddg_pos and doc['Stabilising'] == deepddg_pos2:
|
||||
print('\nPASS: Deepddg outcome category created')
|
||||
else:
|
||||
print('\nFAIL: Deepddg outcome category could NOT be created'
|
||||
, '\nExpected number:', deepddg_pos
|
||||
, '\nGot:', doc[0]
|
||||
, '\n======================================================')
|
||||
sys.exit()
|
||||
|
||||
#%%=============================================================================
|
||||
# Now merges begin
|
||||
#%%=============================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue