[BioC] [R] RCytoscape setPosition error
Paul Shannon
pshannon at systemsbiology.org
Mon Feb 14 15:57:24 CET 2011
Hi Fahim,
There is an easily resolved omission in the sample code you sent.
Please note the the 3rd line below, 'displayGraph', which does not appear in your email. This method transmits your graph from R to Cytoscape, creating a Cytoscape network.
cw <- CytoscapeWindow ('smallExample', graph=RCytoscape::makeSimpleGraph())
displayGraph (cw) # this command sends your R graph to Cytoscape. I believe you left this out...
layout (cw, 'jgraph-spring')
redraw (cw)
setPosition (cw, 'A', 50, 80)
If you want to place 'A' directly between 'B' and 'C', try this:
pos.b <- getPosition (cw, 'B')[[1]] # where is B?
pos.c <- getPosition (cw, 'C')[[1]] # where is c?
new.x <- (pos.b$x + pos.c$x)/2 # calculate the x coordinate for A
new.y <- (pos.b$y + pos.c$y)/2 # and the y
setPosition (cw, 'A', new.x, new.y) # place A mid-way between B and C
Please try these steps, ensure that they work for you, then we can then look at the next spot where trouble arises for you.
Also, please attach your sessionInfo. It may be wise to update your code to the latest version of the package.
Cheers!
- Paul
On Feb 14, 2011, at 5:25 AM, Martin Morgan wrote:
> On 02/13/2011 11:28 AM, Fahim M wrote:
>> Hi
>> Can some one please point out where i am wrong.
>>
>> I am trying to position set of nodes column-wise in cytoscape using
>> RCytoscape
>> A----D
>> B----E
>> C----F
>
> Hi Fahim -- please ask questions about Bioconductor packages on the
> Bioconductor mailing list
>
> http://bioconductor.org/help/mailing-list/
>
> and include packageMaintainer('RCytoscape') in the post.
>
> Martin
>
>>
>> -------------------
>>
>> g <- new ('graphNEL', edgemode='undirected')
>> cw <- CytoscapeWindow ('smallExample', graph=RCytoscape::makeSimpleGraph())
>> layout (cw, 'jgraph-spring')
>> redraw(cw)
>>
>> nodesFr = c('A', 'B', 'C')
>> nodesTo =c('D', 'E', 'F')
>> nodesAll = union(nodesFr, nodesTo)
>>
>> nElemFr = length(nodesFr)
>> nElemTo = length(nodesTo)
>>
>> g <- graph::addNode(nodesAll, g)
>>
>> setPosition(cw, nodesFr , c(400, 400, 400), c(100, 200, 300))
>> setPosition(cw, nodesTo , c(600, 600, 600), c(100, 200, 300))
>> Error in convertToR(xmlParse(node, asText = TRUE)) :
>> faultCode: 0 faultString: Failed to invoke method setNodesPositions in
>> class tudelft.CytoscapeRPC.CytoscapeRPCCallHandler: null
>>
>> setPosition(cw, nodesTo , c(600, 600, 600), c(100, 200, 300))
>> Error in convertToR(xmlParse(node, asText = TRUE)) :
>> faultCode: 1001 faultString: Node with id: D could not be found.
>>
>> Thanks
>> --Fahim
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> --
> Computational Biology
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>
> Location: M1-B861
> Telephone: 206 667-2793
More information about the Bioconductor
mailing list