Saving a graph generated with RCytoscape

19 views
Skip to first unread message

January Weiner

unread,
May 23, 2012, 10:58:59 AM5/23/12
to rcyto...@googlegroups.com
Dear all,

I am happily using RCytoscape, but I have a problem with saving the
graphs that were generated using RCytoscape. Specifically, node colors
are not saved when RCytoscape session is saved. Is this a common
problem, or is there something strange with my setup? I am using
Cytoscape 2.8.1 and RCytoscape 1.6.3. The colors have been generated
as follows:

colors <- c( "#084594", "#2171B5", "#4292C6", "#6BAED6", "#9ECAE1",
"#C6DBEF", "#EFF3FF",
"#ffffff", "#FEE5D9", "#FCBBA1", "#FC9272", "#FB6A4A",
"#EF3B2C", "#CB181D", "#99000D" )
brkpts <- c( -1.0000000, -0.8333333, -0.6666667, -0.5000000,
-0.3333333, -0.1666667, 0.0000000, 0.1666667, 0.3333333, 0.5000000,
0.6666667, 0.8333333, 1.0000000 )
setNodeColorRule( cw, node.attribute.name= "foo", colors= colors,
mode= "interpolate", control.points= brkpts )

Also, when setNodeColorRule is called, the colors do not change in
Cytoscape until I click one of the layout buttons.

Kind regards,

January

--
-------- Dr. January Weiner 3 --------------------------------------
Max Planck Institute for Infection Biology
Charitéplatz 1
D-10117 Berlin, Germany
Web   : www.mpiib-berlin.mpg.de
Tel     : +49-30-28460514
Fax    : +49-30-28450505

Paul Shannon

unread,
May 23, 2012, 11:38:28 AM5/23/12
to rcyto...@googlegroups.com, January Weiner, Paul Shannon
Hi January,

You will find the answer to your first question, I am pretty sure, on the "Examples and Demos" section of the RCy website:

directly: http://db.systemsbiology.net:8080/cytoscape/RCytoscape/versions/current/cookbook/visualStyle.html
indirectly: http://db.systemsbiology.net:8080/cytoscape/RCytoscape/versions/current/index.html
-> choose 'Examples' in the upper left pane
-> choose 'protect & preserve visual styles' in the lower left pane

With regard to the second question, that node colors do not change when you call 'setNodeColorRule' -- perhaps this is because you
have not called

redraw (cw)

Triggering a redraw happens with a new layout request from the Cytoscape menu. But you can do it programmatically from R with 'redraw'.

Let us know if this works.

Cheers!

- Pajl

Paul Shannon

unread,
May 24, 2012, 2:08:12 PM5/24/12
to January Weiner, Paul Shannon, rcyto...@googlegroups.com
Hi January,

Glad to hear it worked out.

Until reading your note below, I did not know that Cytoscape would fit node width to label. When I have needed that, I have used 'setNodeWidthDirect':

http://db.systemsbiology.net:8080/cytoscape/RCytoscape/versions/current/methods/setNodeWidthDirect.html

Would that help you here? We will try to support 'fitNodeWidthToLabel' in the next version.

Cheers -

- Paul


On May 24, 2012, at 11:03 AM, January Weiner wrote:

> Dear Paul,
>
> yes, many thanks! Sorry I did not reply immediately, I only could try
> it out this afternoon. It was a bit confusing at first, mostly because
> I know R, but don't know Cytoscape.
>
> On a similar note -- is there a way to use RCytoscape to make the node
> width fit the labels? In Cytoscape it requires a half a dozen clicks
> or so (in VizMapper, create NodeWidth property, select something, then
> a discrete mapping, then select generate discrete values -> fit node
> width to label).
>
> Best regards,
>
> j.
>
> On Thu, May 24, 2012 at 7:06 PM, Paul Shannon <psha...@fhcrc.org> wrote:
>> Hi January,
>>
>> Were my suggestions any help? Still stuck?
>>
>> Let me know, if you will.
>>
>> Cheers!
>>
>> - Paul
>>
>> On May 23, 2012, at 8:38 AM, Paul Shannon wrote:
>>
>>> Hi January,
>>>
>>> You will find the answer to your first question, I am pretty sure, on the "Examples and Demos" section of the RCy website:
>>>
>>> directly: http://db.systemsbiology.net:8080/cytoscape/RCytoscape/versions/current/cookbook/visualStyle.html
>>> indirectly: http://db.systemsbiology.net:8080/cytoscape/RCytoscape/versions/current/index.html
>>> -> choose 'Examples' in the upper left pane
>>> -> choose 'protect & preserve visual styles' in the lower left pane
>>>
>>> With regard to the second question, that node colors do not change when you call 'setNodeColorRule' -- perhaps this is because you
>>> have not called
>>>
>>> redraw (cw)
>>>
>>> Triggering a redraw happens with a new layout request from the Cytoscape menu. But you can do it programmatically from R with 'redraw'.
>>>
>>> Let us know if this works.
>>>
>>> Cheers!
>>>
>>> - Pajl
>>>
>>> On May 23, 2012, at 7:58 AM, January Weiner wrote:
>>>
Reply all
Reply to author
Forward
0 new messages