edu.uconn.mcb.lineageevolver.graph
Class EdgeListGraphTopology

java.lang.Object
  extended byedu.uconn.mcb.lineageevolver.graph.EdgeListGraph
      extended byedu.uconn.mcb.lineageevolver.graph.EdgeListGraphTopology
All Implemented Interfaces:
DirectedGraph, GraphTopology

public class EdgeListGraphTopology
extends EdgeListGraph
implements GraphTopology

Implementation of a GraphTopology using an EdgeListGraph

Author:
Hasan Khalil

Nested Class Summary
protected  class EdgeListGraphTopology.EdgeData
          Encapsulation class used for storing multiple items inside an edge for EdgeListGraphTopology objects.
protected  class EdgeListGraphTopology.NodeData
          Encapuslation class used for storing multiple items inside a node for EdgeListGraphTopology objects.
 
Field Summary
 
Fields inherited from class edu.uconn.mcb.lineageevolver.graph.EdgeListGraph
 
Constructor Summary
EdgeListGraphTopology()
           
 
Method Summary
 GraphEdge addEdge(java.lang.Object data, GraphNode origin, GraphNode destination)
          Adds an edge to this graph.
 void addEvent(GenomeVisitor v, GraphEdge edge, int time)
          Adds an event to a given edge, provided a time interval and a GenomeVisitor.
 GraphNode addNode(java.lang.Object data)
          Adds a node to this graph.
 void applyEvent(GraphTopologyEvent event, Lineage l)
          Applies an event to a Lineage.
 java.lang.Object getData(GraphEdge e)
          Returns the data stored inside a given edge.
 java.lang.Object getData(GraphNode v)
          Returns the data stored inside a given node.
 GraphEdge getEdge(GraphTopologyEvent event)
          Returns the edge associated to a given event.
 GraphTopologyEvent getEvent(GraphEdge e)
          Returns the next event on the given edge corresponding to the current position on that edge.
 Genome getGenome(GraphNode v)
          Returns genome stored in the given node.
 java.lang.String getName(GraphNode v)
          Returns the name of the given node.
 int nextEventTime(GraphEdge e)
          Gets the evolutionary distance between the current position and the next event on the given edge, in time intervals.
 void setData(GraphEdge e, java.lang.Object data)
          Sets the data for a given edge.
 void setData(GraphNode v, java.lang.Object data)
          Sets the data for a given node.
 void setGenome(GraphNode v, Genome g)
          Sets the genome for a given node.
 void setName(GraphNode v, java.lang.String name)
          Sets the name for a given node.
 void setSubstitutions(GraphEdge e, int substitutions)
          Sets the branch length for the given edge.
 void setTime(GraphEdge e, int time)
          Sets the time associated to the given edge.
 void substitute(GraphEdge e, int time)
          Processes substitution on a given edge for a given amount of time.
 float substitutionsPerTime(GraphEdge e)
          Returns the number of substitutions per time interval for the given edge.
 
Methods inherited from class edu.uconn.mcb.lineageevolver.graph.EdgeListGraph
getAdjacentNodes, getEdges, getNodes, getNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uconn.mcb.lineageevolver.graph.DirectedGraph
getAdjacentNodes, getEdges, getNodes, getNodes
 

Constructor Detail

EdgeListGraphTopology

public EdgeListGraphTopology()
Method Detail

nextEventTime

public int nextEventTime(GraphEdge e)
Description copied from interface: GraphTopology
Gets the evolutionary distance between the current position and the next event on the given edge, in time intervals.

Specified by:
nextEventTime in interface GraphTopology
Parameters:
e - the edge on which to operate.
Returns:
the number of time intervals between the current position and the next event on the given edge.
See Also:
GraphTopology.nextEventTime(GraphEdge)

substitutionsPerTime

public float substitutionsPerTime(GraphEdge e)
Description copied from interface: GraphTopology
Returns the number of substitutions per time interval for the given edge.

Specified by:
substitutionsPerTime in interface GraphTopology
Parameters:
e - the edge on which to operate.
Returns:
the number of substitutions per time interval for the given edge.
See Also:
GraphTopology.substitutionsPerTime(edu.uconn.mcb.lineageevolver.graph.GraphEdge)

getEvent

public GraphTopologyEvent getEvent(GraphEdge e)
Description copied from interface: GraphTopology
Returns the next event on the given edge corresponding to the current position on that edge.

Specified by:
getEvent in interface GraphTopology
Parameters:
e - the edge on which to operate.
Returns:
the next event on the given edge.
See Also:
GraphTopology.getEvent(edu.uconn.mcb.lineageevolver.graph.GraphEdge)

addEvent

public void addEvent(GenomeVisitor v,
                     GraphEdge edge,
                     int time)
Description copied from interface: GraphTopology
Adds an event to a given edge, provided a time interval and a GenomeVisitor.

Specified by:
addEvent in interface GraphTopology
Parameters:
v - the GenomeVisitor encapsulating the functionality for the newly generated event.
edge - the edge to which the event should be added.
time - the number of time intervals along the given edge that should be processed before the newly generated event is processed.
See Also:
GraphTopology.addEvent(edu.uconn.mcb.lineageevolver.GenomeVisitor, edu.uconn.mcb.lineageevolver.graph.GraphEdge, int)

getEdge

public GraphEdge getEdge(GraphTopologyEvent event)
Description copied from interface: GraphTopology
Returns the edge associated to a given event.

