Class PathwayElement

java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
All Implemented Interfaces:
java.lang.Cloneable, Referenceable, Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
Direct Known Subclasses:
LineElement, Pathway, ShapedElement

public abstract class PathwayElement
extends PathwayObject
implements java.lang.Cloneable, Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
Abstract class of pathway elements which are part of a pathway, have an elementId, have Comment, Children: DataNode, State, Interaction, GraphicalLine, Label, Shape, Group.
Author:
unknown, AP20070508, finterly
  • Field Details

    • comments

      private java.util.List<PathwayElement.Comment> comments
    • dynamicProperties

      private java.util.Map<java.lang.String,​java.lang.String> dynamicProperties
      Map for storing dynamic properties. Dynamic properties can have any String as key and value of type String. If a value is set to null the key should be removed.
    • annotationRefs

      private java.util.List<PathwayElement.AnnotationRef> annotationRefs
    • citationRefs

      private java.util.List<PathwayElement.CitationRef> citationRefs
    • evidenceRefs

      private java.util.List<PathwayElement.EvidenceRef> evidenceRefs
  • Constructor Details

    • PathwayElement

      public PathwayElement()
      Instantiates a pathway element with meta data information.
  • Method Details

    • getComments

      public java.util.List<PathwayElement.Comment> getComments()
    • addComment

      public void addComment​(PathwayElement.Comment comment)
      Adds given comment to comments list.
      Parameters:
      comment - the comment to be added.
    • addComment

      public PathwayElement.Comment addComment​(java.lang.String commentText, java.lang.String source)
      Creates a comment with given properties and adds to comments list. Calls addComment(Comment comment).
      Parameters:
      commentText - the text of the comment, between Comment tags in GPML.
      source - the source of this comment.
      Returns:
      the created comment.
    • removeComment

      public void removeComment​(PathwayElement.Comment comment)
      Removes given comment from comments list.
      Parameters:
      comment - the comment to be removed.
    • setComments

      public void setComments​(java.util.List<PathwayElement.Comment> value)
      Sets comments to the given comments list.
      Parameters:
      value - the given comment list.
    • findComment

      public java.lang.String findComment​(java.lang.String source)
      Finds the first comment with a specific source.
      Parameters:
      source - the source of the comment to be found.
      Returns:
      the comment content with a given source.
    • getDynamicProperties

      public java.util.Map<java.lang.String,​java.lang.String> getDynamicProperties()
      Returns the map of dynamic properties.
      Returns:
      dynamicProperties the map of dynamic properties.
    • getDynamicPropertyKeys

      public java.util.Set<java.lang.String> getDynamicPropertyKeys()
      Returns a set of all dynamic property keys.
      Returns:
      a set of all dynamic property keys.
    • getDynamicProperty

      public java.lang.String getDynamicProperty​(java.lang.String key)
      Returns a dynamic property string value.
      Parameters:
      key - the key of a key value pair.
      Returns:
      the value or dynamic property.
    • setDynamicProperty

      public void setDynamicProperty​(java.lang.String key, java.lang.String value)
      Sets a dynamic property. Setting to null means removing this dynamic property altogether.
      Parameters:
      key - the key of a key value pair.
      value - the value of a key value pair.
    • getAnnotationRefs

      public java.util.List<PathwayElement.AnnotationRef> getAnnotationRefs()
      Returns the list of annotation references.
      Specified by:
      getAnnotationRefs in interface Referenceable.Annotatable
      Returns:
      annotationRefs the list of annotation references, an empty list if no properties are defined.
    • hasAnnotationRef

      public boolean hasAnnotationRef​(PathwayElement.AnnotationRef annotationRef)
      Checks whether annotationRefs has the given annotationRef.
      Specified by:
      hasAnnotationRef in interface Referenceable.Annotatable
      Parameters:
      annotationRef - the annotationRef to look for.
      Returns:
      true if has annotationRef, false otherwise.
    • addAnnotation

      public PathwayElement.AnnotationRef addAnnotation​(Annotation annotation)
      Creates and adds an annotationRef to annotationRefs list. Sets annotable for the given annotationRef.
      Specified by:
      addAnnotation in interface Referenceable.Annotatable
      Parameters:
      annotation - the annotation for annotationRef.
      Returns:
      the annotationRef of added annotation.
    • addAnnotation

      public PathwayElement.AnnotationRef addAnnotation​(java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates a annotation with given properties, and adds annotation to pathway model. Creates a annotationRef for annotation, and adds to annotationRefs list for this annotatable. Calls addAnnotation(Annotation annotation).
      Specified by:
      addAnnotation in interface Referenceable.Annotatable
      Parameters:
      value - the name, term, or text of the annotation.
      type - the type of the annotation, e.g. ontology.
      xref - the annotation xref.
      urlLink - the url link of the annotation.
      Returns:
      the annotationRef of added annotation.
    • addAnnotation

      public PathwayElement.AnnotationRef addAnnotation​(java.lang.String elementId, java.lang.String value, AnnotationType type, org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates a annotation with given properties, and adds annotation to pathway model. Creates a annotationRef for annotation, and adds to annotationRefs list for this annotatable. Sets elementId for annotation. This method is used when reading gpml. Calls addAnnotation(Annotation annotation).
      Specified by:
      addAnnotation in interface Referenceable.Annotatable
      Parameters:
      elementId - the elementId to set.
      value - the name, term, or text of the annotation.
      type - the type of the annotation, e.g. ontology.
      xref - the annotation xref.
      urlLink - the url link of the annotation.
      Returns:
      the annotationRef of added annotation.
    • removeAnnotationRef

      public void removeAnnotationRef​(PathwayElement.AnnotationRef annotationRef)
      Removes given annotationRef from annotationRefs list. The annotationRef ceases to exist and is terminated.
      Specified by:
      removeAnnotationRef in interface Referenceable.Annotatable
      Parameters:
      annotationRef - the annotationRef to be removed.
    • removeAnnotationRefs

      public void removeAnnotationRefs()
      Removes all annotationRefs from annotationRefs list.
      Specified by:
      removeAnnotationRefs in interface Referenceable.Annotatable
    • getCitationRefs

      public java.util.List<PathwayElement.CitationRef> getCitationRefs()
      Returns the list of citation references.
      Specified by:
      getCitationRefs in interface Referenceable.Citable
      Returns:
      citationRefs the list of citations referenced, an empty list if no properties are defined.
    • hasCitationRef

      public boolean hasCitationRef​(PathwayElement.CitationRef citationRef)
      Checks whether citationRefs has the given citationRef.
      Specified by:
      hasCitationRef in interface Referenceable.Citable
      Parameters:
      citationRef - the citationRef to look for.
      Returns:
      true if has citationRef, false otherwise.
    • addCitation

      public PathwayElement.CitationRef addCitation​(Citation citation)
      Creates and adds an citationRef to citationRefs list. Sets citable for the given citationRef.
      Specified by:
      addCitation in interface Referenceable.Citable
      Parameters:
      citation - the citation for citationRef.
      Returns:
      the citationRef of added citation.
    • addCitation

      public PathwayElement.CitationRef addCitation​(org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates a citation with given xref and urlLink, and adds citation to pathway model. Creates a citationRef for citation, and adds to citationRefs list for this citable.Calls addCitation(Citation citation).
      Specified by:
      addCitation in interface Referenceable.Citable
      Parameters:
      xref - the citation xref.
      urlLink - the url link and description (optional) for a web address.
      Returns:
      the citationRef of added citation.
    • addCitation

      public PathwayElement.CitationRef addCitation​(java.lang.String elementId, org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates a citation with given xref and urlLink, and adds citation to pathway model. Creates a citationRef for citation, and adds to citationRefs list for this citable. Sets elementId for citation. This method is used when reading gpml. Calls addCitation(Citation citation).
      Specified by:
      addCitation in interface Referenceable.Citable
      Parameters:
      elementId - the elementId to set.
      xref - the citation xref.
      urlLink - the url link and description (optional) for a web address.
      Returns:
      the citationRef of added citation.
    • removeCitationRef

      public void removeCitationRef​(PathwayElement.CitationRef citationRef)
      Removes given citationRef from citationRefs list. The citationRef ceases to exist and is terminated.
      Specified by:
      removeCitationRef in interface Referenceable.Citable
      Parameters:
      citationRef - the citationRef to be removed.
    • removeCitationRefs

      public void removeCitationRefs()
      Removes all citationRef from citationRefs list.
      Specified by:
      removeCitationRefs in interface Referenceable.Citable
    • getEvidenceRefs

      public java.util.List<PathwayElement.EvidenceRef> getEvidenceRefs()
      Returns the list of evidence references.
      Specified by:
      getEvidenceRefs in interface Referenceable.Evidenceable
      Returns:
      evidenceRefs the list of evidences referenced, an empty list if no properties are defined.
    • hasEvidenceRef

      public boolean hasEvidenceRef​(PathwayElement.EvidenceRef evidenceRef)
      Checks whether evidenceRefs has the given evidenceRef.
      Specified by:
      hasEvidenceRef in interface Referenceable.Evidenceable
      Parameters:
      evidenceRef - the evidenceRef to look for.
      Returns:
      true if has evidenceRef, false otherwise.
    • addEvidence

      public PathwayElement.EvidenceRef addEvidence​(Evidence evidence)
      Creates and adds an evidenceRef to evidenceRefs list. Sets evidenceable for the given evidenceRef.
      Specified by:
      addEvidence in interface Referenceable.Evidenceable
      Parameters:
      evidence - the evidenceRef for evidenceRef.
      Returns:
      the evidenceRef of added evidence.
    • addEvidence

      public PathwayElement.EvidenceRef addEvidence​(java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates an evidence with given properties, and adds evidence to pathway model. Creates a evidenceRef for evidence, and adds to evidenceRefs list for this evidenceable. Calls addEvidence(Evidence evidence).
      Specified by:
      addEvidence in interface Referenceable.Evidenceable
      Parameters:
      value - the name, term, or text of the evidence.
      xref - the evidence xref.
      urlLink - the url link and description (optional) for a web address.
      Returns:
      the evidenceRef of added evidence.
    • addEvidence

      public PathwayElement.EvidenceRef addEvidence​(java.lang.String elementId, java.lang.String value, org.bridgedb.Xref xref, java.lang.String urlLink)
      Creates an evidence with given properties, and adds evidence to pathway model. Creates a evidenceRef for evidence, and adds to evidenceRefs list for this evidenceable. Sets elementId for evidence. This method is used when reading gpml. Calls addEvidence(Evidence evidence).
      Specified by:
      addEvidence in interface Referenceable.Evidenceable
      Parameters:
      elementId - the elementId to set.
      value - the name, term, or text of the evidence.
      xref - the evidence xref.
      urlLink - the url link and description (optional) for a web address.
      Returns:
      the evidenceRef of added evidence.
    • removeEvidenceRef

      public void removeEvidenceRef​(PathwayElement.EvidenceRef evidenceRef)
      Removes given evidenceRef from evidenceRefs list. The evidenceRef ceases to exist and is terminated.
      Specified by:
      removeEvidenceRef in interface Referenceable.Evidenceable
      Parameters:
      evidenceRef - the evidenceRef to be removed.
    • removeEvidenceRefs

      public void removeEvidenceRefs()
      Removes all evidenceRefs from evidenceRefs list.
      Specified by:
      removeEvidenceRefs in interface Referenceable.Evidenceable
    • terminate

      protected void terminate()
      Terminates this pathway element. The pathway model, if any, is unset from this pathway element. Links to all annotationRefs, citationRefs, and evidenceRefs are removed from this data node.
      Overrides:
      terminate in class PathwayObject
    • copyValuesFrom

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

      NB:

      1. Doesn't change parent, only fields
      2. Used by UndoAction.
      3. AnnotationRefs, citationRefs, and evidenceRefs are copied later using copyReferencesFrom(org.pathvisio.libgpml.model.PathwayElement).
      Parameters:
      src - the source pathway element.
    • copy

      public abstract CopyElement copy()
      Copies this pathway element.
      Returns:
      the copyElement for the new pathway element and this source pathway element.
    • copyReferencesFrom

      public void copyReferencesFrom​(PathwayElement srcElement)
      Copies references from the given source pathway element.

      NB:

      1. To be called after new pathway element is added to a pathway model.
      2. The srcElement may be the immediate copy element source of the new pathway element, or an older source.
      Parameters:
      srcElement - the source element to copy references from.
    • copyCitationRefs

      private void copyCitationRefs​(java.util.List<PathwayElement.CitationRef> citationRefs)
      Copies citationsRefs and nested annotationRefs if applicable.
      Parameters:
      citationRefs - the citationsRefs list.
    • copyAnnotationRefs

      private void copyAnnotationRefs​(java.util.List<PathwayElement.AnnotationRef> annotationRefs)
      Copies annotationRefs and nested citationRefs and evidenceRefs if applicable.
      Parameters:
      annotationRefs - the annotationRefs list.
    • copyEvidenceRefs

      private void copyEvidenceRefs​(java.util.List<PathwayElement.EvidenceRef> evidenceRefs)
      Copies evidenceRefs.
      Parameters:
      evidenceRefs - the evidenceRefs list.
    • getPropertyKeys

      public java.util.Set<java.lang.Object> getPropertyKeys()
      Returns keys of available static properties and dynamic properties as an object list
      Overrides:
      getPropertyKeys in class PathwayObject
      Returns:
      keys the keys of available properties.
    • getStaticPropertyKeys

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

      public java.lang.Object getPropertyEx​(java.lang.Object key)
      Returns property of given key.
      Overrides:
      getPropertyEx in class PathwayObject
      Parameters:
      key - the key.
      Returns:
      the property of given key.
    • setPropertyEx

      public void setPropertyEx​(java.lang.Object key, java.lang.Object value)
      Sets dynamic or static properties at the same time.
      Overrides:
      setPropertyEx in class PathwayObject
      Parameters:
      key - the key for the property to set.
      value - the value for the property to set.
    • getStaticProperty

      public java.lang.Object getStaticProperty​(StaticProperty key)
      Returns static property value for given key.
      Overrides:
      getStaticProperty in class PathwayObject
      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 PathwayObject
      Parameters:
      key - the key.
      value - the property value.