API Examples

Introduction

The SDK contains a set of examples of how to use the various APIs.

The examples are installed with the SDK at the following locations:

  • Windows: By default, the examples are installed at C:/Program Files/Micron Automata Processor SDK/examples. In order to build the projects where they are installed, you need to have administrator rights. It is suggested that you copy the examples somewhere other than C:/Program Files, in order to remove this requirement.
  • Linux: By default, the tutorial projects are installed at /usr/share/micron/ap/examples. In order to build the projects where they are installed, you need to have root privileges. It is suggested that you copy the tutorial projects somewhere in your home directory, in order to remove this requirement.

C/anml/blast_two_hits

This is an example demonstrating the two-hits seed search of BLAST algorithm can be performed on Automata Processor in a very efficient way. The two-hits seed search will find all the seed pairs of offsets between the query sequence and the subject sequence for later steps of BLAST algorithm. Given a fixed hitting word length, the two-hits offset pair must meet follow criteria:

  • Characters are exactly matched for the length of the given word length right before the offset.
  • On the upstream of the same alignment (no gap/insertion), there is at least one other exact match at the given word length.

For more details of BLAST algorithm, please refer to http://www.blastalgorithm.com/. The file, test_query.fa, is an example of fast format input data, and the file, test_sequence.txt, is an example input sequence data for emulation of compiled FSM.

C/anml/levenshtein

These examples are depecated. Programmers are advised to use the String Matching API. These two examples, basic and advanced, are examples of bit parallels diagonal algorithm for string matching. This example takes as input an error threshold k, the maximal levenshtein distance, and file containing literals.

  • The application uses the ANML programming interface to create an automaton to match the patterns within the error threshold. If no output file is given the automaton result is placed in file "output.fsm".
  • In this example the automaton match result is a binary determination indicating the input text is within error threshold.

C/pcre/basic_pcre

This example demonstrates a very basic usage of the PCRE and Runtime APIs to create an automata for string matching of regular expressions. The resulting automata can be tested using the command line emulator. The application uses the PCRE API to compile a set of regular expressions from an input file, then uses the Runtime API to create an automaton.