nodes and edges loose color and shape

495 views
Skip to first unread message

sisterdot

unread,
Jan 28, 2008, 10:52:34 AM1/28/08
to cytoscape-helpdesk
Dear all...

using the newest cytoscape version i can import interaction data from
xgmml files with nodes and edges colored to my liking. i can also
apply a layout to my newly imported network and all color definitions
stay as they should be. and this is all fine and beatiful.

my problem comes when i import/create a second network, or apply
filters on the well colored network- than all the beautiful colors are
gone and i get some default color schema applied to my network.

in previous versions (or was it platform-dependent ?) i could say
"destroy view" and upon "creating view" the colors would be back...
but all the positional information was gone... this strategy doesn't
seem to currently work...

any good ideas on how to overcome my problem?
i apply colors using the following definitions:
<graphics width="$style{"width"}" fill="$style{"fill"}"
type="$style{"type"}" outline="#000000" h="$style{"h"}"
w="$style{"w"}" x="$x" y="$y">

why isn't that permanent ?!

thanks a looooot
sisterdot


Mike Smoot

unread,
Jan 28, 2008, 2:30:31 PM1/28/08
to cytoscape...@googlegroups.com
Are you using the vizmapper to apply the colors?  When you import the new network are you applying the same visual style to the new network?

When you apply a "filter" the filter really just selects nodes in a network.  This selection is visualized by temporarily changing the node color.  However, as  soon as  you unselect a node, it will go back to its normal color.


Mike
--
____________________________________________________________
Michael Smoot, Ph.D.               Bioengineering Department
tel: 858-822-4756         University of California San Diego

sisterdot

unread,
Jan 29, 2008, 5:34:00 AM1/29/08
to cytoscape-helpdesk
Hey Mike...

thanks for your reply

> Are you using the vizmapper to apply the colors?

no i just construct my own xgmml file... a sample xgmml shown
below...
i import this file and colors and shapes are as expected...

than if i perform any of the actions listed below the view is reset to
some default:
File->Network->Empty Network (always resets graph attributes)
or
apply Filters (always resets graph attributes)
or
Layout-> Cytoscape Layout->Degree Sorted Circle Layout (not always:
resets in windows 2.5.1 version but not in previous versions that i
have still installed on linux or mac- might be dependent on the
environment i have too)
or
....

also with the older versions (potentially environment dependent) i can
select the now color-less network and perform "destroy view" and than
"create view" and colors would be restored... although i actually
don't like doing that because the specific spread of the network is
than gone again...

importing and exporting the vizmap property file is no help for this
problem...

thanks
M.


=========================


<?xml version='1.0'?>
<graph id="test" label="test" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xmlns:ns1="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://
www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.cs.rpi.edu/
XGMML">
<att name="documentVersion" value="1.0"/>
<att name="backgroundColor" value="#9999ff"/>
<node id="1" label="node1" name="base">
<att type="string" name="node.label" label="node.label"/>
<att type="string" value="SW,NW,c,0,0"
name="node.labelPosition" label="node.labelPosition"/>
<att type="string" value="node1" name="canonicalName"
label="canonicalName"/>
<graphics width="1" fill="#00FF00" type="triangle"
outline="#000000" h="35.0" w="35.0" x="1" y="1">
<att name="cytoscapeNodeGraphicsAttributes">
<att name="nodeTransparency" value="1.0"/>
<att name="nodeLabelFont" value="Default-0-12"/>
<att name="borderLineType" value="solid"/>
</att>
</graphics>
</node>
<node id="2" label="node2" name="base">
<att type="string" name="node.label" label="node.label"/>
<att type="string" value="SW,NW,c,0,0"
name="node.labelPosition" label="node.labelPosition"/>
<att type="string" value="node2" name="canonicalName"
label="canonicalName"/>
<graphics width="3" fill="#FF0000" type="triangle"
outline="#000000" h="15.0" w="15.0" x="2" y="1">
<att name="cytoscapeNodeGraphicsAttributes">
<att name="nodeTransparency" value="1.0"/>
<att name="nodeLabelFont" value="Default-0-12"/>
<att name="borderLineType" value="solid"/>
</att>
</graphics>
</node>
<edge id="node1-linktype-node2" label="node1-linktype-node2"
source="1" target="2">
<att label="XGMML Edge Label" name="XGMML Edge Label"
value="linktype" type="string"/>
<att type="real" value="5" name="edgedistance"
label="edgedistance"/>
<att type="string" value="linktype" name="interaction"
label="interaction"/>
<graphics width="2" fill="#00FF7F">
<att name="cytoscapeEdgeGraphicsAttributes">
<att name="sourceArrow" value="0"/>
<att name="targetArrow" value="0"/>
<att name="edgeLabelFont"
value="sansserif.italic-0-10"/>
<att name="edgeLineType" value="LINE_2"/>
<att name="sourceArrowColor" value="#000000"/>
<att name="targetArrowColor" value="#000000"/>
<att name="curved" value="STRAIGHT_LINES"/>
</att>
</graphics>
</edge>
</graph>


