Different nodes with same name

31 views
Skip to first unread message

hsc-coop

unread,
Dec 6, 2005, 11:31:46 AM12/6/05
to cytoscape-discuss
Hi I was wondering if its possible to have nodes with the same name in
different networks to have different values for the same attribute.
Right now I think the Cytoscape.getCyNode() methods will return the
same node if the name is the same even in different networks. Right now
I have appended the network title to the node name to distinguish but
this is kind of a hack way. I was thinking of keeping a data
structure/map of the nodes with this attribute and loading it every
time the CytoscapeDesktop.NETWORK_VIEW_FOCUSED is triggered.
Is there an easy way to actually create a new node with a name of an
existing node?
I cannot have different attribute names as I have mapped this attribute
in the visual mapper.
Thanks in advance.

WLigt...@gmail.com

unread,
Dec 7, 2005, 5:14:18 AM12/7/05
to cytoscape-discuss
The name of the node, should really be an attribute of the node. The
node can then be created with a unique idetifier, which you then will
use to get the node and do stuff with it.
Then the name will be an attribute, which you can map to the label
using the vizmapper.
And then rest of the attirbutes can be mapped as easily. You should
only keep track of which unique ID is the counterpart of the other
unique ID. Which could be something like:
nameYouUseNow1 and nameYouUseNow2.
If you then get the nodeID, remove the last digit with substring, and
use add to that another digit, to be able to get to the other node.

I hope this helps a bit.

hsc-coop

unread,
Dec 7, 2005, 9:51:21 AM12/7/05
to cytoscape-discuss
Thanks for the help, that's a good idea. The nodes in the subgraphs are
independent of nodes in a different subgraph so I won't even need to
know about the other nodes with the same name. Do you know if its
possible to have the label of the node to be an attribute instead of
the name of the node if I implement it this way? Minor detail but looks
a bit better.
Thanks for replying, thought everyone went on christmas vacation
early...or maybe they are just sick of my stupid questions ^_^

Rowan Christmas

unread,
Dec 7, 2005, 12:33:30 PM12/7/05
to cytoscap...@googlegroups.com
The label can (and always is...) mapped to an attribute, so what
William mentioned really is the best way for getting the display to
look how you want.

also, last week was the Cytoscape developer meeting so I think most
people were down in San Diego not reading e-mail :)

--rowan

hsc-coop

unread,
Dec 12, 2005, 4:04:05 PM12/12/05
to cytoscape-discuss
Thanks guys, working fine now. I create nodes with a unique identifier
and change the canonicalName attribute to be the label I want. This
looks fine in my network as my label for the node corresponds to the
canonicalName...but I noticed if I go into attribute browser of that
node, the canonicalName is the node name(unique identifier). Think this
is because the table is not being refreshed since it outputs the label
when I println the canonicalName attribute. Thanks for the help again
guys.

Chris Workman

unread,
Dec 13, 2005, 6:17:25 PM12/13/05
to cytoscap...@googlegroups.com
The node labels will not change when you load node attribute data
(which, after all, must based on the node labels). We have been trying
to deprecate the concepts of canonicalName, commonName for a long long
time now as they are confusing and can cause problems. Specifically,
implicit name conversion cause problems when the programmer or user
doesn't have control over this or doesn't know it is happening (as was
the case long ago).

So the term canonicalName still lingers but I would not recommend
changing the canonicalName attribute as it still appears to be
"special".

When defining the network, each node label must refer to distinctly
different nodes. There is no sensible way around this. Gene name,
species name, my-special-name, etc can all be loaded as node attribute
data and cytoscape uses the vizMapper to control which labels are
displayed. This has always worked well for me.

-Chris


--
_______________________________________________________
Christopher Workman, Ph.D Department of Bioengineering
phone: 858 822-4706 University of California San Diego

Keiichiro Ono

unread,
Dec 13, 2005, 6:54:38 PM12/13/05
to cytoscap...@googlegroups.com
Hi.
I double checked the source code and found that ID's in the attribute
browser is based on the GraphObject's ID, not the node ID. This is why
cannonicalName is the node ID in the browser.

This is confusing, so we will re-define naming issue (label, node ID,
GraphObject ID, canonical name, etc.) in 2.3.

Kei


--
Keiichiro Ono
Cytoscape Developer Team
UCSD Bioengineering Dept. Ideker Lab
ko...@ucsd.edu

hsc-coop

unread,
Dec 14, 2005, 12:04:24 PM12/14/05
to cytoscape-discuss
Thanks for all the input, the problem that I have is not nodes in the
same network but rather in different networks. For example I have a
gene in 2 networks, in one I want it to be a primary node and in
another a secondary node. If I want to use vizmapper to color the node
according to whether is is primary or secondary it must be mapped to an
attribute. But this value must be different for the gene in the 2
networks since it is primary in one and secondary in the other. This
was solved by giving a unique identifier and changing the canonicalName
which I believe is what the label is mapped to currently.

Now, I have come across a similar problem. My program creates a network
based on an existing network created from a file, so I append the
existing network to my new empty one. The problem is that if I do this
for another network, it is possible that this network may have nodes
with the same name as the first one generated. Therefore if the second
generated network contains a node with the same name then they are
technically the same node even though they should not be.

So far I have mostly worked with the NodeViews so the problems have not
been apparent(since a node can have different NodeViews in different
networks).
However, now I need to create edges in these generated networks. The
problem I have is when I change an edge attribute of nodes that are in
both networks, the edge attribute will be shared in both. That is, the
value set last will be shared.

I tried using:
getCyEdge(String source_alias, String edge_name, String target_alias,
String interaction_type)
with a unique edge_name but it still gets the same edge if the source
and target are the same.

Any ideas for getting around this? I was thinking I would need to
iterate through the nodes/edges in my original networks and then create
nodes with unqiue names that have the same attributes and graph index.

Gary Bader

unread,
Dec 14, 2005, 9:03:26 PM12/14/05
to cytoscap...@googlegroups.com
Hi,

Unfortunately, the name is not really used for much in this method -
this needs to be fixed in a future version. The way to force a
different edge is to set a different interaction_type e.g. pp1, pp2,
etc. A general solution to this would be to create network specific
attributes, but that might not happen for a while, so this is the best
workaround right now.

Hope that helps,
Gary

Reply all
Reply to author
Forward
0 new messages