edu.iastate.metnet.dao
Class PathwayGraphImpl

java.lang.Object
  extended by edu.iastate.metnet.dao.PathwayGraphImpl
All Implemented Interfaces:
PathwayGraph, java.io.Serializable

public class PathwayGraphImpl
extends java.lang.Object
implements java.io.Serializable, PathwayGraph

a simple pathway graph to detect the structure change.

Author:
Jie Li
See Also:
Serialized Form

Constructor Summary
PathwayGraphImpl()
          default constructor
 
Method Summary
 void addEdge(java.lang.Integer leftId, java.lang.Integer rightId)
          add an edge
 void addNode(PathwayElementNode node)
          add an element
 java.util.Map getAllEbidEidMap()
          get the entity blockid->entityid mapping for comparison
 java.util.List getAllEbidList()
          get all entity node bid list
 java.util.List getAllIbidList()
          get all interaction node bid list
 java.util.Set getContext(java.lang.Integer ibid)
          get all entity id around the interaction in specified steps.
 java.util.List getDownstreamEntityNodeIdList(java.lang.Integer blockId)
          get the downstream entity node id list
 java.util.List getDownstreamInteractionNodeIdList(java.lang.Integer blockId)
          get the downstream interaction node id list
 java.util.List getDownstreamNodeIdList(java.lang.Integer blockId)
          get the list of new version record
 PathwayElementNode getNode(java.lang.Integer nodeId)
          return a node by id
 java.util.Map getNodeMap()
           
 java.util.Set getPbidSet()
           
 InteractionStructure getSignature(java.lang.Integer ibid)
          generate the signature of an interaction based on the entityid, the format is (left entity id 1, left entity id 2, ...; right id 1, right id 2, ...) without any space.
 java.util.List getUpstreamEntityNodeIdList(java.lang.Integer blockId)
          get the upstream entity node id list
 java.util.List getUpstreamInteractionNodeIdList(java.lang.Integer blockId)
          get the upstream interaction node id list
 java.util.List getUpstreamNodeIdList(java.lang.Integer blockId)
          get the list of old version record
 boolean isControlInteraction(java.lang.Integer blockId)
          if this is a control interaction
 boolean isDetachableInteraction(java.lang.Integer ibid)
          check if the node specified by the blockid can be detached from the pathway structure
 boolean isEntitywithlocation(java.lang.Integer blockId)
          if it is an entitywithlocation
 boolean isInteraction(java.lang.Integer blockId)
          if it is an interaction
 boolean isNormalInteraction(java.lang.Integer blockId)
          if it is a normal interaction
 PathwayAlignment isomorphism(PathwayGraph graph, AlignmentAlgorithm algorithm)
          run isomorphism
 void removeNode(java.lang.Integer nodeId)
          remove a node from the pathway structure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathwayGraphImpl

public PathwayGraphImpl()
default constructor

Method Detail

addNode

public void addNode(PathwayElementNode node)
Description copied from interface: PathwayGraph
add an element

Specified by:
addNode in interface PathwayGraph
Parameters:
node - the structure node information

getNode

public PathwayElementNode getNode(java.lang.Integer nodeId)
return a node by id

Specified by:
getNode in interface PathwayGraph
Parameters:
nodeId - the blockid of the node
Returns:
the node

removeNode

public void removeNode(java.lang.Integer nodeId)
Description copied from interface: PathwayGraph
remove a node from the pathway structure

Specified by:
removeNode in interface PathwayGraph
Parameters:
nodeId - the node id of the pathway element

isEntitywithlocation

public boolean isEntitywithlocation(java.lang.Integer blockId)
                             throws NoSuchNodeException
Description copied from interface: PathwayGraph
if it is an entitywithlocation

Specified by:
isEntitywithlocation in interface PathwayGraph
Parameters:
blockId - the blockid of the entitywithlocation
Returns:
true if it is an entitywithlocation, false if not
Throws:
NoSuchNodeException - the node id does not exist

isInteraction

public boolean isInteraction(java.lang.Integer blockId)
                      throws NoSuchNodeException
Description copied from interface: PathwayGraph
if it is an interaction

Specified by:
isInteraction in interface PathwayGraph
Parameters:
blockId - the blockid of the node
Returns:
true if it is an interaction, false if not
Throws:
NoSuchNodeException - the node id does not exist

isNormalInteraction

public boolean isNormalInteraction(java.lang.Integer blockId)
                            throws NoSuchNodeException
Description copied from interface: PathwayGraph
if it is a normal interaction

Specified by:
isNormalInteraction in interface PathwayGraph
Parameters:
blockId - the blockid of the node
Returns:
true if it is a normal interaction, false if not
Throws:
NoSuchNodeException - the node id does not exist

