Skip to content

Commit

Permalink
Updating GUI and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
armenbeck committed Dec 20, 2024
1 parent 710d468 commit cfc24e2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions LICENSES_THIRD_PARTY
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ click-log 0.4.0 MIT License
colorama 0.4.6 BSD License
contourpy 1.2.0 BSD License
cycler 0.11.0 BSD License
dash 2.18.2 MIT License
et-xmlfile 1.1.0 MIT License
fonttools 4.25.0 MIT License
future 1.0.0 MIT License
Expand All @@ -33,6 +34,7 @@ openpyxl 3.0.10 MIT License
packaging 23.2 Apache Software License; BSD License
pandas 2.1.4 BSD License
pillow 10.2.0 Historical Permission Notice and Disclaimer (HPND)
plotly 5.24.1. MIT License
ply 3.11 BSD
point-cloud-utils 0.30.4 MIT License
pynndescent 0.5.10 BSD
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,17 @@ python -m dedenser dedense -dw -200 --SHOW -o data/ZINC_sc_d30w-200 -t 0.3 data/
![clust](data/sc_clust_down_w-200.svg)

The weighting may require some manual tuning depending on what is desired by the user.

## Dash-app

A dash-app can be locally hosted and used to test and visualize various downsampling parameters.

The command for intializing the dash-app is:

```
python -m dedenser Dash-app c data/doyle_cloud.npy data/doyle_cloud.csv
Dash is running on http://127.0.0.1:8050/
```

The app is then ready to be used in a web browser of choosing:
![dash](data/dash-app.png)
Binary file added data/dash-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 4 additions & 9 deletions dedenser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ def display_click_data(clickData):
if clickData is None:
return ''

# Extracting the relevant data from clickData
point_info = clickData['points'][0] # Get the first point data
point_info = clickData['points'][0]

# Extract UMAP coordinates
umap_1 = point_info['x']
Expand Down Expand Up @@ -282,21 +281,19 @@ def create_mol_plot(smiles):
Output('basic-interactions', 'figure'),
Output('update-button', 'n_clicks'),
Input('update-button', 'n_clicks'),
Input('d-input', 'value'), # Get the input value for Target
Input('m-input', 'value'), # Get the input value for Min. Size
Input('d-input', 'value'),
Input('m-input', 'value'),
Input('e-input', 'value'),
Input('strict-options', 'value'),
Input('w-options', 'value'),
Input('weight', 'value'),
Input('basic-interactions', 'figure'),
prevent_initial_call=True, # Get the input value for Epsilon
prevent_initial_call=True,
)
def update_plot(n_clicks, t_value, m_value, e_value, s_value, w_bool, w_val, figure):
# Validate that all input values are provided
print(t_value,m_value,e_value)
if not n_clicks is None:
if n_clicks > 0 and None not in (t_value, m_value, e_value):
print('hello')
d_weight,v_weight = None, None
if s_value == 'STRICT2':
strict = True
Expand Down Expand Up @@ -335,9 +332,7 @@ def update_plot(n_clicks, t_value, m_value, e_value, s_value, w_bool, w_val, fig
return fig, None
return figure, None
else:
print(figure)
return figure, None
print('did not return right')

@app.callback(
Output('rdkit-display', 'src'),
Expand Down
1 change: 0 additions & 1 deletion dedenser/dedenser.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class Dedenser( ):
def __init__(self,data=None, target=.5, random_seed=1, alpha=False,
min_size = 5, d_weight = None, v_weight = None, epsilon=0.0,
strict=False, show=False, GUI=False):
print(len(data[0]))
if target in (0, 1):
raise ValueError(f'Target can not be {target}.')
if target > 1 or target < 0:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ click==8.1.7
click-log==0.4.0
contourpy==1.1.1
cycler==0.12.1
dash==2.18.2
et-xmlfile==1.1.0
fonttools==4.47.2
importlib-metadata==7.0.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def find_package_data(packages):


install_requires=['numpy>=1.24.4','pandas','openpyxl', 'mordred>=1.2.0', 'rdkit', 'scikit-learn>=1.3.0', 'alphashape>=1.3.1', 'scipy>=1.10.1',
'point-cloud-utils==0.30.4', 'umap-learn>=0.5.5', 'matplotlib', 'future', 'plotly']
'point-cloud-utils==0.30.4', 'umap-learn>=0.5.5', 'matplotlib', 'future', 'plotly', 'dash']

setup(
name = 'dedenser',
Expand Down

0 comments on commit cfc24e2

Please sign in to comment.