Skip to content
PragashSiva edited this page Mar 2, 2016 · 1 revision

NAME

bamql-compile - Compile BAMQL queries to object code.  

SYNOPSIS

bamql-compile[-d] [-g] [-o output.o] [-H output.h] queryfile.bamql

 

DESCRIPTION

BAMQL filters SAM or BAM files using a simple query language that is more expressive than the view options available in samtools.

The query language is described in bamql_queries.

This compiler allows generating object code usable from C or C++ to perform the same filtering as a query. The generated code follows C convections, to match HTSLib which also must be included. On standard output, a sample header file will be generated.

To make use of this function,

  1. Write a file containing queries that should be available to the C/C++ program.
  2. Compile the query file.
  3. Write a C program that uses HTSLib to open a BAM/SAM file and the selected reads and the header file generated.
  4. Compile the C program as usual.
  5. Link, including the generated object code from the second step, all the object code from the C program, and appropriate flags for the HTSLib library.

 

OPTIONS

-d
Dump the LLVM bit-code to the console for inspection. This is only useful if the generated code is broken.
-g
Write debugging symbols to the output. This will allow a debugger to produce sensible stack traces.
-H output.h
The file containing the generated C header. It none is specified, it is the input file name, suffixed with .h.
-o output.o
The file containing the generated object code. It none is specified, it is the input file name, suffixed with .o.

 

QUERY FILE FORMAT

The query file is an optional list of external definitions:

extern name ;

followed by a list of queries, in the following format:

name = query ;

Whitespace is ignored, per usual conventions. The correspoding C function will be exported as name, so this must be a valid C function name.

Queries can make use of previously defined queries. For example:

a = paired? & chr(1);
b = a & nt(50, A);

Clone this wiki locally