py4cytoscape.annotations.update_annotation_shape¶
-
update_annotation_shape
(type=None, custom_shape=None, annotation_name=None, x_pos=None, y_pos=None, angle=None, fill_color=None, opacity=None, border_thickness=None, border_color=None, border_opacity=None, height=None, width=None, name=None, canvas=None, z_order=None, network=None, base_url='http://127.0.0.1:1234/v1')[source]¶ Update Shape Annotation
Updates a shape annotation in a Cytoscape network view. The object will also be updated in the Annotation Panel in the GUI.
- Parameters
type (str) – The type of the shape, default is RECTANGLE. See get_node_shapes() for valid options.
custom_shape (str) – If a custom shape, this is the text of the shape
annotation_name (UUID or str) – Name of annotation by UUID or name
x_pos (int) – X position in pixels from left; default is center of current view
y_pos (int) – Y position in pixels from top; default is center of current view
angle (float) – Angle of text orientation; default is 0.0 (horizontal)
fill_color (str) – hexadecimal color; default is #000000 (black)
opacity (int) – Opacity of fill color. Must be an integer between 0 and 100; default is 100
border_thickness (int) – non-negative integer
border_color (str) – hexadecimal color; default is #000000 (black)
border_opacity (int) – Integer between 0 and 100; default is 100
height (int) – Height of bounding shape; default is based on text height
width (int) –
name (str) – Name of annotation object; default is “Text”
canvas (str) – Canvas to display annotation, i.e., foreground (default) or background
z_order (int) – Arrangement order specified by number (larger values are in front of smaller values); default is 0
network (SUID or str or None) – Name or SUID of the network. Default is the “current” network active in Cytoscape.
base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
- Returns
A named list of annotation properties, including UUID
- Return type
dict
- Raises
CyError – if network name doesn’t exist or error in parameter value
requests.exceptions.HTTPError – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> update_annotation_shape(annotation_name='ann1 name', name='new name') {'edgeThickness': '1.0', 'canvas': 'foreground', 'fillOpacity': '100.0', 'rotation': '0.0', 'type': 'org.cytoscape.view.presentation.annotations.ShapeAnnotation', 'uuid': '8233e035-d116-4048-9bfb-62334a500829', 'shapeType': 'RECTANGLE', 'edgeColor': '#000000', 'edgeOpacity': '100.0', 'name': 'new name', 'x': '2449.9784057344455', 'width': '100.0', 'y': '1882.9888145962157', 'z': '0', 'height': '100.0'} >>> update_annotation_shape(type='DIAMOND', custom_shape=None, annotation_name='new name', x_pos=101, y_pos=202, angle=90, fill_color='#F0F0F1', opacity=51, border_thickness=3, border_color='#0F0F0E', border_opacity=76, height=31, width=32, name='ann1a name', canvas='background') {'edgeThickness': '3.0', 'canvas': 'background', 'fillOpacity': '51.0', 'rotation': '90.0', 'type': 'org.cytoscape.view.presentation.annotations.ShapeAnnotation', 'uuid': 'eba7198e-2cba-48d7-bc8b-273ee4b26831', 'fillColor': '#F0F0F1', 'shapeType': 'RECTANGLE', 'edgeColor': '#0F0F0E', 'edgeOpacity': '76.0', 'name': 'ann1a name', 'x': '101.0', 'width': '32.0', 'y': '202.0', 'z': '0', 'height': '31.0'}