choderalab / protons

OpenMM testbed for constant-pH methodologies.
http://protons.readthedocs.io/
MIT License
20 stars 13 forks source link

Tweak plots #114

Closed bas-rustenburg closed 7 years ago

bas-rustenburg commented 7 years ago

Based on some preferences, plotting functions were updated.

What:

Also, here is an example script, which updates labels among other things specific to the Abl:Imatinib application.

from netCDF4 import Dataset
from protons.app import analysis
from matplotlib import pyplot as plt
ds = Dataset("Abl-Imatinib-full.nc", mode='r')
ylabels = (ds['Protons/Metadata/residue_name'][:])
for i,y in enumerate(ylabels):
   # leave out first 16 characters, which contain "Chain X Residue"
    ylabels[i] = y[16:]

x = analysis.plot_tautomer_heatmap(ds)
# Label by residue name
plt.yticks(list(y -0.5 for y  in range(1,len(ylabels)+1)), ylabels, size='small', rotation=0)
plt.xticks(range(25,231,25), list(x *0.020 for x in range(25,231,25)), size='small', rotation=0)
plt.xlabel("Time (ns)")
plt.title("Abl:Imatinib residue charge (color) and tautomers (shade)")
plt.gca().invert_yaxis() # lowest residue number at the top. 
plt.show()

Example plot: tautomers_abl_residues_projectors.pdf

jchodera commented 7 years ago

You might post the example plots in this PR for reference!

Thanks!

bas-rustenburg commented 7 years ago

Merging this because I tested the new functionality locally.

bas-rustenburg commented 7 years ago

Some more examples of functionality.

state_abl_residues calibration_states_imatinib_solvent

gk_calibration_imatinib_solvent