Cytoscape 2.8.0 API

cytoscape.data.readers
Class GMLReader

java.lang.Object
  extended by cytoscape.data.readers.AbstractGraphReader
      extended by cytoscape.data.readers.GMLReader
All Implemented Interfaces:
GraphReader

public class GMLReader
extends AbstractGraphReader

This class is responsible for converting a gml object tree into cytoscape objects New features to the current version: 1. Small bug fixes. 2. Translate all features in the GML file. This includes 3. New Visual Style will be generated when you call this class. The new style saves all visual features (like node shape) and will not be lost even after other style selected.


Field Summary
protected static String ARROW
           
protected static String ARROW_BOTH
           
protected static String ARROW_FIRST
           
protected static String ARROW_LAST
           
protected static String ARROW_NONE
           
protected static String COMMENT
           
protected static String CREATOR
           
protected static String CURVED_LINES
           
protected static String DEFAULT_EDGE_INTERACTION
           
protected static String DIAMOND
           
protected static String EDGE
           
protected static String ELLIPSE
           
protected static String FILL
           
protected static String GRAPH
           
protected static String GRAPHICS
           
protected static String H
           
protected static String HEXAGON
           
protected static String ID
          The following are all taken to be reserved keywords for gml (note that not all of them are actually keywords according to the spec) Currently, only keywords below are supported by the Visual Style generation methods.
protected static String LABEL
           
protected static String LINE
           
protected static String NAME
           
protected static String NODE
           
protected static String OCTAGON
           
protected static String OUTLINE
           
protected static String OUTLINE_WIDTH
           
protected static String PARALELLOGRAM
           
protected static String POINT
           
protected static String RECTANGLE
           
protected static String ROOT_INDEX
           
protected static String SOURCE
           
protected static String SOURCE_ARROW
           
protected static String STRAIGHT_LINES
           
protected static String TARGET
           
protected static String TARGET_ARROW
           
protected static String TITLE
           
protected static String TRIANGLE
           
protected static String TYPE
           
protected static String VERSION
           
protected static String W
           
protected static String WIDTH
           
protected static String X
           
protected static String Y
           
protected static String YED_DELTA
           
protected static String YED_DIAMOND
           
protected static String YED_SHORT
           
protected static String YED_SOURCE_ARROW
           
protected static String YED_STANDARD
           
protected static String YED_TARGET_ARROW
           
protected static String YED_WHITE_DELTA
           
protected static String YED_WHITE_DIAMOND
           
 
Fields inherited from class cytoscape.data.readers.AbstractGraphReader
fileName, title
 
Constructor Summary
GMLReader(InputStream is, String name)
          Constructor.
This is usually used for remote file loading.
GMLReader(String filename)
          Constructor.
GMLReader(String filename, TaskMonitor taskMonitor)
          Constructor.
 
Method Summary
protected  void createGraph()
          This will create the graph model objects.
 void doPostProcessing(CyNetwork net)
          DOCUMENT ME!
 void extract()
          DOCUMENT ME!
protected  void extractEdge(List<KeyValue> list, String edgeName)
           
protected  void extractEdgeAttributes(List<KeyValue> list, String edgeName)
           
protected  void extractGraph(List list)
           
protected  void extractNode(List list)
           
protected  void extractNodeAttributes(List list, String nodeName)
           
 Color getColor(String colorString)
          Create a color object from the string like it is stored in a gml file
 int[] getEdgeIndicesArray()
          Part of interace contract
 CyLayoutAlgorithm getLayoutAlgorithm()
          getLayoutAlgorithm is called to get the Layout Algorithm that will be used to layout the resulting graph.
 List<KeyValue> getList()
          Returns a list containing the gml object tree
 int[] getNodeIndicesArray()
          Part of interface contract
protected  void initializeStructures()
           
 void layout(CyNetworkView myView)
          layout the graph based on the GML values we read
protected  void layoutEdge(GraphView myView, List list, String edgeName)
          Assign edge visual properties based on pairs in the list matched to the "edge" key world
protected  void layoutEdgeGraphics(GraphView myView, List<KeyValue> list, EdgeView edgeView)
          Assign edge graphics properties
protected  void layoutEdgeGraphicsLine(GraphView myView, List list, EdgeView edgeView)
          Assign bend points based on the contents of the list associated with a "Line" key We make sure that there is both an x,y present in the underlying point list before trying to generate a bend point
protected  void layoutGraph(GraphView myView, List list)
          Lays Out the Graph, based on GML.
protected  void layoutNode(GraphView myView, List list)
          Assign node properties based on the values in the list matched to the "node" key.
protected  void layoutNodeGraphics(GraphView myView, List list, NodeView nodeView)
          This will assign node graphic properties based on the values in the list matches to the "graphics" key word
 void read()
          Read GML file contents
protected  void readEdge(List<KeyValue> list)
          This will extract the model information from the list which is matched to an "edge" key.
