Class LinkedPE

java.lang.Object
org.biopax.paxtools.pattern.constraint.ConstraintAdapter
org.biopax.paxtools.pattern.constraint.LinkedPE
All Implemented Interfaces:
Constraint

public class LinkedPE extends ConstraintAdapter
Many times we want to link PhysicalEntities (PE) while traversing a relation. For instance when we have a PE and want to go the Interactions that it participates, we may also want to consider the complexes that the PE is in. Or we also want to traverse homologies (parent or member PEs) This generative constraint gets related generics (member or parent) and either complexes or members recursively. Linking process is a bit confusing. There two modes: TO_COMPLEX and TO_MEMBER. Linking homologies is identical for both cases. IT is either parent PEs recursively, or member PEs recursively. But not parent of a member (recursion do not alternate between parent and member). In TO_COMPLEX mode, only parent complexes are linked recursively, and in TO_MEMBER mode, only the complex member PEs are linked recursively. Homology linking and complex-relation linking can alternate recursively.
Author:
Ozgun Babur
  • Constructor Details

    • LinkedPE

      public LinkedPE(LinkedPE.Type type)
      Constructor with the linking type.
      Parameters:
      type - type of desired linking
    • LinkedPE

      public LinkedPE(LinkedPE.Type type, Blacklist blacklist)
      Constructor with the linking type.
      Parameters:
      type - type of desired linking
      blacklist - a skip-list of ubiquitous molecules
  • Method Details

    • canGenerate

      public boolean canGenerate()
      This is a generative constraint.
      Specified by:
      canGenerate in interface Constraint
      Overrides:
      canGenerate in class ConstraintAdapter
      Returns:
      true
    • generate

      public Collection<BioPAXElement> generate(Match match, int... ind)
      Gets to the linked PhysicalEntity.
      Specified by:
      generate in interface Constraint
      Overrides:
      generate in class ConstraintAdapter
      Parameters:
      match - current pattern match
      ind - mapped indices
      Returns:
      linked PhysicalEntity
    • getLinkedElements

      public Set<BioPAXElement> getLinkedElements(PhysicalEntity pe)
    • enrichWithGenerics

      protected void enrichWithGenerics(Set<BioPAXElement> seed, Set<BioPAXElement> all)
      Gets the linked homologies and then switches to complex-relationship mode. These two enrich methods call each other recursively.
      Parameters:
      seed - to get the linked elements from
      all - already found links
    • enrichWithCM

      protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all)
      Gets parent complexes or complex members recursively according to the type of the linkage.
      Parameters:
      seed - elements to link
      all - already found links
    • access

      protected Set access(PathAccessor pa, Set<BioPAXElement> seed, Set<BioPAXElement> all)
      Uses the given PathAccessor to access fields of the seed and return only new elements that is not in the given element set (all).
      Parameters:
      pa - accessor to the filed
      seed - entities to get their fields
      all - already found values
      Returns:
      new values