cytoscape / py4cytoscape

Python library for calling Cytoscape Automation via CyREST
https://Py4Cytoscape.readthedocs.io
Other
69 stars 15 forks source link

p4c.layout_network() ++ #78

Closed eirinland closed 2 years ago

eirinland commented 2 years ago

Hello! I can't figure out how (or if it is possible) to use use the Y files organic layout in my script as this is not one of the options for p4c.layout_network. Furthermore, does p4c offer a way of selecting isolated clusters in the network and annotating them? Any help with this is very much appreciated 🙏 Lastly, p4c would be even more amazing (love it already) if a function for creating legends from the mappings (that look nicer and is a bit more customisable than the ones generated by the legend creator app) was created! Thanks for your great work, makes life easier for simple biochemists like me. Best regards, Eirin

bdemchak commented 2 years ago

Hi, Eirin --

Thanks for your very kind words! I'll answer as best I can.

Indeed, the yFiles layouts are very good. While we're very glad to have the yFiles layouts, they are licensed by their owner, yWorks, to Cytoscape under a special license that only covers GUI access. You might contact yWorks to see if it's possible to pay to access yFiles programatically.

Have you considered any of the Cytoscape-native layouts (e.g., Prefuse)? They're all available to py4cytoscape.

I have added a notation in the upcoming py4cytoscape v1.1.0 document to let future users know about this so they don't spend energy looking for yFiles functionality.

Regarding clustering, there are a number of Cytoscape apps that perform this, including MCode and ClusterMaker2. You can see examples of the use of each in https://github.com/bdemchak/cytoscape-jupyter/tree/main/gangsu ... and a section in the manual at https://py4cytoscape.readthedocs.io/en/latest/concepts.html#calling-cytoscape-apps

Did you know that you can execute Python/py4cytoscape in Google Colab? That's how the above workflows execute ... they contact the Cytoscape running on your workstation. This type of functionality works very well for publishing/sharing workflows. Feel free to ask more about this or the workflows themselves.

Feel free to steal from these.

Regarding annotating clusters, there is an annotation API defined for py4cytoscape, but it's not implemented yet. I'm happy to prioritize this for your sake if you'd be interested in verifying that it'll serve your purpose, and then verify its operation once I implement it. Are you interested in this?

You raise an excellent point about the legend creator app. I checked with the authors, and they say that exposing it for automation (e.g., py4cytoscape) is several months away. They do appreciate the question, though, and I think it may influence their priorities.

Comments??

eirinland commented 2 years ago

Thanks for the great reply! Yes, I have used the Prefuse layout. This results in node overlaps which does not occur with the yFiles layout. There is probably a simple way to avoid this, I just haven't figured it out yet.

I will check out the clustering apps mentioned and see if they might aid me, thank you! I will also check out the tutorials.

It would be great to test the mentioned annotation API, I can however ofc do this manually for now if you have more pressing matters to take care of ☺️ I thought I should try to explain what I want to be able to do: The networks I'm working with are "simple" Sequence similarity networks with the aim of discovering new interesting enzyme candidates.

Screenshot 2022-02-01 at 14 53 39

Over is a small screenshot from one of the generated networks using our program. What I mean with annotating the clusters is basically selecting the isolated clusters (or part of one if that is doable) and giving them an appropriate label as shown in the figure (which is easy to do by hand, but not optimal time wise). If it was possible to create annotated subnetworks from that selection aswell (as one also can do manually), that would be awesome. Hope that made sense! Best regards, Eirin

eirinland commented 2 years ago

I realised that I can just use the EFI-EST color SSN feature, and import the cluster numbers generated there and then use these with the CyREST API to use the Autoannotator from my script🙈 There is probably a much "cleaner" way of doing this tough, but at least it worked! Thanks anyway! Best, Eirin

bdemchak commented 2 years ago

Hi, Eirin –

Your annotation need should be fairly straightforward. I’m including (below) the API that RCy3 uses, but translated to what would probably be implemented in Python for py4cytoscape.

The API reflects the operations possible with the Cytoscape GUI … good as far as it goes. However, looking over the API, I see that the annotations are positioned in coordinates on the graph space. Fine, except that those positions aren’t sensitive to wherever the nodes and clusters end up because of the layout. I can imagine solutions to this, but I’d like to alert you so you can weigh in on the importance of the issue or palatable solutions.

Can you use these, and what of the positioning issue?