isControlInteraction

public boolean isControlInteraction(java.lang.Integer blockId)
                             throws NoSuchNodeException
Description copied from interface: PathwayGraph
if this is a control interaction

Specified by:
isControlInteraction in interface PathwayGraph
Parameters:
blockId - the blockid of current node
Returns:
true if it is a control interaction, false if not
Throws:
NoSuchNodeException - the node id does not exist

getDownstreamNodeIdList

public java.util.List getDownstreamNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the list of new version record

Specified by:
getDownstreamNodeIdList in interface PathwayGraph
Parameters:
blockId - the record id to be query
Returns:
the list of new version record id

getUpstreamNodeIdList

public java.util.List getUpstreamNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the list of old version record

Specified by:
getUpstreamNodeIdList in interface PathwayGraph
Parameters:
blockId - the recordid to be query
Returns:
the list of old version record id

getUpstreamEntityNodeIdList

public java.util.List getUpstreamEntityNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the upstream entity node id list

Specified by:
getUpstreamEntityNodeIdList in interface PathwayGraph
Parameters:
blockId - the current node id
Returns:
the upstream entity node id list

getDownstreamEntityNodeIdList

public java.util.List getDownstreamEntityNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the downstream entity node id list

Specified by:
getDownstreamEntityNodeIdList in interface PathwayGraph
Parameters:
blockId - the current node id
Returns:
the downstream entity node id list

getUpstreamInteractionNodeIdList

public java.util.List getUpstreamInteractionNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the upstream interaction node id list

Specified by:
getUpstreamInteractionNodeIdList in interface PathwayGraph
Parameters:
blockId - the current node id
Returns:
the upstream interaction node id list

getDownstreamInteractionNodeIdList

public java.util.List getDownstreamInteractionNodeIdList(java.lang.Integer blockId)
Description copied from interface: PathwayGraph
get the downstream interaction node id list

Specified by:
getDownstreamInteractionNodeIdList in interface PathwayGraph
Parameters:
blockId - the current node id
Returns:
the downstream interaction node id list

addEdge

public void addEdge(java.lang.Integer leftId,
                    java.lang.Integer rightId)
             throws NoSuchNodeException
Description copied from interface: PathwayGraph
add an edge

Specified by:
addEdge in interface PathwayGraph
Parameters:
leftId - the left node id
rightId - the right node id
Throws:
NoSuchNodeException - exception if one of nodes does not exist

isDetachableInteraction

public boolean isDetachableInteraction(java.lang.Integer ibid)
check if the node specified by the blockid can be detached from the pathway structure

Parameters:
graph - the pathway graph structure
checkedBlockId - the blockid of the node to be checked
Returns:
true if can be detached, false if not

getAllIbidList

public java.util.List getAllIbidList()
get all interaction node bid list

Specified by:
getAllIbidList in interface PathwayGraph
Returns:
all interaction node bid list

getAllEbidList

public java.util.List getAllEbidList()
get all entity node bid list

Specified by:
getAllEbidList in interface PathwayGraph
Returns:
all entity node bid list

getAllEbidEidMap

public java.util.Map getAllEbidEidMap()
get the entity blockid->entityid mapping for comparison

Specified by:
getAllEbidEidMap in interface PathwayGraph
Returns:
the blockid->entityid mapping

getNodeMap

public java.util.Map getNodeMap()
Specified by:
getNodeMap in interface PathwayGraph
Returns:
Returns the nodeMap.

isomorphism

public PathwayAlignment isomorphism(PathwayGraph graph,
                                    AlignmentAlgorithm algorithm)
run isomorphism

Specified by:
isomorphism in interface PathwayGraph
Parameters:
graph - the other pathway graph
algorithm - the alignment algorithm
Returns:
the alignment results

getSignature

public InteractionStructure getSignature(java.lang.Integer ibid)
generate the signature of an interaction based on the entityid, the format is (left entity id 1, left entity id 2, ...; right id 1, right id 2, ...) without any space. If the interaction is an control one, how to specify the interaction signature? we attach char 'I' before the blockid to indicate that it is a normal interaction in the right side. For a normal interaction, we do not consider the control interaction when creating the signature.

Specified by:
getSignature in interface PathwayGraph
Parameters:
ibid - the interaction blockid
Returns:
the signature, directional one.

getPbidSet

public java.util.Set getPbidSet()
Specified by:
getPbidSet in interface PathwayGraph
Returns:
Returns the pbidSet.

getContext

public java.util.Set getContext(java.lang.Integer ibid)
get all entity id around the interaction in specified steps.

Specified by:
getContext in interface PathwayGraph
Parameters:
ibid - the blockid of the interaction
Returns:
all entity id around the interaction in specified steps