Learn R Programming

NetPathMiner (version 1.8.0)

plotCytoscape: Plots an annotated igraph object in Cytoscape.

Description

Thess functions provide ways to plot igraph object in Cytoscape, enabling interactive investigation of the network. plotCytoscape uses RCytoscape interface to plot graphs in Cytoscape directly form R. The function is compatible with Cytoscape 2.8.3 or lower, and requires an open Cytoscape window, with CytoscapeRPC plugin installed and activated. plotCytoscapeGML exports the network plot in GML format, that can be later imported into Cytoscape (using "import network from file" option). This fuction is compatible with all Cytoscape versions.

Usage

plotCytoscape(graph, title, layout = layout.auto, vertex.size, vertex.label, vertex.shape, vertex.color, edge.color)
plotCytoscapeGML(graph, file, layout = layout.auto, vertex.size, vertex.label, vertex.shape, vertex.color, edge.color)

Arguments

graph
An annotated igraph object.
title
Will be set as a window title in Cytoscape.
file
Output GML file name to which the network plot is exported.
layout
Either a graph layout function, or a two-column matrix specifiying vertex coordinates.
vertex.size
Vertex size. If missing, the vertex attribute "size" (
V(g)$size)
) will be used.
vertex.label
Vertex labels. If missing, the vertex attribute "label" (
V(g)$label)
) will be used. If missing, vertices are labeled by their name.
vertex.shape
Vertex shape in one of igraph shapes. If missing, the vertex attribute "shape" (
V(g)$shape)
) will be used. Shapes are converted from igraph convention to Cytoscape convention. "square","rectangle" and "vrectangle" are converted to "RECT", "csquare" and "crectangle" are converted to "ROUND_RECT", all other shapes are considered "ELLIPSE"
vertex.color
A color or a list of colors for vertices. Vetices with multiple colors are not supported. If missing, the vertex attribute "color" (
V(g)$color)
) will be used.
edge.color
A color or a list of colors for edges. If missing, the edge attribute "color" (
E(g)$color)
) will be used.

Value

A CytoscapeWindow object constructed by new.CytoscapeWindow.For plotCytoscapeGML, results are written to file.

See Also

Other Plotting methods: colorVertexByAttr; layoutVertexByAttr; plotAllNetworks; plotClassifierROC; plotClusterMatrix, plotClusterProbs, plotClusters; plotNetwork; plotPathClassifier; plotPaths

Examples

Run this code
data("ex_sbml")
	rgraph <- makeReactionNetwork(ex_sbml, simplify=TRUE)
 v.layout <- layoutVertexByAttr(rgraph, "compartment")
	v.color <- colorVertexByAttr(rgraph, "compartment")

## Not run: 
# 	cw<-plotCytoscape(rgraph, title="example", layout = v.layout,
# 				vertex.size = 5, vertex.color = v.color)
# ## End(Not run)
# Export network plot to GML file
 plotCytoscapeGML(rgraph, file="example.gml", layout=v.layout,
				vertex.color=v.color, vertex.size=10)

Run the code above in your browser using DataLab