hERG (30µM): High Concentration Stress Test Dashboard

DrugBank database
MolPort database
Python script number 60 to build the frequency distribution graph of the hERG_30uM parameter on DrugBank molecules.
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import numpy as np
from scipy.interpolate import make_interp_spline

# hERG Inhibitor (Threshold 30 µM) Data
bin_centers = [0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 
               0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.0]

frequencies = [0.04, 2.91, 6.63, 8.17, 8.09, 5.30, 4.49, 3.76, 2.55, 
               2.83, 1.58, 2.18, 2.35, 2.83, 3.24, 3.32, 3.32, 4.45, 6.15, 12.94, 12.86]

# Smoothing
x_smooth = np.linspace(min(bin_centers), max(bin_centers), 300)
spl = make_interp_spline(bin_centers, frequencies, k=3)
y_smooth = spl(x_smooth)
y_smooth = [val if val > 0 else 0 for val in y_smooth] 

# COLORS: We use the same logic as in 1uM but "diluted"
# Dark red (1uM) -> Light red/Salmon (30uM) to indicate that it is less serious.
colors = []
for val in bin_centers:
    if val < 0.25:
        colors.append('mediumseagreen')
    elif val > 0.8:
        colors.append('lightcoral')
    else:
        colors.append('moccasin')

# Create the chart
plt.figure(figsize=(7, 6))

# Bars
plt.bar(bin_centers, frequencies, width=0.04, color=colors, edgecolor='black', alpha=0.8, label='Data Frequency')

# Tags
plt.xlabel('Probability of hERG Inhibition (IC50 < 30µM)', fontsize=12)
plt.ylabel('% Frequency', fontsize=12)
plt.title('hERG (30µM): High Concentration Stress Test', fontsize=14)

plt.xticks(np.arange(0.0, 1.05, 0.1))
plt.xlim(-0.05, 1.05)
plt.ylim(0, 40)

legend_elements = [
    Patch(facecolor='mediumseagreen', edgecolor='black', label='Highly Safe'),
    Patch(facecolor='moccasin', edgecolor='black', label='Intermediate'),
    Patch(facecolor='lightcoral', edgecolor='black', label='High Affinity (Common but Caution)'),
]

plt.legend(handles=legend_elements, loc='upper left', framealpha=0.95, ncol=1, fontsize=10)
plt.grid(axis='y', linestyle='--', alpha=0.5)
plt.tight_layout()
plt.show()