Summary

=======

function add_annotation_text(text = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, name = None,

                        canvas = None, z_order = None,

                        network = None, base_url = DEFAULT_BASE_URL)

function add_annotation_bounded_text(text = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, type = None,

                        custom_shape = 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 = DEFAULT_BASE_URL)

function add_annotation_image(url = None, x_pos = None, y_pos = None,

                         angle = None, 

                         opacity = None, brightness = None,

                         contrast = 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 = DEFAULT_BASE_URL)

function add_annotation_shape(type = None, custom_shape = 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 = DEFAULT_BASE_URL)

function delete_annotation<-function(names = None, base_url = DEFAULT_BASE_URL)

function get_annotation_list(network = None, base_url = DEFAULT_BASE_URL)

function ungroup_annotation(names = None, network = None, base_url = DEFAULT_BASE_URL)

function group_annotation(names = None, network = None, base_url = DEFAULT_BASE_URL)

function update_annotation_text(text = None, annotation_name = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, name = None,

                        canvas = None, z_order = None,

                        network = None, base_url = DEFAULT_BASE_URL)

function update_annotation_bounded_text(text = None, annotation_name= None, x_pos = None, y_pos = None,

                               font_size = None, font_family = None, font_style = None,

                               color = None, angle = None, type = None,

                               custom_shape = 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 = DEFAULT_BASE_URL)

function 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 = DEFAULT_BASE_URL)

function update_annotation_image(url = None, annotation_name = None, x_pos = None, y_pos = None,

                         angle = None, 

                         opacity = None, brightness = None,

                         contrast = 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 = DEFAULT_BASE_URL)

function update_group_annotation(name = None, annotation_name= None, x_pos = None, y_pos = None,

                             angle = None, canvas = None, z_order = None,

                             network= None, base_url = DEFAULT_BASE_URL)

Details

=======

function add_annotation_text(text = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, name = None,

                        canvas = None, z_order = None,

                        network = None, base_url = DEFAULT_BASE_URL)

Adds a text annotation to a Cytoscape network view. The object will also be added to the

Annotation Panel in the GUI.

            text -- The text to be displayed

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            font_size -- (optional) Numeric value; default is 12

            font_family -- (optional) Font family; default is Arial

            font_style -- (optional) Font style; default is

            color -- (optional) Hexidecimal color; default is #000000 (black) angle (optional) 

                            Angle of text orientation; default is 0.0 (horizontal)

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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


function add_annotation_bounded_text(text = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, type = None,

                        custom_shape = 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 = DEFAULT_BASE_URL)

Adds a bounded text annotation to a Cytoscape network view. The

object will also be added to the Annotation Panel in the GUI.

            text -- The text to be displayed

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            font_size -- (optional) Numeric value; default is 12

            font_family -- (optional) Font family; default is Arial

            font_style -- (optional) Font style; default is

            color -- (optional) Hexidecimal color; default is #000000 (black) angle (optional) 

                            Angle of text orientation; default is 0.0 (horizontal)

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            type -- (optional) The type of the shape, default is RECTANGLE. 

                            See getNodeShapes() for valid options.

            custom_shape -- (optional) If a custom shape, this is the text of the shape

            fill_color -- (optional) Hexidecimal color; default is #000000 (black)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of bounding shape; default is based on text height.

            width -- (optional) Width of bounding shape; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return -- A named list of annotation properties, including UUID


function add_annotation_image(url = None, x_pos = None, y_pos = None,

                         angle = None, 

                         opacity = None, brightness = None,

                         contrast = 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 = DEFAULT_BASE_URL)

Adds a Image annotation to a Cytoscape network view. The object will also be added to

the Annotation Panel in the GUI.

            url -- URL or path to image file. File paths can be absolute or relative to current working directory. 

                            URLs must start with http:// or https://.

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            brightness -- (optional) Image brightness. Must be an integer between 0 and 100; default is 100.

            contrast -- (optional) Image contrast. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of image; default is based on text height.

            width -- (optional) Width of image; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return -- A named list of annotation properties, including UUID


function add_annotation_shape(type = None, custom_shape = 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 = DEFAULT_BASE_URL)

Adds a shape annotation to a Cytoscape network view. The object will also be added to

