@@ -89,7 +89,14 @@ class CytoscapeVisualizer(Visualizer):
8989 >>> visualizer.draw_for_scaffold('c1ccc(CNc2ccccc2)cc1')
9090
9191 """
92- def __init__ (self , graph , style = None , refresh_images = False ):
92+ def __init__ (
93+ self ,
94+ graph ,
95+ style = None ,
96+ refresh_images = False ,
97+ rd_draw_options = None ,
98+ mol_img_size = (350 , 300 ),
99+ ):
93100 """Initialize the cytoscape visualizer.
94101
95102 Parameters
@@ -106,13 +113,24 @@ def __init__(self, graph, style=None, refresh_images=False):
106113 If True remove all embeded images from the
107114 input graph and regenerate when required.
108115 The default is False.
116+ rd_draw_options: rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions, optional
117+ Specify options for molecule drawing. Requires a
118+ `MolDrawOptions` object or `None`.
119+ The default is None.
120+ mol_img_size: tuple, optional
121+ Specify the size of the node images. Format is
122+ `(width, height)`. Note that if changed from
123+ default the style will have to be updated.
124+ The default is `(350, 300)`.
109125
110126 """
111127 super (CytoscapeVisualizer , self ).__init__ (
112128 graph ,
113129 requires_tree = False ,
114130 refresh_images = refresh_images ,
115131 )
132+ self ._drawopts = rd_draw_options
133+ self ._img_size = mol_img_size
116134 self ._style = style if style else read_style_file (DEFAULT_STYLE )
117135
118136 @property
@@ -135,7 +153,11 @@ def _draw(self, subgraph, layout_kwargs):
135153 """Private: create the cytoscape widget from a subgraph."""
136154 if subgraph .number_of_nodes () >= 100 :
137155 warnings .warn ('graphs with > 100 nodes may be slow to render' )
138- embed_node_mol_images (subgraph )
156+ embed_node_mol_images (
157+ subgraph ,
158+ size = self ._img_size ,
159+ draw_options = self ._drawopts ,
160+ )
139161 layout = {}
140162 layout .update (DEFAULT_LAYOUT )
141163 if layout_kwargs :
0 commit comments