Skip to content

Commit e2744c0

Browse files
author
wjm41
committed
Updated docs describing input parameters
1 parent f54464b commit e2744c0

3 files changed

Lines changed: 49 additions & 33 deletions

File tree

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# molplotly
22

3-
<!-- TODO tests -->
4-
53
[![Powered by RDKit](https://img.shields.io/static/v1?label=Powered%20by&message=RDKit&color=3838ff&style=flat&logo=data:image/x-icon;base64,AAABAAEAEBAQAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAMAABILAAASCwAAAAAAAAAAAADc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/FBT/FBT/FBT/FBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/PBT/PBT/PBT/PBT/PBT/PBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/jIz/jIz/jIz/jIz/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nz/FBT/PBT/ZGT/ZGT/jIz/jIz/jIz/jIz/jIz/jIz/ZGT/ZGT/PBT/FBTc3Nzc3Nz/FBT/PBT/ZGT/ZGT/jIz/jIz/tLT/tLT/jIz/jIz/ZGT/ZGT/PBT/FBTc3Nzc3Nz/FBT/PBT/ZGT/ZGT/jIz/jIz/tLT/tLT/jIz/jIz/ZGT/ZGT/PBT/FBTc3Nzc3Nz/FBT/PBT/ZGT/ZGT/jIz/jIz/jIz/jIz/jIz/jIz/ZGT/ZGT/PBT/FBTc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/jIz/jIz/jIz/jIz/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/PBT/ZGT/ZGT/ZGT/ZGT/ZGT/ZGT/PBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/PBT/PBT/PBT/PBT/PBT/PBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/FBT/FBT/FBT/FBT/FBT/FBTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nz/////+B////AP///gB///wAP//4AB//+AAf//gAH//4AB//+AAf//gAH//8AD///gB///8A////gf////////)](https://www.rdkit.org/)
64
[![PyPI version](https://img.shields.io/pypi/v/molplotly)](https://pypi.python.org/pypi/molplotly)
75

@@ -50,37 +48,43 @@ app.run_server(mode='inline', port=8011, height=1000)
5048

5149
#### Input parameters
5250

53-
<!-- TODO update params -->
54-
5551
- `fig` : plotly.graph_objects.Figure object\
56-
a plotly figure object containing datapoints plotted from df
52+
a plotly figure object containing datapoints plotted from `df`.
5753

5854
- `df` : pandas.DataFrame object\
59-
a pandas dataframe that contains the data plotted in fig
55+
a pandas dataframe that contains the data plotted in `fig`.
6056
- `smiles_col` : str, optional\
61-
name of the column in df containing the smiles plotted in fig (default 'SMILES')
57+
name of the column in df containing the smiles plotted in `fig` (default 'SMILES').
6258
- `show_img` : bool, optional\
63-
whether or not to generate the molecule image in the dash app (default True)
59+
whether or not to generate the molecule image in the dash app (default True).
60+
- `svg_size` : float, optional
61+
the size in pixels of the molecule drawing (default 200).
62+
- `alpha` : float, optional\
63+
the transparency of the hoverbox, 0 for full transparency 1 for full opaqueness (default 0.7).
64+
- `mol_alpha` : float, optional\
65+
the transparency of the SVG molecule image, 0 for full transparency 1 for full opaqueness (default 0.7).
6466
- `title_col` : str, optional\
65-
name of the column in df to be used as the title entry in the hover box (default None)
67+
name of the column in df to be used as the title entry in the hover box (default None).
6668
- `show_coords` : bool, optional\
67-
whether or not to show the coordinates of the data point in the hover box (default True)
69+
whether or not to show the coordinates of the data point in the hover box (default True).
6870
- `caption_cols` : list, optional\
69-
list of column names in df to be included in the hover box (default None)
71+
list of column names in df to be included in the hover box (default None).
7072
- `caption_transform` : dict, optional\
71-
Functions applied to specific items in all cells. The dict must follow a key: function structure where the key must correspond to one of the columns in subset or tooltip. (default {})
73+
Functions applied to captions for formatting. The dict must follow a key: function structure where the key must correspond to one of the columns in subset or tooltip (default {}).
7274
- `color_col` : str, optional\
73-
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None)
75+
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None).
76+
- `marker_col` : str, optional\
77+
name of the column in df that is used to determine the marker shape of the datapoints in df (default None).
7478
- `wrap` : bool, optional\
75-
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True)
79+
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True).
7680
- `wraplen` : int, optional\
77-
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20)
81+
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20).
7882
- `width` : int, optional\
79-
the width in pixels of the hover box (default 150)
83+
the width in pixels of the hover box (default 150).
8084
- `fontfamily` : str, optional\
81-
the font family used in the hover box (default 'Arial')
85+
the font family used in the hover box (default 'Arial').
8286
- `fontsize` : int, optional\
83-
the font size used in the hover box - the font of the title line is fontsize+2 (default 12)
87+
the font size used in the hover box - the font of the title line is fontsize+2 (default 12).
8488

