Neurotoxicity Risk Assessment Dashboard

DrugBank database
MolPort database
Python script number 56 to build the frequency distribution graph of the Neurotoxicity parameter on DrugBank molecules.
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
import numpy as np

# 1. Neurotoxicity Data
bin_centers = [-3.6, -3.4, -3.2, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2]

frequencies = [0.08, 0.20, 2.67, 9.75, 13.75, 17.11, 17.92, 19.17, 14.16, 3.40, 0.93, 0.61, 0.12, 0.04, 0.00, 0.00, 0.00, 0.00, 0.04, 0.04]

# 2. Gaussian Parameters (Provided)
amplitude = 19.98
mean = -2.428
sd = 0.4104

# Generate smooth curve
x_smooth = np.linspace(min(bin_centers), max(bin_centers), 300)
y_smooth = amplitude * np.exp(-0.5 * ((x_smooth - mean) / sd)**2)

# 3. Colors (Safety Traffic Light)
colors = []
for val in bin_centers:
    if val < -2.0:
        colors.append('mediumseagreen')
    elif val > -1.5:
        colors.append('firebrick')
    else:
        colors.append('gold')

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

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

# B. Gaussian curve
plt.plot(x_smooth, y_smooth, color='orange', linewidth=2, label='Gaussian Fit')

# 5. Tags and Titles
plt.xlabel('Neurotoxicity Score (PLD50) [Lower is Safer]', fontsize=12)
plt.ylabel('% Frequency', fontsize=12)
plt.title('Neurotoxicity Risk Assessment', fontsize=14)

# Axle settings
plt.xticks(np.arange(-3.6, 0.4, 0.4))
plt.xlim(-3.8, 0.4)
plt.ylim(0, 34)

# 6. Legend
legend_elements = [
    Patch(facecolor='mediumseagreen', edgecolor='black', alpha=0.7, label='Low Risk / Safe (Score < -2.0)'),
    Patch(facecolor='gold', edgecolor='black', alpha=0.7, label='Moderate Risk / Neuroactive (-2.0 to -1.5)'),
    Patch(facecolor='firebrick', edgecolor='black', alpha=0.7, label='High Neurotoxicity Potential (Score > -1.5)'),
    Line2D([0], [0], color='orange', lw=2, label=f'Fit (Mean={mean}, SD={sd})'),
]

plt.legend(handles=legend_elements, loc='upper right', ncol=1, framealpha=0.9)

plt.grid(axis='y', linestyle='--', alpha=0.5)
plt.tight_layout()

plt.show()