problem getting setNodeColorRule from RCytoscape to work
2
0
Entering edit mode
Burak Kutlu ▴ 140
@burak-kutlu-3941
Last seen 10.2 years ago
Hello, Trying to replicate the example provided in the help page for setNodeColorRule, unfortunately it does not work for me. Any suggestions? thanks -burak # example from the help page for setNodeColorRule > cw <- new.CytoscapeWindow ('setNodeColorRule.test', graph=makeSimpleGraph()) control.points <- c (-3.0, 0.0, 3.0) # typical range of log-fold- change ratio values # paint negative values shades of green, positive values shades of # red, out-of-range low values are dark green; out-of-range high # values are dark red node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') redraw (cw) data.values <- c ("kinase", "transcription factor", "glycoprotein") node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') > control.points <- c (-3.0, 0.0, 3.0) # typical range of log- fold-change ratio values > # paint negative values shades of green, positive values shades of > # red, out-of-range low values are dark green; out-of-range high > # values are dark red > node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") > setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') Error in convertToR(xmlParse(node, asText = TRUE)) : faultCode: 1001 faultString: Attribute lfc could not be found. > redraw (cw) > data.values <- c ("kinase", "transcription factor", "glycoprotein") > node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") > setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') Error in convertToR(xmlParse(node, asText = TRUE)) : faultCode: 1001 faultString: Attribute type could not be found. > ## session info > sessionInfo() R version 2.14.2 (2012-02-29) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RCytoscape_1.5.2 XMLRPC_0.2-4 graph_1.32.0 [4] BiocInstaller_1.2.1 loaded via a namespace (and not attached): [1] RCurl_1.91-1 tools_2.14.2 XML_3.9-4 >
• 1.3k views
ADD COMMENT
0
Entering edit mode
Burak Kutlu ▴ 140
@burak-kutlu-3941
Last seen 10.2 years ago
Same deal for "setEdgeColorRule" under the same settings.. # omitting the steps to load the simpleGraph example that comes with RCytoscape > setEdgeColorRule (cw, 'edgeType', edgeType.values, colors, mode='lookup') Error in convertToR(xmlParse(node, asText = TRUE)) : faultCode: 1001 faultString: Attribute edgeType could not be found. On Mar 17, 2012, at 10:13 AM, Burak Kutlu wrote: > Hello, > Trying to replicate the example provided in the help page for setNodeColorRule, unfortunately it does not work for me. > Any suggestions? > thanks > -burak > > # example from the help page for setNodeColorRule > >> cw <- new.CytoscapeWindow ('setNodeColorRule.test', graph=makeSimpleGraph()) > control.points <- c (-3.0, 0.0, 3.0) # typical range of log-fold- change ratio values > # paint negative values shades of green, positive values shades of > # red, out-of-range low values are dark green; out-of-range high > # values are dark red > node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") > setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') > redraw (cw) > data.values <- c ("kinase", "transcription factor", "glycoprotein") > node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") > setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') >> control.points <- c (-3.0, 0.0, 3.0) # typical range of log- fold-change ratio values >> # paint negative values shades of green, positive values shades of >> # red, out-of-range low values are dark green; out-of-range high >> # values are dark red >> node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") >> setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') > Error in convertToR(xmlParse(node, asText = TRUE)) : > faultCode: 1001 faultString: Attribute lfc could not be found. >> redraw (cw) >> data.values <- c ("kinase", "transcription factor", "glycoprotein") >> node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") >> setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') > Error in convertToR(xmlParse(node, asText = TRUE)) : > faultCode: 1001 faultString: Attribute type could not be found. >> > > > ## session info > >> sessionInfo() > R version 2.14.2 (2012-02-29) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RCytoscape_1.5.2 XMLRPC_0.2-4 graph_1.32.0 > [4] BiocInstaller_1.2.1 > > loaded via a namespace (and not attached): > [1] RCurl_1.91-1 tools_2.14.2 XML_3.9-4
ADD COMMENT
0
Entering edit mode
Paul Shannon ▴ 750
@paul-shannon-5161
Last seen 10.2 years ago
Hi Burak, Sorry you are running into trouble. Suggestions below. On Mar 17, 2012, at 10:13 AM, Burak Kutlu wrote: > Hello, > Trying to replicate the example provided in the help page for setNodeColorRule, unfortunately it does not work for me. > Any suggestions? > thanks > -burak > > # example from the help page for setNodeColorRule > >> cw <- new.CytoscapeWindow ('setNodeColorRule.test', graph=makeSimpleGraph()) > control.points <- c (-3.0, 0.0, 3.0) # typical range of log-fold- change ratio values > # paint negative values shades of green, positive values shades of > # red, out-of-range low values are dark green; out-of-range high > # values are dark red > node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") > setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') > redraw (cw) > data.values <- c ("kinase", "transcription factor", "glycoprotein") > node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") > setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') >> control.points <- c (-3.0, 0.0, 3.0) # typical range of log- fold-change ratio values >> # paint negative values shades of green, positive values shades of >> # red, out-of-range low values are dark green; out-of-range high >> # values are dark red >> node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") >> setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') > Error in convertToR(xmlParse(node, asText = TRUE)) : > faultCode: 1001 faultString: Attribute lfc could not be found. This error message may point to the problem. Could you run this command and send me the output? noa.names (cw at graph) noa (cw at graph, 'lfc') When I do so, here is what I see: > g = makeSimpleGraph () > noa.names (g) [1] "type" "lfc" "label" "count" > noa (g, 'lfc') A B C -3 0 3 I have simplified the approach here, but I think the crucial aspects are included: 1) RCytoscape::makeSimpleGraph () returns a 3-node, 3-edge graph with a few node and edge attributes 2) setNodeColorRule (cw, 'lfc', <control.points>, <color.list>, mode) uses the values of the lfc attribute If you will be so kind as to send my your results, we can think about either bug fixes I need to make, or better checks to add to the RCy package so that you (and others) have an easier time of it. Regards, - Paul >> redraw (cw) >> data.values <- c ("kinase", "transcription factor", "glycoprotein") >> node.colors <- c ("#0000AA", "#FFFF00", "#0000AA") >> setNodeColorRule (cw, node.attribute.name='type', data.values, node.colors, mode='lookup', default.color='#AA0000') > Error in convertToR(xmlParse(node, asText = TRUE)) : > faultCode: 1001 faultString: Attribute type could not be found. >> > > > ## session info > >> sessionInfo() > R version 2.14.2 (2012-02-29) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RCytoscape_1.5.2 XMLRPC_0.2-4 graph_1.32.0 > [4] BiocInstaller_1.2.1 > > loaded via a namespace (and not attached): > [1] RCurl_1.91-1 tools_2.14.2 XML_3.9-4
ADD COMMENT
0
Entering edit mode
Hi Paul Thanks for the prompt response!! Here's the output which looks identical to yours. > noa.names (cw at graph) [1] "type" "lfc" "label" "count" > noa (cw at graph, 'lfc') A B C -3 0 3 -burak On Mar 17, 2012, at 11:02 AM, Paul Shannon wrote: > noa.names (cw at graph) > noa (cw at graph, 'lfc')
ADD REPLY
0
Entering edit mode
Thanks, Burak. So far so good. Now try, if you will -- just to step through this slow and easy: > cw = new.CytoscapeWindow (title = 'bug?', graph=g) > displayGraph (cw) entering RCytoscape::displayGraph sending 3 nodes sending 3 edges adding node attributes... [1] "type" [1] "lfc" [1] "label" [1] "count" adding edge attributes... [1] "edgeType" entering setEdgeAttributesDirect, edgeType, with 3 names and 3 values [1] "score" entering setEdgeAttributesDirect, score, with 3 names and 3 values [1] "misc" > noa (cw at graph, 'lfc') A B C -3 0 3 > control.points <- c (-3.0, 0.0, 3.0) # typical range of log-fold- change ratio values > node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") > noa (cw at graph, 'lfc') # do this again, just to be sure A B C -3 0 3 > setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') > redraw (cw) - Paul On Mar 17, 2012, at 11:04 AM, Burak Kutlu wrote: > Hi Paul > Thanks for the prompt response!! > > Here's the output which looks identical to yours. > >> noa.names (cw at graph) > [1] "type" "lfc" "label" "count" >> noa (cw at graph, 'lfc') > A B C > -3 0 3 > > -burak > > On Mar 17, 2012, at 11:02 AM, Paul Shannon wrote: > >> noa.names (cw at graph) >> noa (cw at graph, 'lfc') >
ADD REPLY
0
Entering edit mode
Hi Paul A little bit of Zen was really helpful: the example you provided, when executed in a calm, quiet place, works :-) There are a couple of things going on here: please confirm if you agree. 1. The only difference between the example in the help page and the example you provide is " displayGraph(cw) " call after creating the Cytoscape Window object. May I suggest including that in the help page example for both setNodeColorRule and setEdgeColorRule? More specifically: I would insert displayGraph(cw) after this line cw <- new.CytoscapeWindow ('setNodeColorRule.test', graph=makeSimpleGraph()) I realize that I am still confused when to call displayGraph or redraw, after already calling displayGraph for the first time. Can you comment on this? 2. You tried earlier in vain to convince me to initiate the edge attributes. Calling "InitEdgeAttributes" solved the issues I was having. Now I am really convinced. I am still confused, though, why you force this even when attributes exist for all edges. Many thanks -burak On Mar 17, 2012, at 11:13 AM, Paul Shannon wrote: > Thanks, Burak. > > So far so good. Now try, if you will -- just to step through this slow and easy: > >> cw = new.CytoscapeWindow (title = 'bug?', graph=g) >> displayGraph (cw) > entering RCytoscape::displayGraph > sending 3 nodes > sending 3 edges > adding node attributes... > [1] "type" > [1] "lfc" > [1] "label" > [1] "count" > adding edge attributes... > [1] "edgeType" > entering setEdgeAttributesDirect, edgeType, with 3 names and 3 values > [1] "score" > entering setEdgeAttributesDirect, score, with 3 names and 3 values > [1] "misc" > >> noa (cw@graph, 'lfc') > A B C > -3 0 3 > >> control.points <- c (-3.0, 0.0, 3.0) # typical range of log-fold- change ratio values >> node.colors <- c ("#00AA00", "#00FF00", "#FFFFFF", "#FF0000", "#AA0000") >> noa (cw@graph, 'lfc') # do this again, just to be sure > A B C > -3 0 3 >> setNodeColorRule (cw, node.attribute.name='lfc', control.points, node.colors, mode='interpolate') >> redraw (cw) > > - Paul > > > On Mar 17, 2012, at 11:04 AM, Burak Kutlu wrote: > >> Hi Paul >> Thanks for the prompt response!! >> >> Here's the output which looks identical to yours. >> >>> noa.names (cw@graph) >> [1] "type" "lfc" "label" "count" >>> noa (cw@graph, 'lfc') >> A B C >> -3 0 3 >> >> -burak >> >> On Mar 17, 2012, at 11:02 AM, Paul Shannon wrote: >> >>> noa.names (cw@graph) >>> noa (cw@graph, 'lfc') >> > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Hi Burak, On Mar 17, 2012, at 12:08 PM, Burak Kutlu wrote: > Hi Paul > A little bit of Zen was really helpful: the example you provided, when executed in a calm, quiet place, works :-) Whew! Glad to hear that everything now works for you. > There are a couple of things going on here: please confirm if you agree. > > 1. The only difference between the example in the help page and the example you provide is " displayGraph(cw) " call after creating the Cytoscape Window object. May I suggest including that in the help page example for both setNodeColorRule and setEdgeColorRule? > > More specifically: > I would insert displayGraph(cw) after this line > cw <- new.CytoscapeWindow ('setNodeColorRule.test', graph=makeSimpleGraph()) Thanks -- good suggestion. 'displayGraph' should be in ALL of the examples. It will be with the new bioc release. > I realize that I am still confused when to call displayGraph or redraw, after already calling displayGraph for the first time. Can you comment on this? > > 2. You tried earlier in vain to convince me to initiate the edge attributes. Calling "InitEdgeAttributes" solved the issues I was having. Now I am really convinced. I am still confused, though, why you force this even when attributes exist for all edges. > I would be glad to hear any suggestions on this topic. Here is the current story: I try to motivate, explain, and justify initEdgeAttributes and initNodeAttributes in the RCy vignette which is excerpted below. The short version: Bioconductor graph classes require nodeDataDefaults and edgeDataDefaults method calls to initialize the attribute slots. RCy wraps those methods in the 'init[Node|Edge]Attribute methods, which additionally require you to specify the type of the attribute. Thus there are no EXTRA methods to call in initializing a graph, just replacement methods, which wrap and supersede edgeDataDefaults and nodeDataDefaults Maybe there is a better way to do this?
ADD REPLY

Login before adding your answer.

Traffic: 606 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6