Package org.biopax.paxtools.pattern
Class Searcher
java.lang.Object
org.biopax.paxtools.pattern.Searcher
Searcher for searching a given pattern in a model.
- Author:
- Ozgun Babur
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasSolution(Pattern p, BioPAXElement... ele) Checks if there is any match for the given pattern if search starts from the given element.static Map<BioPAXElement,List<Match>> search(Collection<? extends BioPAXElement> eles, Pattern pattern) Searches the given pattern starting from the given elements.search(BioPAXElement ele, Pattern pattern) Searches the pattern starting from the given element.static Map<BioPAXElement,List<Match>> Searches the given pattern in the given model.static Map<BioPAXElement,List<Match>> search(Model model, Pattern pattern, ProgressWatcher prg) Searches the given pattern in the given model.Searches the pattern starting from the given match.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.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.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.static voidsearchInFile(Pattern p, String inFile, String outFile) Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns.static voidsearchInFile(Pattern p, String inFile, String outFile, int seedLimit, int graphPerSeed) Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns.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.searchPlain(Model model, Pattern pattern) Searches the pattern in a given model, but instead of a match map, returns all matches in a list.searchRecursive(Match match, List<MappedConst> mc, int index) Continues searching with the mapped constraint at the given index.
-
Constructor Details
-
Searcher
public Searcher()
-
-
Method Details
-
search
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 frompattern- pattern to search- Returns:
- result matches
-
search
Searches the pattern starting from the given element.- Parameters:
ele- element to start frompattern- pattern to search- Returns:
- matching results
-
searchRecursive
Continues searching with the mapped constraint at the given index.- Parameters:
match- match to start frommc- mapped constraints of the patternindex- index of the current mapped constraint- Returns:
- matching results
-
searchPlain
Searches the pattern in a given model, but instead of a match map, returns all matches in a list.- Parameters:
model- model to search inpattern- pattern to search for- Returns:
- matching results
-
searchPlain
Searches the pattern starting from given elements, but instead of a match map, returns all matches in a list.- Parameters:
eles- elements to start frompattern- pattern to search for- Returns:
- matching results
-
search
Searches the given pattern in the given model.- Parameters:
model- model to search inpattern- 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 inpattern- pattern to search forprg- 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 frompattern- 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 inpattern- pattern to search forindex- index of the element in the match to collectc- 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 frompattern- pattern to search forindex- index of the element in the match to collectc- 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 frompattern- pattern to search forindex- index of the element in the match to collectc- type of the element to collect- Returns:
- set of the elements at the specified index of the matching results
-
hasSolution
Checks if there is any match for the given pattern if search starts from the given element.- Parameters:
p- pattern to search forele- 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 forinFile- filename for the model to search inoutFile- 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 forinFile- filename for the model to search inoutFile- filename for the result modelseedLimit- max number of starting elementsgraphPerSeed- max number of matches for a starting element- Throws:
FileNotFoundException- when no file exists
-