alidenewade commited on
Commit
5825c05
·
verified ·
1 Parent(s): fb1bd5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -8
app.py CHANGED
@@ -265,15 +265,23 @@ def plot_properties_dashboard(df: pd.DataFrame):
265
  ("LogP", "@LogP{0.00}"),
266
  ("HBD", "@HBD"),
267
  ("HBA", "@HBA"),
268
- ("TPSA", "@TPSA{0.0} Ų"),
269
  ("Category", "@Category")
270
  ])
271
 
272
- # Common plot configuration - square plots with no background fill
 
 
273
  plot_config = {
274
- 'width': 400, 'height': 400, 'tools': [hover, 'pan,wheel_zoom,box_zoom,reset,save'],
275
- 'sizing_mode': 'fixed', 'background_fill_color': None,
276
- 'border_fill_color': None, 'outline_line_color': '#333333'
 
 
 
 
 
 
277
  }
278
 
279
  def style_plot(p, x_label, y_label, title):
@@ -337,7 +345,7 @@ def plot_properties_dashboard(df: pd.DataFrame):
337
  p3.scatter('TPSA', 'RotBonds', source=source, legend_group='Category',
338
  color=color_mapper, size=12, alpha=0.8, line_color='white', line_width=0.5)
339
 
340
- style_plot(p3, "Topological Polar Surface Area (Ų)", "Rotatable Bonds", "Drug Permeability Indicators")
341
 
342
  # Plot 4: Enhanced Donut Chart
343
  p4_config = plot_config.copy()
@@ -399,8 +407,10 @@ def plot_properties_dashboard(df: pd.DataFrame):
399
  p4.axis.visible = False
400
  p4.grid.visible = False
401
 
 
402
  # Create responsive grid layout
403
- grid = gridplot([[p1, p2], [p3, p4]], sizing_mode='fixed',
 
404
  toolbar_location='right', merge_tools=True)
405
 
406
  return grid, "✅ Generated enhanced molecular properties dashboard."
@@ -497,7 +507,7 @@ def visualize_molecule_2d_3d(smiles: str, name: str):
497
  svg_2d = svg_2d.replace('stroke:#000000', 'stroke:#FFFFFF')
498
  svg_2d = svg_2d.replace('fill:#000000', 'fill:#FFFFFF')
499
  svg_2d = svg_2d.replace('stroke:#000', 'stroke:#FFF')
500
- svg_2d = svg_2d.replace('fill:#000', 'fill:#FFF')
501
  svg_2d = svg_2d.replace('stroke="rgb(0,0,0)"', 'stroke="rgb(255,255,255)"')
502
  svg_2d = svg_2d.replace('fill="rgb(0,0,0)"', 'fill="rgb(255,255,255)"')
503
  svg_2d = svg_2d.replace('stroke:rgb(0,0,0)', 'stroke:rgb(255,255,255)')
 
265
  ("LogP", "@LogP{0.00}"),
266
  ("HBD", "@HBD"),
267
  ("HBA", "@HBA"),
268
+ ("TPSA", "@TPSA{0.0} Ų"),
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',
278
+ 'background_fill_color': None,
279
+ 'border_fill_color': None,
280
+ 'outline_line_color': '#333333',
281
+ 'min_border_left': 50,
282
+ 'min_border_right': 50,
283
+ 'min_border_top': 50,
284
+ 'min_border_bottom': 50
285
  }
286
 
287
  def style_plot(p, x_label, y_label, title):
 
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
351
  p4_config = plot_config.copy()
 
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
 
416
  return grid, "✅ Generated enhanced molecular properties dashboard."
 
507
  svg_2d = svg_2d.replace('stroke:#000000', 'stroke:#FFFFFF')
508
  svg_2d = svg_2d.replace('fill:#000000', 'fill:#FFFFFF')
509
  svg_2d = svg_2d.replace('stroke:#000', 'stroke:#FFF')
510
+ svg_2d = svg_2d.replace('fill:#000', 'fill="#FFF"')
511
  svg_2d = svg_2d.replace('stroke="rgb(0,0,0)"', 'stroke="rgb(255,255,255)"')
512
  svg_2d = svg_2d.replace('fill="rgb(0,0,0)"', 'fill="rgb(255,255,255)"')
513
  svg_2d = svg_2d.replace('stroke:rgb(0,0,0)', 'stroke:rgb(255,255,255)')