Class DataNode

All Implemented Interfaces:
java.lang.Cloneable, Drawable, GraphLink.LinkableTo, Groupable, Referenceable, Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable, Xrefable

public class DataNode
extends ShapedElement
implements Xrefable
This class stores information for a DataNode pathway element.
Author:
finterly
  • Field Details

    • textLabel

      private java.lang.String textLabel
    • type

      private DataNodeType type
    • states

      private java.util.List<DataNode.State> states
    • xref

      private org.bridgedb.Xref xref
    • aliasRef

      private Group aliasRef
  • Constructor Details

    • DataNode

      public DataNode​(java.lang.String textLabel, DataNodeType type, org.bridgedb.Xref xref, Group aliasRef)
      Instantiates a DataNode given all possible parameters. A DataNode of type Alias can have an aliasRef which refers to a Group and/or have a textLabel which points to a group somewhere.
      Parameters:
      textLabel - the text or link of this datanode.
      type - the type of datanode, e.g. complex.
      xref - the data node Xref.
      aliasRef - the group this data node alias refers to.
    • DataNode

      public DataNode​(java.lang.String textLabel, DataNodeType type)
      Instantiates a DataNode given all required parameters.
      Parameters:
      textLabel - the datanode text label.
      type - the datanode type.
  • Method Details

    • getObjectType

      public ObjectType getObjectType()
      Returns the object type of this pathway element.
      Specified by:
      getObjectType in interface Drawable
      Specified by:
      getObjectType in interface GraphLink.LinkableTo
      Specified by:
      getObjectType in class PathwayObject
      Returns:
      the object type.
    • getTextLabel

      public java.lang.String getTextLabel()
      Returns the text of this datanode.
      Specified by:
      getTextLabel in class ShapedElement
      Returns:
      textLabel the text of this datanode.
    • setTextLabel

      public void setTextLabel​(java.lang.String v)
      Sets the text of this shaped pathway element.
      Specified by:
      setTextLabel in class ShapedElement
      Parameters:
      v - the text to set.
    • getType

      public DataNodeType getType()
      Returns the type of this datanode.
      Returns:
      type the type of this datanode, e.g. complex.
    • setType

      public void setType​(DataNodeType v)
      Sets the type of this datanode, e.g. complex. NB: Cannot change type if this is an alias data node.
      Parameters:
      v - the type to set for this datanode.
    • getXref

      public org.bridgedb.Xref getXref()
      Returns the Xref for this datanode.
      Specified by:
      getXref in interface Xrefable
      Returns:
      xref the xref of this datanode.
    • setXref

      public void setXref​(org.bridgedb.Xref v)
      Sets the Xref for this datanode.
      Specified by:
      setXref in interface Xrefable
      Parameters:
      v - the xref to set for this datanode.
    • getStates

      public java.util.List<DataNode.State> getStates()
    • hasState

      public boolean hasState​(DataNode.State state)
      Checks whether states has the given state.
      Parameters:
      state - the state to look for.
      Returns:
      true if has state, false otherwise.
    • addState

      public void addState​(DataNode.State state)
      Adds given state to states list. Sets datanode for the given state.
      Parameters:
      state - the state to be added.
    • addState

      public DataNode.State addState​(java.lang.String textLabel, StateType type, double relX, double relY)
      Instantiates a state with the given properties. Adds new state to states list and pathway model.
      Parameters:
      textLabel - the text label of the state.
      type - the type of the state, e.g. protein modification.
      relX - the relative x coordinates.
      relY - the relative y coordinates.
      Returns:
      state the instantiated state.
    • addState

      public DataNode.State addState​(java.lang.String elementId, java.lang.String textLabel, StateType type, double relX, double relY)
      Instantiates a state with the given properties including elementId. Adds new state to states list and pathway model.
      Parameters:
      elementId - the elementId to set for the instantiated state.
      textLabel - the text label of the state.
      type - the type of the state, e.g. protein modification.
      relX - the relative x coordinates.
      relY - the relative y coordinates.
      Returns:
      state the instantiated state.
    • removeState

      public void removeState​(DataNode.State state)
      Removes given state from states list. State ceases to exist and is terminated.
      Parameters:
      state - the state to be removed.
    • removeStates

      private void removeStates()
      Removes all states from states list.
    • getAliasRef

      public Group getAliasRef()
      Returns the pathway element to which the data node refers to as an alias. In GPML, this is aliasRef which refers to the elementId of a pathway element (normally gpml:Group).
      Returns:
      aliasRef the pathway element to which the data node refers.
    • setAliasRef

      public void setAliasRef​(Group v)
      Sets the group aliasRef to which this data node refers to as an alias. In GPML, this is aliasRef which refers to the elementId of gpml:Group.

      NB:

      1. This method calls unsetAliasRef() to remove any existing links.
      2. This method calls PathwayModel.linkAlias(org.pathvisio.libgpml.model.Group, org.pathvisio.libgpml.model.DataNode) to add information to pathway model.
      3. DataNode type must be "Alias".
      Parameters:
      v - the group to which this data node refers.
    • unsetAliasRef

      public void unsetAliasRef()
      Unsets the aliasRef, if any, from this data node. Also removes references in pathway model.

      1. This method calls unsetAliasRef() to remove any existing links.
      2. This method calls PathwayModel.unlinkAlias(org.pathvisio.libgpml.model.Group, org.pathvisio.libgpml.model.DataNode) to remove information in the pathway model.
      3. This method is also called when this data node alias is terminate().
    • copyValuesFrom

      public void copyValuesFrom​(DataNode src)
      Copies values from the given source pathway element.

      NB:

      1. AliasRef value is not copied. References to other PathwayObjects are stored in CopyElement by copy().
      Parameters:
      src - the source pathway element.
    • copy

      public CopyElement copy()
      Copies this pathway element.
      Specified by:
      copy in class PathwayElement
      Returns:
      the copyElement for the new pathway element and this source pathway element.
    • copyReferencesFrom

      public void copyReferencesFrom​(PathwayElement srcDataNode)
      Copies references from the given source data node, including state references.

      NB:

      1. For each state, copies references from the corresponding source state.
      2. To be called after new data node is added to a pathway model.
      3. The source data node may be the immediate copy element source of the new data node, or an older source data node.
      Overrides:
      copyReferencesFrom in class PathwayElement
      Parameters:
      srcDataNode - the source element to copy references from.
    • getStaticPropertyKeys

      public java.util.Set<StaticProperty> getStaticPropertyKeys()
      Returns all static properties for this pathway object.
      Overrides:
      getStaticPropertyKeys in class ShapedElement
      Returns:
      result the set of static property for this pathway object.
    • getStaticProperty

      public java.lang.Object getStaticProperty​(StaticProperty key)
      Returns static property value for given key.
      Overrides:
      getStaticProperty in class ShapedElement
      Parameters:
      key - the key.
      Returns:
      the static property value.
    • setStaticProperty

      public void setStaticProperty​(StaticProperty key, java.lang.Object value)
      This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g. graphRef
      Overrides:
      setStaticProperty in class ShapedElement
      Parameters:
      key - the key.
      value - the static property value.
    • setPathwayModelTo

      protected void setPathwayModelTo​(PathwayModel pathwayModel) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
      Sets the pathway model for this pathway element. NB: Only set when a pathway model adds this pathway element. This method is not used directly. NB: This method is not used directly. It is called by PathwayModel.addPathwayObject(org.pathvisio.libgpml.model.PathwayObject).
      Overrides:
      setPathwayModelTo in class PathwayObject
      Parameters:
      pathwayModel - the parent pathway model.
      Throws:
      java.lang.IllegalArgumentException
      java.lang.IllegalStateException
    • terminate

      protected void terminate()
      Terminates this data node and removes all links and references.
      Overrides:
      terminate in class ShapedElement