editing node ID

931 views
Skip to first unread message

Janet Higgins (JIC)

unread,
Oct 20, 2009, 5:05:06 AM10/20/09
to cytoscape...@googlegroups.com
I have added some new nodes to a network and I would like to name the nodes with the AGI code for the gene so I can merge with other networks, however I cannot find how to change the node ID. I have done this before but I cannot see how to do it now.

Can anyone help?
Thanks
Janet

michael...@non.agilent.com

unread,
Oct 20, 2009, 11:41:08 AM10/20/09
to cytoscape...@googlegroups.com
You can't change Node IDs. What you can do is add an attribute value to the node which can then be displayed by the vizmapper. A commonly used attribute of node labels is SEMANTICS.CANONICAL_NAME. Several of the visual styles will display this attribute as the label for a node. To set a node's (n1) label you could do something like:

Cytoscape.getNodeAttributes().setAttribute(n1.getIdentifier(),SEMANTICS.CANONICAL_NAME, "my new label");

Alexander Pico

unread,
Oct 20, 2009, 2:00:47 PM10/20/09
to cytoscape...@googlegroups.com
Indeed, you can not change the Node ID from within the application via the
user interface. You can, however, change the ID programmatically:

Cytoscape.getCyNode("old_id", false).setIdentifier("new_id");

I suspect you are not programming, though, and want a way to do this as a
user. Here is one workaround:

Go to the "Editor" tab in the left panel and then double-click in the
network window. You can now type any ID you want, press enter, and a node
will be created with that ID.

-Alex


On 10/20/09 8:41 AM, "michael...@non.agilent.com"

Janet Higgins (JIC)

unread,
Oct 21, 2009, 3:40:20 AM10/21/09
to cytoscape...@googlegroups.com
Thanks, this is really helpful, I used the workaround.
Janet
Reply all
Reply to author
Forward
0 new messages