sisterdot

unread,
Jan 29, 2008, 2:18:14 PM1/29/08
to cytoscape-helpdesk


something that i didn't manage to do yet and would be great if i could
have it, is to import my network... than use algorithms and manual
adjustment to spread it all... than keep my node.edge position... but
import a completely new color/shape/size information for my nodes...
so the network looks exact same from the topology but with different
colors and shapes...

is there an easy way to do that?!?!

thanks
sisterdot

Mike Smoot

unread,
Jan 29, 2008, 2:59:33 PM1/29/08
to cytoscape...@googlegroups.com
Ok, I understand what the problem is.  The important thing to realize is that all visualization (i.e. colors, shapes, etc.) in Cytoscape happens through the VizMapper, which maps attribute data about networks to different visual attributes.  In current versions of Cytoscape, all visual properties in the xgmml are shown once and then ignored in favor of what the VizMapper says should happen. Any time your change the view (i.e. applying a layout) the VizMapper is called and the initial settings are lost. This is bad and will change in 2.6 so that we will (when desired) infer a visual style based on what you specify in your xgmml. This way you won't lose the visualizations that you define in your xgmml file. 

However, even this approach is just a hack to support the use of xgmml without the use of attributes and since 2.6 doesn't exist yet, won't solve your problem.

The best approach for you will be to define attributes for the nodes and edges of your network that you can then use to assign colors, shapes, etc. through the VizMapper.  That will conform with how Cytoscape works and will let you easily change color schemes and whatnot while preserving the network layout.  Your best bet is to read through the attribute and visual style chapters in the manual to understand things:

http://www.cytoscape.org/manual/Cytoscape2_5Manual.html#Node%20and%20Edge%20Attributes
http://www.cytoscape.org/manual/Cytoscape2_5Manual.html#Visual%20Styles

Note that if you don't want separate attribute files you can roll attributes into the xgmml files.  If you unzip one of the sample session files provided you should see some xgmml files that do this the directory that is created.

Let me know if any of that isn't clear.

thanks,
Mike

sisterdot

unread,
Feb 5, 2008, 10:45:40 AM2/5/08
to cytoscape-helpdesk
Hey Mike...

thanks for your advice...

the 2.5.1 vizmapper is quite more user-friendly than the 2.4.1, so in
principle distributing the 2.5.1. vizmapper file together with the
xgmml to other users is a good suggestion...

the only problem that i have with that is, that the export
functionality seems to have been reduced from 2.4.1 to 2.5.1?!
export as svg vector format would be fine, but doesn't give the
expected results when opened in a VG program...
the eps option seems to be gone (debian, win tested)

any ideas in this case?!

thanks a lot for your patience!
sisterdot

Mike Smoot

unread,
Feb 5, 2008, 12:56:16 PM2/5/08
to cytoscape...@googlegroups.com
Hi,

The reason we removed eps export from 2.5.x was that eps doesn't support transparency.  Whenever transparency was used, it created all sorts of problems for the export.  Both PDF and SVG do support this however, so that's why we've got them. 

That said, there is a feature request that will allow eps export if no transparency is used in a given network.  However, I'm not sure when we'll get to that on. 

Finally, if you've got a problematic SVG file, then I'd be very interested in seeing it, just in case there is something we can debug.


thanks,
Mike

Reply all
Reply to author
Forward
0 new messages