Specified by:
getEdge in interface GraphTopology
Parameters:
event - the event whose edge should be returned.
Returns:
the edge corresponding to the given event.
See Also:
GraphTopology.getEdge(edu.uconn.mcb.lineageevolver.graph.GraphTopologyEvent)

applyEvent

public void applyEvent(GraphTopologyEvent event,
                       Lineage l)
Description copied from interface: GraphTopology
Applies an event to a Lineage.

Specified by:
applyEvent in interface GraphTopology
Parameters:
event - the event to apply.
l - the Lineage to which the event is applied.
See Also:
GraphTopology.applyEvent(edu.uconn.mcb.lineageevolver.graph.GraphTopologyEvent, edu.uconn.mcb.lineageevolver.Lineage)

getData

public java.lang.Object getData(GraphEdge e)
Description copied from interface: DirectedGraph
Returns the data stored inside a given edge.

Specified by:
getData in interface DirectedGraph
Overrides:
getData in class EdgeListGraph
See Also:
DirectedGraph.getData(edu.uconn.mcb.lineageevolver.graph.GraphEdge)

setData

public void setData(GraphEdge e,
                    java.lang.Object data)
Description copied from interface: DirectedGraph
Sets the data for a given edge.

Specified by:
setData in interface DirectedGraph
Overrides:
setData in class EdgeListGraph
See Also:
DirectedGraph.setData(edu.uconn.mcb.lineageevolver.graph.GraphEdge, java.lang.Object)

getGenome

public Genome getGenome(GraphNode v)
Description copied from interface: GraphTopology
Returns genome stored in the given node.

Specified by:
getGenome in interface GraphTopology
Parameters:
v - the node for which to retrieve the genome.
Returns:
the genome inside the specified node.
See Also:
GraphTopology.getGenome(edu.uconn.mcb.lineageevolver.graph.GraphNode)

getName

public java.lang.String getName(GraphNode v)
Description copied from interface: GraphTopology
Returns the name of the given node.

Specified by:
getName in interface GraphTopology
Parameters:
v - the node for which to return the name.
Returns:
the name of the specified node.
See Also:
GraphTopology.getName(edu.uconn.mcb.lineageevolver.graph.GraphNode)

setGenome

public void setGenome(GraphNode v,
                      Genome g)
Description copied from interface: GraphTopology
Sets the genome for a given node.

Specified by:
setGenome in interface GraphTopology
Parameters:
v - the node in which to store the provided genome.
g - the genome to store in this node.
See Also:
GraphTopology.setGenome(GraphNode, Genome)

setName

public void setName(GraphNode v,
                    java.lang.String name)
Description copied from interface: GraphTopology
Sets the name for a given node.

Specified by:
setName in interface GraphTopology
Parameters:
v - the node for which to set the name.
name - the new name for the provided node.
See Also:
GraphTopology.setName(edu.uconn.mcb.lineageevolver.graph.GraphNode, java.lang.String)

addEdge

public GraphEdge addEdge(java.lang.Object data,
                         GraphNode origin,
                         GraphNode destination)
Description copied from interface: DirectedGraph
Adds an edge to this graph.

Specified by:
addEdge in interface DirectedGraph
Overrides:
addEdge in class EdgeListGraph
See Also:
Creates an edge with 0 time, 0 substitutions, and no events.

addNode

public GraphNode addNode(java.lang.Object data)
Description copied from interface: DirectedGraph
Adds a node to this graph.

Specified by:
addNode in interface DirectedGraph
Overrides:
addNode in class EdgeListGraph
See Also:
Creates a node with id 0, and null name.

getData

public java.lang.Object getData(GraphNode v)
Description copied from interface: DirectedGraph
Returns the data stored inside a given node.

Specified by:
getData in interface DirectedGraph
Overrides:
getData in class EdgeListGraph
See Also:
DirectedGraph.getData(edu.uconn.mcb.lineageevolver.graph.GraphNode)

setData

public void setData(GraphNode v,
                    java.lang.Object data)
Description copied from interface: DirectedGraph
Sets the data for a given node.

Specified by:
setData in interface DirectedGraph
Overrides:
setData in class EdgeListGraph
See Also:
DirectedGraph.setData(edu.uconn.mcb.lineageevolver.graph.GraphNode, java.lang.Object)

substitute

public void substitute(GraphEdge e,
                       int time)
Description copied from interface: GraphTopology
Processes substitution on a given edge for a given amount of time.

Specified by:
substitute in interface GraphTopology
Parameters:
e - the edge on which to process substitutution.
time - the amount of time to process substitution for.
See Also:
GraphTopology.substitute(edu.uconn.mcb.lineageevolver.graph.GraphEdge, int)

setSubstitutions

public void setSubstitutions(GraphEdge e,
                             int substitutions)
Description copied from interface: GraphTopology
Sets the branch length for the given edge.

Specified by:
setSubstitutions in interface GraphTopology
Parameters:
e - the edge for which to set the number of substitutions.
substitutions - the number of substitutions to set for the given edge.
See Also:
GraphTopology.setSubstitutions(edu.uconn.mcb.lineageevolver.graph.GraphEdge, int)

setTime

public void setTime(GraphEdge e,
                    int time)
Description copied from interface: GraphTopology
Sets the time associated to the given edge.

Specified by:
setTime in interface GraphTopology
Parameters:
e - the edge for which to set the number of time intervals.
time - the number of time intervals to set for the given edge.
See Also:
GraphTopology.setTime(edu.uconn.mcb.lineageevolver.graph.GraphEdge, int)