the Annotation Panel in the GUI.

            type -- (optional) The type of the shape, default is RECTANGLE. See getNodeShapes() for valid options.

            custom_shape -- (optional) If a custom shape, this is the text of the shape

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            fill_color -- (optional) Hexidecimal color; default is #000000 (black)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of image; default is based on text height.

            width -- (optional) Width of image; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url (optional) 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.

return - A named list of annotation properties, including UUID


function delete_annotation<-function(names = None, base_url = DEFAULT_BASE_URL)

Remove an annotation from the current network view in Cytoscape

            names -- List of annotations by UUID or Name

            base_url -- (optional) 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.

return - None


function get_annotation_list(network = None, base_url = DEFAULT_BASE_URL)

A list of named lists with annotation information

            network -- (optional) Name or SUID of the network. Default is the "current" network 

                            active in Cytoscape.

            base_url -- (optional) 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.

return - RETURN_DESCRIPTION


function ungroup_annotation(names = None, network = None, base_url = DEFAULT_BASE_URL)

Ungroup annotation group from the network view in Cytoscape

            names -- Name of annotation group by UUID or Name

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - None


function group_annotation(names = None, network = None, base_url = DEFAULT_BASE_URL)

Group annotation from the network view in Cytoscape

            name -- Name of annotation by UUID or Name

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - None


function update_annotation_text(text = None, annotation_name = None, x_pos = None, y_pos = None,

                        font_size = None, font_family = None, font_style = None,

                        color = None, angle = None, name = None,

                        canvas = None, z_order = None,

                        network = None, base_url = DEFAULT_BASE_URL)

Updates a text annotation to a Cytoscape network view. The object

will also be added to the Annotation Panel in the GUI.

            text -- The text to be displayed

            annotation_name -- Name of annotation by UUID or Name

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            font_size -- (optional) Numeric value; default is 12

            font_family -- (optional) Font family; default is Arial

            font_style -- (optional) Font style; default is

            color -- (optional) Hexidecimal color; default is #000000 (black)

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - A named list of annotation properties, including UUID


function update_annotation_bounded_text(text = None, annotation_name= None, x_pos = None, y_pos = None,

                               font_size = None, font_family = None, font_style = None,

                               color = None, angle = None, type = None,

                               custom_shape = 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 = DEFAULT_BASE_URL)

Adds a bounded text annotation to a Cytoscape network view. The object will also be added

to the Annotation Panel in the GUI.

            text -- The text to be displayed

            annotation_name -- Name of annotation by UUID or Name

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            font_size -- (optional) Numeric value; default is 12

            font_family -- (optional) Font family; default is Arial

            font_style -- (optional) Font style; default is

            color -- (optional) Hexidecimal color; default is #000000 (black)

            type -- (optional) The type of the shape, default is RECTANGLE. See getNodeShapes() for valid options.

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            custom_shape -- (optional) If a custom shape, this is the text of the shape

            fill_color -- (optional) Hexidecimal color; default is #000000 (black)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of image; default is based on text height.

            width -- (optional) Width of image; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - A named list of annotation properties, including UUID


function 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 = DEFAULT_BASE_URL)

Updates a shape annotation to a Cytoscape network view. The object will also be added to

the Annotation Panel in the GUI.

            type -- (optional) The type of the shape, default is RECTANGLE. See getNodeShapes() for valid options.

            custom_shape -- (optional) If a custom shape, this is the text of the shape

            annotation_name -- Name of annotation by UUID or Name

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of image; default is based on text height.

            width -- (optional) Width of image; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - A named list of annotation properties, including UUID


function update_annotation_image(url = None, annotation_name = None, x_pos = None, y_pos = None,

                         angle = None, 

                         opacity = None, brightness = None,

                         contrast = 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 = DEFAULT_BASE_URL)

Updates a Image annotation to a Cytoscape network view. The

