Node ID and canonical name

125 views
Skip to first unread message

Sasha

unread,
Nov 11, 2007, 3:28:08 AM11/11/07
to cytoscape-helpdesk
Hello,

I have several difficulties:
1. After adding new node using editor, is it any option to change node
ID?

2. In JAVA: how can I get a canonical name? When I write this code
line -
String currentNodeCanonName =
(String)Cytoscape.getNodeAttributes().getListAttribute(((Node)
nodeIt.next()).getIdentifier(), Semantics.CANONICAL_NAME).get(0);
I recieve exception - ClassCastException: attributeName
'canonicalName' is not of TYPE_SIMPLE_LIST

michael...@non.agilent.com

unread,
Nov 11, 2007, 11:57:50 AM11/11/07
to cytoscape...@googlegroups.com
1. No, the node identifier is immutable. You can change the canonical name in the editor and then change your visual style to present that as a node label.

2. canonical name is a String attribute. You can get it using something like:
public String getCanonicalName(CyNode node) {
return getNodeAttributes().getStringAttribute(node.getIdentifier(), Semantics.CANONICAL_NAME);
}
There may be a utility method for getting the canonical name but I don't know of one.

rag...@gmail.com

unread,
Nov 13, 2007, 6:46:34 AM11/13/07
to cytoscape-helpdesk
Hi,
I am currently working on using Cytoscape for displaying
interactions.
I have a question:
If I add a node using editor, how to know the type of node (whether it
is, protein or pathway).
Is there anyway to get the Node type?

Thanks in Advance
Rags

allan_k...@agilent.com

unread,
Nov 13, 2007, 6:55:54 AM11/13/07
to cytoscape...@googlegroups.com
If you add a node using the editor, then it will have an attribute called NODE_TYPE which is set to DefaultNode. This is for purposes of managing the editor palette, and it doesn't indicate whether the node is a protein, gene, pathway, or any other entity. The Cytoscape core doesn't contain biological semantics.

It sounds as if you may want to define your own attribute for indicating whether a node is a pathway or protein. You should call it something other than NODE_TYPE, e.g. you could call it "nodeType". You can define an attribute using the Data Panel (known as the Attribute Browser in Cytoscape 2.5 and previous versions). This is described in the section on "Node and Edge Attributes" in the Help docs.

Let me know if you have any other questions.

AllanK

______________________________

Allan Kuchinsky
Agilent Technologies
5301 Stevens Creek Blvd. Mailstop 54U/SC
Santa Clara, CA, 95051
* phone (408) 553-2423
* mailto:allan_k...@agilent.com

michael...@non.agilent.com

unread,
Nov 13, 2007, 7:28:40 AM11/13/07
to cytoscape...@googlegroups.com
For question #1, I gave you a half truth--the identifier is not mutable from the editor, but *is* mutable in the Cytsocape code (CyNode.setIdentifer()). However, this is a dangerous operation since all attributes for a given node are keyed off the identifier. You'd have to carefully move all the attributes to be stored under the new identifier.

allan_k...@agilent.com

unread,
Nov 13, 2007, 9:33:27 AM11/13/07
to cytoscape...@googlegroups.com
Sorry, I meant not changeable from within the editor.

AllanK

______________________________

Allan Kuchinsky
Agilent Technologies
5301 Stevens Creek Blvd. Mailstop 54U/SC
Santa Clara, CA, 95051
* phone (408) 553-2423
* mailto:allan_k...@agilent.com

Reply all
Reply to author
Forward
0 new messages