Hi Paul
Thanks a lot for ur help and sorry for being late since my system
broke
after upgrading my system.
I managed to execute my example program as desired by following your
suggestion in the prev mail. However, my actual data it is still
showing the
error.
#This is my example program which is working fine now
g <- new ('graphNEL', edgemode='directed')
nodesFr = c('A', 'B', 'C')
nodesTo =c('D', 'E', 'F')
nodesAll = union(nodesFr, nodesTo)
nElemFr = length(nodesFr)
nElemTo = length(nodesTo)
#add all the nodes to the graph
g <- graph::addNode(nodesAll, g)
#create cytoscape window
cw <- CytoscapeWindow ('smallExample', graph=g)
displayGraph (cw)
#calculate the location of 'From' nodes
locx= rep(400, nElemFr)
yPos = 100
incr = ceiling(600/nElemFr)
locy = c()
for(j in 1: nElemFr) {locy = c(locy, (yPos+j*incr))}
setPosition(cw, nodesFr , locx, locy)
#calculate the location of 'To' nodes
locx= rep(600, nElemTo)
yPos = 100
incr = ceiling(600/nElemTo)
locy = c()
for(j in 1: nElemTo) {locy = c(locy, (yPos+j*incr))}
setPosition(cw, nodesTo , locx, locy)
#add edge to the graph: Suppose the edges are: (A ->D , A -> E, B ->E,
C->F,
C->E)
edgeList = rbind(c('A', 'D'),rbind(c('A','E'), rbind(c('B','E'),
rbind(c('C','F'), c('C', 'E')))))
for(j in 1: length(edgeList[,1]))
{
g = graph::addEdge(edgeList[j,1], edgeList[j,2], g)
}
cw@graph = g
layout (cw, 'jgraph-spring')
displayGraph(cw)
#This works fine and show output as desired in cytoscape
#########################
#However, an error is shown in the following code which is almost
similar
to the example code above.
> g <- new ('graphNEL', edgemode='undirected')
> cw <- new.CytoscapeWindow ('intxOutFromSkin', graph=g)
> displayGraph (cw)
entering RCytoscape::displayGraph
RCytoscape::displayGraph, empty graph, returning
NULL
> intxn = read.csv(fileNames[i], header=TRUE); # the edge list is
represented as node pair
> numEdge = length(intxn[,1])
> to = sort(unique(as.character(intxn[,'to']))) #find unique
destination
nodes
> g <- graph::addNode(to, g) #add nodes to the graph
> nNodes = length(to)
> locx = rep(i*150, nNodes)
> yPos = 10
> incr = ceiling(600/nNodes)
> locy = c()
> for(j in 1: nElem) {locy = c(locy, (yPos+j*incr))}
> setPosition(cw, to , locx, locy)
Error in convertToR(xmlParse(node, asText = TRUE)) :
faultCode: 1001 faultString: Node with id: 10108 could not be found.
>
I am not sure why this error is coming as '10108' is already a node in
the
the graph (g)
> nodes(g)
[1] "10108" "102056" "106563" "106873" "107425" "107886" "113095"
"11369"
[9] "118326" "118596" "119236" "119823" "119827" "124746" "125026"
"125212"
[17] "130086" "130658" "131786" "131860" "136566" "136742" "137170"
"137540"
[..............
#######
SessionInfo()
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] hash_2.0.1 RCytoscape_1.1.32 XMLRPC_0.2-4 RBGL_1.26.0
[5] graph_1.28.0
loaded via a namespace (and not attached):
[1] RCurl_1.5-0 tools_2.12.1 XML_3.2-0
>
Thanks a lot for your reply.
--Fahim
On Mon, Feb 14, 2011 at 9:57 AM, Paul Shannon
<pshannon@systemsbiology.org>wrote:
> 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@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
>
>
--
Fahim Mohammad
Bioinforformatics Lab
University of Louisville
Louisville, KY, USA
Ph: +1-502-409-1167
[[alternative HTML version deleted]]