object will also be added to the Annotation Panel in the GUI.

            url -- URL or path to image file. File paths can be absolute or relative to current working 

                            directory. URLs must start with http:// or https://.

            annotation_name -- Name of annotation by UUID or Name

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            opacity -- (optional) Opacity of fill color. Must be an integer between 0 and 100; default is 100.

            brightness -- (optional) Image brightness. Must be an integer between 0 and 100; default is 100.

            contrast -- (optional) Image contrast. Must be an integer between 0 and 100; default is 100.

            border_thickness -- (optional) Integer

            border_color -- (optional) Hexidecimal color; default is #000000 (black)

            border_opacity -- (optional) Integer between 0 and 100; default is 100.

            height -- (optional) Height of image; default is based on text height.

            width -- (optional) Width of image; default is based on text length.

            name -- (optional) Name of annotation object; default is "Text"

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network -- (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url -- (optional) 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.

return - A named list of annotation properties, including UUID


function update_group_annotation(name = None, annotation_name= None, x_pos = None, y_pos = None,

                             angle = None, canvas = None, z_order = None,

                             network= None, base_url = DEFAULT_BASE_URL)

Updates a group annotation, changing the given properties.

            name -- (optional) Name of annotation object

            annotation_name -- Name of annotation by UUID or Name

            x_pos -- (optional) X position in pixels from left; default is center of current view

            y_pos -- (optional) Y position in pixels from top; default is center of current view

            angle -- (optional) Angle of text orientation; default is 0.0 (horizontal)

            canvas -- (optional) Canvas to display annotation, i.e., foreground (default) or background 

            z_order -- (optional) Arrangement order specified by number (larger values are in front of 

                            smaller values); default is 0 

            network (optional) Name or SUID of the network. Default is the "current" network active in Cytoscape.

            base_url (optional) 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.

return - A named list of annotation properties, including UUID

From: Eirin @.> Sent: Tuesday, February 1, 2022 9:10 AM To: cytoscape/py4cytoscape @.> Cc: Barry Demchak @.>; Comment @.> Subject: Re: [cytoscape/py4cytoscape] p4c.layout_network() ++ (Issue #78)

Thanks for the great reply! Yes, I have used the Prefuse layout. This results in node overlaps which does not occur with the yFiles layout. There is probably a simple way to avoid this, I just haven't figured it out yet.

I will check out the clustering apps mentioned and see if they might aid me, thank you! I will also check out the tutorials.

It would be great to test the mentioned annotation API, I can however ofc do this manually for now if you have more pressing matters to take care of ☺️ I thought I should try to explain what I want to be able to do: The networks I'm working with are "simple" Sequence similarity networks with the aim of discovering new interesting enzymatic candidates. https://urldefense.proofpoint.com/v2/url?u=https-3A__user-2Dimages.githubusercontent.com_90095974_151981090-2D78547169-2D30a6-2D4ed5-2D8a73-2Db1bf81735ab0.png&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=YrPTrok7rymAxrNaB7qR5u2ih65gKZHUwJ3VVDkLwucW8u7PUuP2xSTyBVMO13x3&s=21bJjipPrx_nTseWHDOC1hczw5kjT-wk9eF3E26e2no&e= Over is a small screenshot from one of the generated networks using our program. What I mean with annotating the clusters is basically selecting the isolated clusters (or part of one if that is doable) and giving them an appropriate label as shown in the figure (which is easy to do by hand, but not optimal time wise). If it was possible to create annotated subnetworks from that selection aswell (as one also can do manually), that would be awesome. Hope that made sense! Best regards, Eirin

— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_cytoscape_py4cytoscape_issues_78-23issuecomment-2D1026884156&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=YrPTrok7rymAxrNaB7qR5u2ih65gKZHUwJ3VVDkLwucW8u7PUuP2xSTyBVMO13x3&s=aBHirROyZFna0mVBxE0HP7xn9LmU_iM6xzZJkyp_L8I&e= , or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA4GLXWVV4ZBCPJTXDZX3WTUY7SUVANCNFSM5NFTP3SA&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=YrPTrok7rymAxrNaB7qR5u2ih65gKZHUwJ3VVDkLwucW8u7PUuP2xSTyBVMO13x3&s=BNdoPjPIXMllPqgoZpu025AHPZsY1gDKRyVLcS0-VkI&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=YrPTrok7rymAxrNaB7qR5u2ih65gKZHUwJ3VVDkLwucW8u7PUuP2xSTyBVMO13x3&s=2-nMfok_nI-44djqM9dSGezSEsP7PaF09IWQRi_2ShY&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=YrPTrok7rymAxrNaB7qR5u2ih65gKZHUwJ3VVDkLwucW8u7PUuP2xSTyBVMO13x3&s=jOkxHvJq--k0T55DYComAgybHcmXj1PcVeP12LuqHZY&e= . You are receiving this because you commented. https://github.com/notifications/beacon/AA4GLXXOOYSZSNG2RADZZMTUY7SUVA5CNFSM5NFTP3SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHU2QEPA.gif Message ID: @. @.> >

bdemchak commented 2 years ago

Hi, Eirin –

That makes sense to me … and I think it solves my concern about the coordinates issue in RCy3’s APIs.

Do you agree?

I’ll be talking with the RCy3 people about this …

Thanks!

From: Eirin @.> Sent: Thursday, February 3, 2022 5:05 PM To: cytoscape/py4cytoscape @.> Cc: Barry Demchak @.>; Comment @.> Subject: Re: [cytoscape/py4cytoscape] p4c.layout_network() ++ (Issue #78)

I realised that I can just use the EFI-EST color SSN feature, and import the cluster numbers generated there and then use these with the CyREST API to use the Autoannotator from my script🙈 Thanks anyway! Best, Eirin

— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_cytoscape_py4cytoscape_issues_78-23issuecomment-2D1029444550&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=1kRagAIzlpiYiGEpbSeash6x67NhqqpllbEFdiNDymo-hcZkEso1FjIeGGg4iFsc&s=lLpjXJFLAT6VRDWagx0gjjCnNMDr8wj4s5F8DhxbB_Q&e= , or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA4GLXV7SLSABJ4VO6R6D3DUZL3YLANCNFSM5NFTP3SA&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=1kRagAIzlpiYiGEpbSeash6x67NhqqpllbEFdiNDymo-hcZkEso1FjIeGGg4iFsc&s=YLfF-Hh5b3rHzKj1NbFUXYe0gPRJJQE5MN7unDmSYP8&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=1kRagAIzlpiYiGEpbSeash6x67NhqqpllbEFdiNDymo-hcZkEso1FjIeGGg4iFsc&s=OTT5Cpfd1fWpSN8GxeA8g9PfvyofFwREG29ft9nDJMo&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=1kRagAIzlpiYiGEpbSeash6x67NhqqpllbEFdiNDymo-hcZkEso1FjIeGGg4iFsc&s=r6DtR3Ipe8Zeoj6KyLl337LEtSF84O7k78X2cFFZpro&e= . You are receiving this because you commented. https://github.com/notifications/beacon/AA4GLXU3L2BTBHF6XC7Y4GLUZL3YLA5CNFSM5NFTP3SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHVOBHRQ.gif Message ID: @. @.> >

eirinland commented 2 years ago

Hello again! Yes, when doing it the way I described the result is:

Screenshot 2022-02-04 at 10 53 47

Which was exactly how I wanted it and I have no issues with the positions for my use at least. I have to "hide shapes" manually in Cytoscape, but that is just pressing a single button, and the users might like to be able to tweak this small thing themselves. So, as long as a column for the cluster IDs can be obtained in some way (probably a cleaner way than the data merging and use of EFI-EST that I have been up to) running the Autoannotater from the script works neatly.

As for creating subnetworks, it is no problem using p4c.create_subnetwork by creating a column filter from the node cluster column and then nodes="selected".

Best, Eirin

eirinland commented 2 years ago

Hello again! Sorry for taking up so much of your time, and thanks again for the great answers and inputs. Regarding my last answer I noticed something really odd: when running: clusterfilter = p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[0], "IS", True) I see that not all the nodes which has "Cluster Number" =1 are selected. I naturally thought it was something wrong with the data in these particular nodes. However, when I run it again, it is not the same nodes that are not selected: First run:

Screenshot 2022-02-04 at 11 59 57

Second run:

Screenshot 2022-02-04 at 12 00 43

Have you ever seen this issue before?

Further, I have tried to make a while loop to create the sub clusters: Clusternumbers= df2["Cluster Number"].unique().tolist() Clusternumbers=[str(x) for x in Clusternumbers] sizeoflist=len(Clusternumbers) i=0 while i<sizeoflist: p4c.commands.commands_post("view set current view=3nm8_traverse_sequence_names_for_EFI_SSN_70_txt Full Network") print("generating sub cluster number:" Clusternumbers[i]) p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i] , "IS", True) p4c.create_subnetwork(nodes="selected", subnetwork_name=Clusternumbers[i]) i+=1

