File tree Expand file tree Collapse file tree 2 files changed +447
-3
lines changed
Expand file tree Collapse file tree 2 files changed +447
-3
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ # %%
12from pathlib import Path
23
3- from pyhdx .fileIO import csv_to_dataframe
4+ import pandas as pd
5+ import proplot as pplt
6+ from pymol import cmd
7+
48from pyhdx .config import cfg
9+ from pyhdx .fileIO import csv_to_dataframe
510from pyhdx .plot import (
11+ CMAP_NORM_DEFAULTS ,
12+ ddG_scatter_figure ,
613 dG_scatter_figure ,
714 linear_bars_figure ,
815 rainbowclouds_figure ,
9- ddG_scatter_figure ,
1016)
11- import proplot as pplt
17+ from pyhdx . support import apply_cmap , color_pymol
1218
1319# %%
1420cwd = Path (__file__ ).parent
5460# %%
5561protein_states = plot_data .columns .get_level_values (0 ).unique ()
5662ddG_scatter_figure (plot_data , reference = protein_states [0 ])
63+
64+ # %%
65+ # Creating a colored structure
66+ cmd .load ("https://files.rcsb.org/download/1QYN.pdb" )
67+ cmd .set ("antialias" , 2 )
68+ cmd .set ("fog" , 0 )
69+
70+ # %%
71+ cmd .remove ("resn HOH" ) # This removes only water molecules
72+ cmd .ipython_image ()
73+ # %%
74+ # take dG values for SecB tetramer and reindex (pad with nan)
75+ # such that these regions are correctly colored as no coverage
76+ dG_values = plot_data [("SecB_tetramer" , "dG" )].reindex (pd .RangeIndex (1 , 160 ))
77+
78+ # %%
79+ # create a pandas Series with hexadeicmal codes
80+ cmap , norm = CMAP_NORM_DEFAULTS ["dG" ]
81+ colors = apply_cmap (dG_values , cmap , norm )
82+ colors
83+
84+ # %%
85+ # apply the colors to the pymol structure
86+ color_pymol (colors , cmd )
87+ cmd .ipython_image ()
88+
89+ # %%
90+
91+ # save the output
92+ cmd .png (
93+ "SecB_dG_render.png" ,
94+ width = "10cm" ,
95+ dpi = 300 ,
96+ ray = 1 ,
97+ )
98+
99+
100+ # %%
101+ # rotate for a different view
102+ cmd .rotate ("y" , 90 )
103+ cmd .ipython_image ()
You can’t perform that action at this time.
0 commit comments