8589
#### Output parameters
8690

molplotly/main.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,43 +110,50 @@ def add_molecules(
110110
Attributes
111111
----------
112112
fig : plotly.graph_objects.Figure object
113-
a plotly figure object containing datapoints plotted from df
113+
a plotly figure object containing datapoints plotted from df.
114114
df : pandas.DataFrame object
115-
a pandas dataframe that contains the data plotted in fig
115+
a pandas dataframe that contains the data plotted in fig.
116116
smiles_col : str|list[str], optional
117117
name of the column in df containing the smiles plotted in fig (default 'SMILES').
118118
If provided as a list, will add a slider to choose which column is used for rendering the structures.
119119
show_img : bool, optional
120-
whether or not to generate the molecule image in the dash app (default True)
120+
whether or not to generate the molecule image in the dash app (default True).
121+
svg_size : float, optional
122+
the size in pixels of the molecule drawing (default 200).
123+
alpha : float, optional
124+
the transparency of the hoverbox, 0 for full transparency 1 for full opaqueness (default 0.7).
125+
mol_alpha : float, optional
126+
the transparency of the SVG molecule image, 0 for full transparency 1 for full opaqueness (default 0.7).
121127
title_col : str, optional
122-
name of the column in df to be used as the title entry in the hover box (default None)
128+
name of the column in df to be used as the title entry in the hover box (default None).
123129
show_coords : bool, optional
124-
whether or not to show the coordinates of the data point in the hover box (default True)
130+
whether or not to show the coordinates of the data point in the hover box (default True).
125131
caption_cols : list, optional
126-
list of column names in df to be included in the hover box (default None)
132+
list of column names in df to be included in the hover box (default None).
127133
caption_transform : dict, optional
128134
Functions applied to specific items in all cells. The dict must follow a key: function structure where
129-
the key must correspond to one of the columns in subset or tooltip. (default {})
135+
the key must correspond to one of the columns in subset or tooltip (default {}).
130136
color_col : str, optional
131-
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None)
137+
name of the column in df that is used to color the datapoints in df - necessary when there is discrete conditional coloring (default None).
138+
marker_col : str, optional
139+
name of the column in df that is used to determine the marker shape of the datapoints in df (default None).
132140
wrap : bool, optional
133-
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True)
141+
whether or not to wrap the title text to multiple lines if the length of the text is too long (default True).
134142
wraplen : int, optional
135-
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20)
143+
the threshold length of the title text before wrapping begins - adjust when changing the width of the hover box (default 20).
136144
width : int, optional
137-
the width in pixels of the hover box (default 150)
145+
the width in pixels of the hover box (default 150).
138146
fontfamily : str, optional
139-
the font family used in the hover box (default 'Arial')
147+
the font family used in the hover box (default 'Arial').
140148
fontsize : int, optional
141-
the font size used in the hover box - the font of the title line is fontsize+2 (default 12)
149+
the font size used in the hover box - the font of the title line is fontsize+2 (default 12).
142150
"""
143151
fig.update_traces(hoverinfo="none", hovertemplate=None)
144152
df_data = df.copy()
145153
if color_col is not None:
146154
df_data[color_col] = df_data[color_col].astype(str)
147155
if marker_col is not None:
148156
df_data[marker_col] = df_data[marker_col].astype(str)
149-
150157

151158
if len(fig.data) != 1:
152159
colors = {index: x.marker["color"] for index, x in enumerate(fig.data)}
@@ -164,7 +171,7 @@ def add_molecules(
164171
)
165172
else:
166173
colors = {0: "black"}
167-
174+
168175
app = JupyterDash(__name__)
169176
if isinstance(smiles_col, str):
170177
smiles_col = [smiles_col]

tests/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Tests
2+
3+
Placeholder - tests will be added in future.
4+
5+
<!-- TODO - add tests -->

0 commit comments

Comments
 (0)