protected  void readGML(List<KeyValue> list)
          This function takes the root level list which defines a gml objec tree
protected  void readGraph(List<KeyValue> list)
          This function takes in a list which was given as the value to a "graph" key underneath the main gml list
protected  void releaseStructures()
           
 void setTaskMonitor(TaskMonitor monitor)
          Sets the task monitor we want to use
 void showMaps()
          DOCUMENT ME!
 
Methods inherited from class cytoscape.data.readers.AbstractGraphReader
getNetworkName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

protected static final String ID
The following are all taken to be reserved keywords for gml (note that not all of them are actually keywords according to the spec) Currently, only keywords below are supported by the Visual Style generation methods. (Maybe we need some documents on "cytoscape-style" GML format...)

See Also:
Constant Field Values

NAME

protected static final String NAME
See Also:
Constant Field Values

LABEL

protected static final String LABEL
See Also:
Constant Field Values

COMMENT

protected static final String COMMENT
See Also:
Constant Field Values

VERSION

protected static final String VERSION
See Also:
Constant Field Values

CREATOR

protected static final String CREATOR
See Also:
Constant Field Values

TITLE

protected static final String TITLE
See Also:
Constant Field Values

GRAPH

protected static final String GRAPH
See Also:
Constant Field Values

NODE

protected static final String NODE
See Also:
Constant Field Values

EDGE

protected static final String EDGE
See Also:
Constant Field Values

GRAPHICS

protected static final String GRAPHICS
See Also:
Constant Field Values

SOURCE

protected static final String SOURCE
See Also:
Constant Field Values

TARGET

protected static final String TARGET
See Also:
Constant Field Values

X

protected static final String X
See Also:
Constant Field Values

Y

protected static final String Y
See Also:
Constant Field Values

H

protected static final String H
See Also:
Constant Field Values

W

protected static final String W
See Also:
Constant Field Values

TYPE

protected static final String TYPE
See Also:
Constant Field Values

ROOT_INDEX

protected static final String ROOT_INDEX
See Also:
Constant Field Values

RECTANGLE

protected static final String RECTANGLE
See Also:
Constant Field Values

ELLIPSE

protected static final String ELLIPSE
See Also:
Constant Field Values

LINE

protected static final String LINE
See Also:
Constant Field Values

POINT

protected static final String POINT
See Also:
Constant Field Values

DIAMOND

protected static final String DIAMOND
See Also:
Constant Field Values

HEXAGON

protected static final String HEXAGON
See Also:
Constant Field Values

OCTAGON

protected static final String OCTAGON
See Also:
Constant Field Values

PARALELLOGRAM

protected static final String PARALELLOGRAM
See Also:
Constant Field Values

TRIANGLE

protected static final String TRIANGLE
See Also:
Constant Field Values

FILL

protected static final String FILL
See Also:
Constant Field Values

WIDTH

protected static final String WIDTH
See Also:
Constant Field Values

STRAIGHT_LINES

protected static final String STRAIGHT_LINES
See Also:
Constant Field Values

CURVED_LINES

protected static final String CURVED_LINES
See Also:
Constant Field Values

SOURCE_ARROW

protected static final String SOURCE_ARROW
See Also:
Constant Field Values

TARGET_ARROW

protected static final String TARGET_ARROW
See Also:
Constant Field Values

YED_SOURCE_ARROW

protected static final String YED_SOURCE_ARROW
See Also:
Constant Field Values

YED_TARGET_ARROW

protected static final String YED_TARGET_ARROW
See Also:
Constant Field Values

YED_DELTA

protected static final String YED_DELTA
See Also:
Constant Field Values

YED_STANDARD

protected static final String YED_STANDARD
See Also:
Constant Field Values

YED_DIAMOND

protected static final String YED_DIAMOND
See Also:
Constant Field Values

YED_SHORT

protected static final String YED_SHORT
See Also:
Constant Field Values

YED_WHITE_DELTA

protected static final String YED_WHITE_DELTA
See Also:
Constant Field Values

YED_WHITE_DIAMOND

protected static final String YED_WHITE_DIAMOND
See Also:
Constant Field Values

ARROW

protected static final String ARROW
See Also:
Constant Field Values

ARROW_NONE

protected static final String ARROW_NONE
See Also:
Constant Field Values

ARROW_FIRST

protected static final String ARROW_FIRST
See Also:
Constant Field Values

ARROW_LAST

protected static final String ARROW_LAST
See Also:
Constant Field Values

ARROW_BOTH

protected static final String ARROW_BOTH
See Also:
Constant Field Values

OUTLINE

protected static final String OUTLINE
See Also:
Constant Field Values

OUTLINE_WIDTH

protected static final String OUTLINE_WIDTH
See Also:
Constant Field Values

DEFAULT_EDGE_INTERACTION

