Bio.triefind module

Given a trie, find all occurrences of a word in the trie in a string.

Like searching a string for a substring, except that the substring is any word in a trie.

Functions:
  • match Find longest key in a trie matching the beginning of the string.

  • match_all Find all keys in a trie matching the beginning of the string.

  • find Find keys in a trie matching anywhere in a string.

  • find_words Find keys in a trie matching whole words in a string.

This module is DEPRECATED. We encourage users to switch to alternative libraries implementing a trie data structure, for example pygtrie.

Bio.triefind.match(string, trie)

Find longest key, or return None.

Find the longest key in the trie that matches the beginning of the string.

Bio.triefind.match_all(string, trie)

Find and return a list of keys.

Find all the keys in the trie that matches the beginning of the string.

Bio.triefind.find(string, trie)

Find all the keys in the trie that match anywhere in the string.

Returns a list of tuples (key, start, end).

Bio.triefind.find_words(string, trie)

Find all the keys in the trie that match full words in the string.

Find all the keys in the trie that match full words in the string. Word boundaries are defined as any punctuation or whitespace.

Returns a list of tuples (key, start, end).