but after the first itteration (first sub cluster is successfully made) I get the following error: generating sub cluster number 1 generating sub cluster number 2 In cyrest_post(): class [Ljava.lang.Number; cannot be cast to class java.lang.String ([Ljava.lang.Number; and java.lang.String are in module java.base of loader 'bootstrap') Traceback (most recent call last):

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/commands.py", line 190, in cyrest_post r.raise_for_status()

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/requests/models.py", line 960, in raise_for_status raise HTTPError(http_error_msg, response=self)

HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:1234/v1/commands/filter/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/eirinlandsem/comchem_PhD/ark/py4cs_Eirin.py", line 182, in p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i] , "IS", True)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/py4cytoscape_logger.py", line 133, in wrapper_log log_exception(func, e)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/py4cytoscape_logger.py", line 130, in wrapper_log value = func(*args, **kwargs) # Call function being logged

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/filters.py", line 181, in create_column_filter return _create_filter_and_finish('commands/filter/create', cmd_body, hide, apply, network, base_url)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/filters.py", line 394, in _create_filter_and_finish res = commands.cyrest_post(cmd, body=cmd_body, base_url=base_url)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/py4cytoscape_logger.py", line 133, in wrapper_log log_exception(func, e)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/py4cytoscape_logger.py", line 130, in wrapper_log value = func(*args, **kwargs) # Call function being logged

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/commands.py", line 199, in cyrest_post _handle_error(e)

File "/Users/eirinlandsem/opt/anaconda3/envs/py38traverse/lib/python3.8/site-packages/py4cytoscape/commands.py", line 682, in _handle_error raise e

CyError: In cyrest_post(): class [Ljava.lang.Number; cannot be cast to class java.lang.String ([Ljava.lang.Number; and java.lang.String are in module java.base of loader 'bootstrap')

CyError: In cyrest_post(): class [Ljava.lang.Number; cannot be cast to class java.lang.String ([Ljava.lang.Number; and java.lang.String are in module java.base of loader 'bootstrap') Any idea what happens here? ED1: Will try to fix it with exceptions. ED2: This works for several iterations: Clusternumbers= df2["Cluster Number"].unique().tolist() Clusternumbers=[str(x) for x in Clusternumbers] sizeoflist=len(Clusternumbers) i=0 while i<sizeoflist: try: p4c.commands.commands_post("view set current view=3nm8_traverse_sequence_names_for_EFI_SSN_70_txt Full Network") print("generating sub cluster number", Clusternumbers[i]) p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i] , "IS", True) p4c.create_subnetwork(nodes="selected", subnetwork_name=Clusternumbers[i]) i+=1 except: p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i] , "IS", True) p4c.create_subnetwork(nodes="selected", subnetwork_name=Clusternumbers[i]) i+=1

But after a few (I have maximum reached 22 subs) I get the: CyError: In cyrest_post(): No nodes are selected. which occurs because the view jumps back to the newest cluster.

ED3: Solved it by: while i < sizeoflist: try: p4c.commands.commands_post("view set current view=3nm8_traverse_sequence_names_for_EFI_SSN_70_txt Full Network") print("generating sub cluster number", Clusternumbers[i]) time.sleep(5) p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i], "IS", True) p4c.create_subnetwork(nodes="selected", subnetwork_name=Clusternumbers[i]) i += 1 except: print("Klikk on the network panel on the left, then please wait and do NOT klick on anything else in cytoscape") p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[i], "IS", True) p4c.create_subnetwork(nodes="selected", subnetwork_name=Clusternumbers[i]) i += 1 ED: after creating 93 subnetworks: CyError: In cyrest_get(): Uncaught exception while processing resource [qtp168157559-10076]: Java heap space So, should probably not make the many subs haha Best, Eirin