protected static final String DEFAULT_EDGE_INTERACTION
See Also:
Constant Field Values
Constructor Detail

GMLReader

public GMLReader(String filename)
Constructor.

Parameters:
filename - File name.

GMLReader

public GMLReader(InputStream is,
                 String name)
Constructor.
This is usually used for remote file loading.

Parameters:
is - Input stream of GML file,

GMLReader

public GMLReader(String filename,
                 TaskMonitor taskMonitor)
Constructor.

Parameters:
filename - File name.
taskMonitor - TaskMonitor Object.
Method Detail

setTaskMonitor

public void setTaskMonitor(TaskMonitor monitor)
Sets the task monitor we want to use

Overrides:
setTaskMonitor in class AbstractGraphReader
Parameters:
monitor - the TaskMonitor to use

read

public void read()
Read GML file contents

Specified by:
read in interface GraphReader
Specified by:
read in class AbstractGraphReader

getList

public List<KeyValue> getList()
Returns a list containing the gml object tree


initializeStructures

protected void initializeStructures()

releaseStructures

protected void releaseStructures()

createGraph

protected void createGraph()
This will create the graph model objects. This function expects node labels to be unique and edge labels to be unique between a particular source and target If this condition is not met, an error will be printed to the console, and the object will be skipped. That is, it is as though that particular object never existed in the gml file. If an edge depends on a node that was skipped, then that edge will be skipped as well.


readGML

protected void readGML(List<KeyValue> list)
This function takes the root level list which defines a gml objec tree


readGraph

protected void readGraph(List<KeyValue> list)
This function takes in a list which was given as the value to a "graph" key underneath the main gml list


readEdge

protected void readEdge(List<KeyValue> list)
This will extract the model information from the list which is matched to an "edge" key.


getLayoutAlgorithm

public CyLayoutAlgorithm getLayoutAlgorithm()
getLayoutAlgorithm is called to get the Layout Algorithm that will be used to layout the resulting graph. In our case, we just return a stub that will call our internal layout routine, which will just use the default layout, but with our task monitor

Specified by:
getLayoutAlgorithm in interface GraphReader
Overrides:
getLayoutAlgorithm in class AbstractGraphReader
Returns:
the CyLayoutAlgorithm to use

layout

public void layout(CyNetworkView myView)
layout the graph based on the GML values we read

Parameters:
myView - the view of the network we want to layout

extract

public void extract()
DOCUMENT ME!


extractGraph

protected void extractGraph(List list)

extractNode

protected void extractNode(List list)

extractEdge

protected void extractEdge(List<KeyValue> list,
                           String edgeName)

layoutGraph

protected void layoutGraph(GraphView myView,
                           List list)
Lays Out the Graph, based on GML.


layoutNode

protected void layoutNode(GraphView myView,
                          List list)
Assign node properties based on the values in the list matched to the "node" key. Mostly just a wrapper around layoutNodeGraphics


layoutNodeGraphics

protected void layoutNodeGraphics(GraphView myView,
                                  List list,
                                  NodeView nodeView)
This will assign node graphic properties based on the values in the list matches to the "graphics" key word


extractNodeAttributes

protected void extractNodeAttributes(List list,
                                     String nodeName)

extractEdgeAttributes

protected void extractEdgeAttributes(List<KeyValue> list,
                                     String edgeName)

showMaps

public void showMaps()
DOCUMENT ME!


layoutEdge

protected void layoutEdge(GraphView myView,
                          List list,
                          String edgeName)
Assign edge visual properties based on pairs in the list matched to the "edge" key world


layoutEdgeGraphics

protected void layoutEdgeGraphics(GraphView myView,
                                  List<KeyValue> list,
                                  EdgeView edgeView)
Assign edge graphics properties


layoutEdgeGraphicsLine

protected void layoutEdgeGraphicsLine(GraphView myView,
                                      List list,
                                      EdgeView edgeView)
Assign bend points based on the contents of the list associated with a "Line" key We make sure that there is both an x,y present in the underlying point list before trying to generate a bend point


getNodeIndicesArray

public int[] getNodeIndicesArray()
Part of interface contract

Specified by:
getNodeIndicesArray in interface GraphReader
Overrides:
getNodeIndicesArray in class AbstractGraphReader
Returns:
DOCUMENT ME!

getEdgeIndicesArray

public int[] getEdgeIndicesArray()
Part of interace contract

Specified by:
getEdgeIndicesArray in interface GraphReader
Overrides:
getEdgeIndicesArray in class AbstractGraphReader
Returns:
DOCUMENT ME!

getColor

public Color getColor(String colorString)
Create a color object from the string like it is stored in a gml file


doPostProcessing

public void doPostProcessing(CyNetwork net)
DOCUMENT ME!

Specified by:
doPostProcessing in interface GraphReader
Overrides:
doPostProcessing in class AbstractGraphReader
Parameters:
net - DOCUMENT ME!

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.