fmaschietto / mdigest

GNU General Public License v3.0
28 stars 10 forks source link

paths should be corrected #11

Open SnehaBheemireddy1 opened 4 hours ago

SnehaBheemireddy1 commented 4 hours ago

open Pymol locally

from pymol import cmd, util import seaborn as sns import warnings from draw_network_pymol import * warnings.filterwarnings('ignore') cmd.delete('all') cmd.bg_color('black')

place yourself in the visualize_network folder

cd visualize_network

execute pymol locally calling pymol from inside the directory.

provide path to pdb and data_frame data_frame: change accordingly

path = 'mdigest-RESULTS/plots/'

cmd.load(path + '1u2p.pdb', '1u2p') cmd.color('grey80', '1u2p') cmd.remove('!(polymer)') cmd.run('draw_network_pymol.py') cmd.hide('lines', '')

cmd.set_view((\ 0.264859468, -0.952457845, -0.150496021,\ -0.843045175, -0.304483652, 0.443325162,\ -0.468080193, 0.009453356, -0.883612871,\ 0.000000000, 0.000000000, -133.785675049,\ 8.123708725, 6.384021759, 22.244569778,\ 105.477645874, 162.093704224, -20.000000000))

draw_network_from_df(path +'network_Ptpa_Q75L_filter_d_0_5.pkl', which='gcc_Q75L', color_by='gcc_Q75L', sns_palette=sns.color_palette("tab20"), label='gcc_Q75L', edge_norm=1) draw_network_from_df(path + 'network_Ptpa_WT_filter_d_0_5.pkl', which='gcc_WT', color_by='gcc_WT', sns_palette=sns.color_palette("tab20"), label='gcc_WT', edge_norm=1) draw_network_from_df(path +'network_Ptpa_Q75L_filter_d_0_5.pkl', which='dgcc_Q75L', color_by='dgcc_Q75L', sns_palette=sns.color_palette("tab20"), label='dgcc_Q75L', edge_norm=1) draw_network_from_df(path + 'network_Ptpa_WT_filter_d_0_5.pkl', which='dgcc_WT', color_by='dgcc_WT', sns_palette=sns.color_palette("tab20"), label='dgcc_WT', edge_norm=1) draw_network_from_df(path +'network_Ptpa_Q75L_filter_d_0_5.pkl', which='ks_gcc_Q75L', color_by='ks_gcc_Q75L', sns_palette=sns.color_palette("tab20"), label='ks_gcc_Q75L', edge_norm=1) draw_network_from_df(path + 'network_Ptpa_WT_filter_d_0_5.pkl', which='ks_gcc_WT', color_by='ks_gcc_WT', sns_palette=sns.color_palette("tab20"), label='ks_gcc_WT', edge_norm=1)

SnehaBheemireddy1 commented 4 hours ago

Also, key error 156.


KeyError Traceback (most recent call last) Cell In[1], line 32 22 cmd.hide('lines', '*') 24 cmd.set_view((\ 25 0.264859468, -0.952457845, -0.150496021,\ 26 -0.843045175, -0.304483652, 0.443325162,\ (...) 29 8.123708725, 6.384021759, 22.244569778,\ 30 105.477645874, 162.093704224, -20.000000000)) ---> 32 draw_network_from_df(path +'network_Ptpa_Q75L_filter_d_0_5.pkl', which='gcc_Q75L', color_by='gcc_Q75L', sns_palette=sns.color_palette("tab20"), label='gcc_Q75L', edge_norm=1) 33 draw_network_from_df(path + 'network_Ptpa_WT_filter_d_0_5.pkl', which='gcc_WT', color_by='gcc_WT', sns_palette=sns.color_palette("tab20"), label='gcc_WT', edge_norm=1) 34 draw_network_from_df(path +'network_Ptpa_Q75L_filter_d_0_5.pkl', which='dgcc_Q75L', color_by='dgcc_Q75L', sns_palette=sns.color_palette("tab20"), label='dgcc_Q75L', edge_norm=1)

File ~/work/mdigest/draw_network_pymol.py:30, in draw_network_from_df(path_to_df, reset_view, hide_nodes, kwargs) 28 view = cmd.get_view() 29 df = load_df(path_to_df) ---> 30 draw_network(df, kwargs) 31 if reset_view: 32 cmd.set_view(view)

File ~/work/mdigest/draw_network_pymol.py:353, in draw_network(df, key, selection, which, w1, w2, reset_view, default_color, check_nodeIDs, center, label, color_sign, color_by, sns_palette, edge_norm, flattenweight, group_by, r) 350 print("we are at 342", color_sign) 351 #print(len(df.columns),df.columns) 352 #print(df) --> 353 _draw_df(df, label=label, flattenweight=flattenweight)

File ~/work/mdigest/draw_network_pymol.py:254, in draw_network.._draw_df(df, label, default_color, flattenweight) 250 else: 251 color2 = color 252 print("line", CYLINDER, 253 node2CA[row[key[0]]], --> 254 node2CA[row[key[1]]], 255 radius, 256 color, 257 color2) 259 objs += [CYLINDER, 260 node2CA[row[key[0]]], 261 node2CA[row[key[1]]], 262 radius, 263 color, 264 color2] 266 cmd.load_cgo(objs, '{}edges'.format(label))

KeyError: 156