Class QueryExecuter

java.lang.Object
org.biopax.paxtools.query.QueryExecuter

public class QueryExecuter extends Object
This class provides static methods to execute graph queries. These cover only the most frequent use cases. Users can use these methods as example for executing the query they need.
Author:
Ozgun Babur
  • Constructor Details

    • QueryExecuter

      public QueryExecuter()
  • Method Details

    • runNeighborhood

      public static Set<BioPAXElement> runNeighborhood(Set<BioPAXElement> sourceSet, Model model, int limit, Direction direction, Filter... filters)
      Gets neighborhood of the source set.
      Parameters:
      sourceSet - seed to the query
      model - BioPAX model
      limit - neigborhood distance to get
      direction - UPSTREAM, DOWNSTREAM or BOTHSTREAM
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result set
    • runNeighborhoodMultiSet

      public static Set<BioPAXElement> runNeighborhoodMultiSet(Set<Set<BioPAXElement>> sourceSets, Model model, int limit, Direction direction, Filter... filters)
      Gets neighborhood of the source set.
      Parameters:
      sourceSets - seed to the query
      model - BioPAX model
      limit - neigborhood distance to get
      direction - UPSTREAM, DOWNSTREAM or BOTHSTREAM
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result set
    • runPathsBetween

      public static Set<BioPAXElement> runPathsBetween(Set<BioPAXElement> sourceSet, Model model, int limit, Filter... filters)
      Gets the graph constructed by the paths between the given seed nodes. Does not get paths between physical entities that belong the same entity reference.
      Parameters:
      sourceSet - Seed to the query
      model - BioPAX model
      limit - Length limit for the paths to be found
      filters - optional filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runPathsBetweenMultiSet

      public static Set<BioPAXElement> runPathsBetweenMultiSet(Set<Set<BioPAXElement>> sourceSets, Model model, int limit, Filter... filters)
      Gets the graph constructed by the paths between the given seed nodes. Does not get paths between physical entities that belong the same entity reference.
      Parameters:
      sourceSets - Seed to the query
      model - BioPAX model
      limit - Length limit for the paths to be found
      filters - optional filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runGOI

      public static Set<BioPAXElement> runGOI(Set<BioPAXElement> sourceSet, Model model, int limit, Filter... filters)
      Deprecated.
      Use runPathsBetween instead
      Gets paths between the seed nodes.
      Parameters:
      sourceSet - Seed to the query
      model - BioPAX model
      limit - Length limit for the paths to be found
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runPathsFromTo

      public static Set<BioPAXElement> runPathsFromTo(Set<BioPAXElement> sourceSet, Set<BioPAXElement> targetSet, Model model, LimitType limitType, int limit, Filter... filters)
      Gets paths the graph composed of the paths from a source node, and ends at a target node.
      Parameters:
      sourceSet - Seeds for start points of paths
      targetSet - Seeds for end points of paths
      model - BioPAX model
      limitType - either NORMAL or SHORTEST_PLUS_K
      limit - Length limit fothe paths to be found
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runPathsFromToMultiSet

      public static Set<BioPAXElement> runPathsFromToMultiSet(Set<Set<BioPAXElement>> sourceSets, Set<Set<BioPAXElement>> targetSets, Model model, LimitType limitType, int limit, Filter... filters)
      Gets paths the graph composed of the paths from a source node, and ends at a target node.
      Parameters:
      sourceSets - Seeds for start points of paths
      targetSets - Seeds for end points of paths
      model - BioPAX model
      limitType - either NORMAL or SHORTEST_PLUS_K
      limit - Length limit fothe paths to be found
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runCommonStream

      public static Set<BioPAXElement> runCommonStream(Set<BioPAXElement> sourceSet, Model model, Direction direction, int limit, Filter... filters)
      Gets the elements in the common upstream or downstream of the seed
      Parameters:
      sourceSet - Seed to the query
      model - BioPAX model
      direction - UPSTREAM or DOWNSTREAM
      limit - Length limit for the search
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runCommonStreamMultiSet

      public static Set<BioPAXElement> runCommonStreamMultiSet(Set<Set<BioPAXElement>> sourceSets, Model model, Direction direction, int limit, Filter... filters)
      Gets the elements in the common upstream or downstream of the seed
      Parameters:
      sourceSets - Seed to the query
      model - BioPAX model
      direction - UPSTREAM or DOWNSTREAM
      limit - Length limit for the search
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runCommonStreamWithPOI

      public static Set<BioPAXElement> runCommonStreamWithPOI(Set<BioPAXElement> sourceSet, Model model, Direction direction, int limit, Filter... filters)
      First finds the common stream, then completes it with the paths between seed and common stream.
      Parameters:
      sourceSet - Seed to the query
      model - BioPAX model
      direction - UPSTREAM or DOWNSTREAM
      limit - Length limit for the search
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • runCommonStreamWithPOIMultiSet

      public static Set<BioPAXElement> runCommonStreamWithPOIMultiSet(Set<Set<BioPAXElement>> sourceSets, Model model, Direction direction, int limit, Filter... filters)
      First finds the common stream, then completes it with the paths between seed and common stream.
      Parameters:
      sourceSets - Seed to the query
      model - BioPAX model
      direction - UPSTREAM or DOWNSTREAM
      limit - Length limit for the search
      filters - for filtering graph elements
      Returns:
      BioPAX elements in the result
    • prepareSingleNodeSet

      public static Set<Node> prepareSingleNodeSet(Set<BioPAXElement> elements, Graph graph)
      Gets the related wrappers of the given elements in a set.
      Parameters:
      elements - Elements to get the related wrappers
      graph - Owner graph
      Returns:
      Related wrappers in a set
    • prepareSingleNodeSetFromSets

      public static Set<Node> prepareSingleNodeSetFromSets(Set<Set<BioPAXElement>> sets, Graph graph)
      Gets the related wrappers of the given elements in the sets.
      Parameters:
      sets - Sets of elements to get the related wrappers
      graph - Owner graph
      Returns:
      Related wrappers in a set
    • getRelatedPhysicalEntityMap

      public static Map<BioPAXElement,Set<PhysicalEntity>> getRelatedPhysicalEntityMap(Collection<BioPAXElement> elements)
      Maps each BioPAXElement to its related PhysicalEntity objects.
      Parameters:
      elements - Elements to map
      Returns:
      The mapping
    • replaceXrefsWithRelatedER

      protected static void replaceXrefsWithRelatedER(Collection<BioPAXElement> elements)
      Replaces Xref objects with the related EntityReference objects. This is required for the use case when user provides multiple xrefs that point to the same ER.
      Parameters:
      elements - elements to send to a query as source or target
    • getRelatedPhysicalEntities

      public static Set<PhysicalEntity> getRelatedPhysicalEntities(BioPAXElement element, Set<PhysicalEntity> pes)
      Gets the related PhysicalEntity objects of the given BioPAXElement, in level 3 models.
      Parameters:
      element - Element to get related PhysicalEntity objects
      pes - Result set. If not supplied, a new set will be initialized.
      Returns:
      Related PhysicalEntity objects
    • getSeedInteractions

      public static Set<Node> getSeedInteractions(Collection<BioPAXElement> elements, Graph graph)
      Extracts the querible interactions from the elements.
      Parameters:
      elements - BioPAX elements to search
      graph - graph model
      Returns:
      Querible Interactions (nodes)