Class Searcher

java.lang.Object
org.biopax.paxtools.pattern.Searcher

public class Searcher extends Object
Searcher for searching a given pattern in a model.
Author:
Ozgun Babur
  • Constructor Details

    • Searcher

      public Searcher()
  • Method Details

    • search

      public static List<Match> search(Match m, Pattern pattern)
      Searches the pattern starting from the given match. The first element of the match should be assigned. Others are optional.
      Parameters:
      m - match to start from
      pattern - pattern to search
      Returns:
      result matches
    • search

      public static List<Match> search(BioPAXElement ele, Pattern pattern)
      Searches the pattern starting from the given element.
      Parameters:
      ele - element to start from
      pattern - pattern to search
      Returns:
      matching results
    • searchRecursive

      public static List<Match> searchRecursive(Match match, List<MappedConst> mc, int index)
      Continues searching with the mapped constraint at the given index.
      Parameters:
      match - match to start from
      mc - mapped constraints of the pattern
      index - index of the current mapped constraint
      Returns:
      matching results
    • searchPlain

      public static List<Match> searchPlain(Model model, Pattern pattern)
      Searches the pattern in a given model, but instead of a match map, returns all matches in a list.
      Parameters:
      model - model to search in
      pattern - pattern to search for
      Returns:
      matching results
    • searchPlain

      public static List<Match> searchPlain(Collection<? extends BioPAXElement> eles, Pattern pattern)
      Searches the pattern starting from given elements, but instead of a match map, returns all matches in a list.
      Parameters:
      eles - elements to start from
      pattern - pattern to search for
      Returns:
      matching results
    • search

      public static Map<BioPAXElement,List<Match>> search(Model model, Pattern pattern)
      Searches the given pattern in the given model.
      Parameters:
      model - model to search in
      pattern - pattern to search for
      Returns:
      map from starting elements to the list matching results
    • search

      public static Map<BioPAXElement,List<Match>> search(Model model, Pattern pattern, ProgressWatcher prg)
      Searches the given pattern in the given model.
      Parameters:
      model - model to search in
      pattern - pattern to search for
      prg - progress watcher to keep track of the progress
      Returns:
      map from starting elements to the list matching results
    • search

      public static Map<BioPAXElement,List<Match>> search(Collection<? extends BioPAXElement> eles, Pattern pattern)
      Searches the given pattern starting from the given elements.
      Parameters:
      eles - elements to start from
      pattern - pattern to search for
      Returns:
      map from starting element to the matching results
    • searchAndCollect

      public static <T extends BioPAXElement> Set<T> searchAndCollect(Model model, Pattern pattern, int index, Class<T> c)
      Searches a model for the given pattern, then collects the specified elements of the matches and returns.
      Type Parameters:
      T - BioPAX type
      Parameters:
      model - model to search in
      pattern - pattern to search for
      index - index of the element in the match to collect
      c - type of the element to collect
      Returns:
      set of the elements at the specified index of the matching results
    • searchAndCollect

      public static <T extends BioPAXElement> Set<T> searchAndCollect(Collection<? extends BioPAXElement> eles, Pattern pattern, int index, Class<T> c)
      Searches the given pattern starting from the given elements, then collects the specified elements of the matches and returns.
      Type Parameters:
      T - BioPAX type
      Parameters:
      eles - elements to start from
      pattern - pattern to search for
      index - index of the element in the match to collect
      c - type of the element to collect
      Returns:
      set of the elements at the specified index of the matching results
    • searchAndCollect

      public static <T extends BioPAXElement> Set<T> searchAndCollect(BioPAXElement ele, Pattern pattern, int index, Class<T> c)
      Searches the given pattern starting from the given element, then collects the specified elements of the matches and returns.
      Type Parameters:
      T - BioPAX type
      Parameters:
      ele - element to start from
      pattern - pattern to search for
      index - index of the element in the match to collect
      c - type of the element to collect
      Returns:
      set of the elements at the specified index of the matching results
    • hasSolution

      public boolean hasSolution(Pattern p, BioPAXElement... ele)
      Checks if there is any match for the given pattern if search starts from the given element.
      Parameters:
      p - pattern to search for
      ele - element to start from
      Returns:
      true if there is a match
    • searchInFile

      public static void searchInFile(Pattern p, String inFile, String outFile) throws FileNotFoundException
      Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns.
      Parameters:
      p - pattern to search for
      inFile - filename for the model to search in
      outFile - filename for the result model
      Throws:
      FileNotFoundException - when no file exists
    • searchInFile

      public static void searchInFile(Pattern p, String inFile, String outFile, int seedLimit, int graphPerSeed) throws FileNotFoundException
      Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns. Users can limit the max number of starting element, and max number of matches for any starting element. These parameters is good for limiting the size of the result graph.
      Parameters:
      p - pattern to search for
      inFile - filename for the model to search in
      outFile - filename for the result model
      seedLimit - max number of starting elements
      graphPerSeed - max number of matches for a starting element
      Throws:
      FileNotFoundException - when no file exists