Update app.py
Browse files
app.py
CHANGED
@@ -269,9 +269,7 @@ def plot_properties_dashboard(df: pd.DataFrame):
|
|
269 |
("Category", "@Category")
|
270 |
])
|
271 |
|
272 |
-
# --- MODIFICATION ---
|
273 |
# Common plot configuration - responsive plots with no background fill
|
274 |
-
# Removed fixed width/height and changed sizing_mode to 'scale_width'
|
275 |
plot_config = {
|
276 |
'tools': [hover, 'pan,wheel_zoom,box_zoom,reset,save'],
|
277 |
'sizing_mode': 'scale_width',
|
@@ -340,11 +338,18 @@ def plot_properties_dashboard(df: pd.DataFrame):
|
|
340 |
|
341 |
style_plot(p2, "Hydrogen Bond Donors", "Hydrogen Bond Acceptors", "Lipinski Rule: Hydrogen Bonding")
|
342 |
|
343 |
-
#
|
|
|
344 |
p3 = figure(title="Molecular Flexibility & Polarity", **plot_config)
|
345 |
p3.scatter('TPSA', 'RotBonds', source=source, legend_group='Category',
|
346 |
color=color_mapper, size=12, alpha=0.8, line_color='white', line_width=0.5)
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
style_plot(p3, "Topological Polar Surface Area (Ų)", "Rotatable Bonds", "Drug Permeability Indicators")
|
349 |
|
350 |
# Plot 4: Enhanced Donut Chart
|
@@ -407,9 +412,7 @@ def plot_properties_dashboard(df: pd.DataFrame):
|
|
407 |
p4.axis.visible = False
|
408 |
p4.grid.visible = False
|
409 |
|
410 |
-
# --- MODIFICATION ---
|
411 |
# Create responsive grid layout
|
412 |
-
# Changed sizing_mode to 'scale_width' to make the grid responsive
|
413 |
grid = gridplot([[p1, p2], [p3, p4]], sizing_mode='scale_width',
|
414 |
toolbar_location='right', merge_tools=True)
|
415 |
|
|
|
269 |
("Category", "@Category")
|
270 |
])
|
271 |
|
|
|
272 |
# Common plot configuration - responsive plots with no background fill
|
|
|
273 |
plot_config = {
|
274 |
'tools': [hover, 'pan,wheel_zoom,box_zoom,reset,save'],
|
275 |
'sizing_mode': 'scale_width',
|
|
|
338 |
|
339 |
style_plot(p2, "Hydrogen Bond Donors", "Hydrogen Bond Acceptors", "Lipinski Rule: Hydrogen Bonding")
|
340 |
|
341 |
+
# --- MODIFICATION ---
|
342 |
+
# Plot 3: TPSA vs Rotatable Bonds with guidelines
|
343 |
p3 = figure(title="Molecular Flexibility & Polarity", **plot_config)
|
344 |
p3.scatter('TPSA', 'RotBonds', source=source, legend_group='Category',
|
345 |
color=color_mapper, size=12, alpha=0.8, line_color='white', line_width=0.5)
|
346 |
|
347 |
+
# Add permeability guideline lines
|
348 |
+
p3.line([140, 140], [df['RotBonds'].min()-1, df['RotBonds'].max()+1],
|
349 |
+
line_dash="dashed", line_color="#FFD700", line_width=2, alpha=0.7, legend_label="TPSA ≤ 140")
|
350 |
+
p3.line([df['TPSA'].min()-10, df['TPSA'].max()+10], [10, 10],
|
351 |
+
line_dash="dashed", line_color="#FFD700", line_width=2, alpha=0.7, legend_label="RotBonds ≤ 10")
|
352 |
+
|
353 |
style_plot(p3, "Topological Polar Surface Area (Ų)", "Rotatable Bonds", "Drug Permeability Indicators")
|
354 |
|
355 |
# Plot 4: Enhanced Donut Chart
|
|
|
412 |
p4.axis.visible = False
|
413 |
p4.grid.visible = False
|
414 |
|
|
|
415 |
# Create responsive grid layout
|
|
|
416 |
grid = gridplot([[p1, p2], [p3, p4]], sizing_mode='scale_width',
|
417 |
toolbar_location='right', merge_tools=True)
|
418 |
|