bdemchak commented 2 years ago

Excellent! Thanks for the report, and for the great tips on annotations.

Regarding your project, is there (or will there be) a citation we can use to reference it from one of our future papers?

From: Eirin @.> Sent: Friday, February 4, 2022 5:15 AM To: cytoscape/py4cytoscape @.> Cc: Barry Demchak @.>; Comment @.> Subject: Re: [cytoscape/py4cytoscape] p4c.layout_network() ++ (Issue #78)

Hello again! Yes, when doing it the way I described the result is: https://urldefense.proofpoint.com/v2/url?u=https-3A__user-2Dimages.githubusercontent.com_90095974_152508719-2D0258f2a3-2De805-2D41be-2Dae8e-2D7280782f84cc.png&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=iNuADviGqz5DwMMJEdePogB-c0bMHL9PWMS3YuXwzgPtPMRMXwJ2IkykjuY9KQjj&s=iKHysdT4QjDrpm0v3nCXPY-7ZrnzeGwsCEtZSiZWmo0&e= Which was exactly how I wanted it and I have no issues with the positions for my use at least. I have to "hide shapes" manually in Cytoscape, but that is just pressing a single button, and the users might like to be able to tweak this small thing themselves. So, as long as a column for the cluster IDs can be obtained in some way (probably a cleaner way than the data merging and use of EFI-EST that I have been up to) running the Autoannotater from the script works neatly.

As for creating subnetworks, it is no problem using p4c.create_subnetwork by creating a column filter from the node cluster column and then nodes="selected".

Best, Eirin

— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_cytoscape_py4cytoscape_issues_78-23issuecomment-2D1029832810&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=iNuADviGqz5DwMMJEdePogB-c0bMHL9PWMS3YuXwzgPtPMRMXwJ2IkykjuY9KQjj&s=MeFJsKBOb-EWB_PgkRoi2CRt8mypg6OzcO-0FcF9Ozs&e= , or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA4GLXSFC23LR6GRURD2OL3UZORK7ANCNFSM5NFTP3SA&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=iNuADviGqz5DwMMJEdePogB-c0bMHL9PWMS3YuXwzgPtPMRMXwJ2IkykjuY9KQjj&s=X0nJwgMafu6GFjkZ7GpxgwXwP5bqj98RI9KBGrE6zmk&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=iNuADviGqz5DwMMJEdePogB-c0bMHL9PWMS3YuXwzgPtPMRMXwJ2IkykjuY9KQjj&s=Fw1GZrZoBfcZ73N4LksQNNuGjfvCKLmX2r5OJnlEh6g&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=iNuADviGqz5DwMMJEdePogB-c0bMHL9PWMS3YuXwzgPtPMRMXwJ2IkykjuY9KQjj&s=SjoXUxaf4S-qdNQCRjfCyOqwVz6vHtYrO1IlIRepEiw&e= . You are receiving this because you commented. https://github.com/notifications/beacon/AA4GLXR36LI3C7PQPI5T22DUZORK7A5CNFSM5NFTP3SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHVRAA2Q.gif Message ID: @. @.> >

bdemchak commented 2 years ago

Hi, Eirin –

Not at all … your questions are very valuable, and we’re very happy to have them.

Regarding the filtering, I think I saw this in older versions of Cytoscape. Which version are you running?

If it’s not 3.9.0 or 3.9.1, would you consider upgrading?

If you’re already on a 3.9, would you mind putting this network into a .CYS file and making it available to us? Good to try this using our tools.

Thanks!

From: Eirin @.> Sent: Friday, February 4, 2022 6:03 AM To: cytoscape/py4cytoscape @.> Cc: Barry Demchak @.>; Comment @.> Subject: Re: [cytoscape/py4cytoscape] p4c.layout_network() ++ (Issue #78)

Hello again! Sorry for taking up so much of your time, and thanks again for the great answers and inputs. Regarding my last answer I noticed something really odd: when running: clusterfilter = p4c.create_column_filter('Clusterfilter', 'Cluster Number', Clusternumbers[0], "IS", True) I see that not all the nodes which has "Cluster Number" =1 are selected. I naturally thought it was something wrong with the data in these particular nodes. However, when I run it again, it is not the same nodes that are not selected: First run: https://urldefense.proofpoint.com/v2/url?u=https-3A__user-2Dimages.githubusercontent.com_90095974_152517785-2D96de4501-2D9167-2D4da0-2Daeae-2Ddec82e66e088.png&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=JjGChSmrVM4FXdHxc-_dKV38MA0MuETgKr-eZzQ4Ml8&e= Second run: https://urldefense.proofpoint.com/v2/url?u=https-3A__user-2Dimages.githubusercontent.com_90095974_152518000-2D1d4d65ec-2Dd2f7-2D4f75-2D81d3-2D298eb3070c8f.png&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=uTeP7n_InYjsnP3ZtrE8x_yAd3wPO8jLB9p1Ru3E7oc&e=

Have you ever seen this issue before? Best, Eirin

— Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_cytoscape_py4cytoscape_issues_78-23issuecomment-2D1029884144&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=q3ekbPos0o1LOtq8zE73spRbUYKb7IcXAcIOiJsTW1I&e= , or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA4GLXR3U3PJAAZYB7KYIE3UZOW5ZANCNFSM5NFTP3SA&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=anD4uiFHqvG8wsbCwLZkJvJ2jsZogyA7_jlFn1et_1k&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=_frSM0MSY6C1n63C682iJw7MAZPIniVZAZ2o2kXQlm4&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMCaQ&c=-35OiAkTchMrZOngvJPOeA&r=CsLWmDiVCCVSLXhL9WA-Kh4UUOkFEEy643k8U5VIUxE&m=0tpGwH07ZY_hDiDiFATS8FT-rO5vWcdFi-1gQCOE9x1gTfp5pdv5ZsbhKHwDHfjq&s=w8PiyvgaCY-lbMQT3ov96rSCu2UcUG36iGwz6SzlFXA&e= . You are receiving this because you commented. https://github.com/notifications/beacon/AA4GLXVYDUKR52IEATKM5DDUZOW5ZA5CNFSM5NFTP3SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHVRMR4A.gif Message ID: @. @.> >

eirinland commented 2 years ago

Hello again! Sorry for late reply. I use Cytoscape 3.9.1. As the file is rather large, maybe I could get an email to share a one drive folder with?

I also notices another problem when I run the code all over again:

Screenshot 2022-02-18 at 16 16 31

For some reason the clusters are no longer in the order of size, which makes it look slightly messy, and two annotation and cluster overlaps occurred..

When it comes to publication, that is probably a bit far in the future sadly, as a lot of wet lab work will follow this initial candidate mining.

Best, Eirin

eirinland commented 2 years ago

Not sure if this is of any interest, but thought I might share anyway. I believe I have fixed several of my problems by utilising the clustermaker "connectedcomponents" to create the column of cluster numbers. This way I avoid utilizing the EFI SSN utilities. This also seem to order the clusters nicely each time.

p4c.commands.commands_post("cluster connectedcomponents attribute=--None--")

Auto annotate cannot use the numbers in the __ccCluster column as lables, because it is an integer.

Export the data and then load it into py so that i can manipulate it

import pandas as pd

df=p4c.get_table_columns(table="node", columns ="shared name, __ccCluster")

Create a new column with "cluster #" as a string

Clusternumbers = df["__ccCluster"].unique().tolist() list.sort(Clusternumbers) Clusternumbersstring = [str(x) for x in Clusternumbers] sizeoflist = len(Clusternumbers) i=0

while i < sizeoflist: df.loc[df['__ccCluster'] == i+1 , 'Cluster Label'] = ('Cluster ' + Clusternumbersstring[i]) i += 1

p4c.load_table_data(df, data_key_column="shared name")

Run autoannotate to lable the clusters

p4c.commands.commands_post("autoannotate annotate-clusterBoosted clusterIdColumn=Cluster Label labelColumn=Cluster Label useClusterMaker=False")

Best, Eirin

eirinland commented 2 years ago

Hello again! I have a new challenge I was wondering if you guys have a suggestion on how to solve. Is there a way to switch from the edge table to node table with a python script? I could not find a function that do this in p4cyto or cyREST. Apparently, autoAnnotate need the node table to be the "selected" table in the graphical interface for it to work. But when I generate a new network with my script, the edge table is the default shown table.

Any suggestions? Best, Eirin

bdemchak commented 2 years ago

Hi, Eirin --

Sorry for missing this question. It slipped by.

Using the GUI, I have loaded a network and selected the edge table. I then performed an AutoAnnotate. The annotation seems to have succeeded, even with the Edge Table selected. This is what I would expect.

Can you give an example of where this isn't working? If so, I can ask the group that created the AutoAnnotate app.

You're right, though, that there's no CyREST (or py4cytoscape) feature that selects one table tab or another.

Thanks!

bdemchak commented 2 years ago

Thanks, Eirin, for the code that puts a string-based cluster number in a table. It really shouldn't be this hard, but for now, I think you have it right. As a test, I tried using CyREST to create a new column (... it works ...) and then insert a formula (e.g., =TEXT($ccCluster)). The formula text was inserted, but the formula wasn't evaluated. I would have expected the formula to be evaluated, thereby creating a string version of ccCluster. But no. I have filed a bug report on this ... let's see what happens.

bdemchak commented 2 years ago

... closing this out ...

But as regards yFiles usage, note that there is a yFiles for Jupyter now, should you be interested in executing your workflow under Jupyter and then rendering in Jupyter instead of Cytoscape: https://pypi.org/project/yfiles-jupyter-graphs/

We haven't checked this out yet, but it looks promising!