Skip to main content

Table 1 Descriptions of BAMQL connectives and predicates

From: BAMQL: a query language for extracting reads from BAM files

Category Syntax Description
Logical Connectives ! expr Is satisfied if expr is not satisfied.
  expr | expr Is satisfied if at least one operand is satisfied.
  expr ^ expr Is satisfied if at exactly one operand is satisfied.
  expr & expr Is satisfied only if both operands are satisfied.
  cond then then_expr else else_expr If cond is satisfied, this expression will only be satisfied if then_expr is satisfied. If cond is not satisfied, then this expression will only be satisfied if else_expression is satisfied.
BAM Flags paired? The read is paired in sequencing.
  proper_pair? The read is mapped in a proper pair
  unmapped? The read is unmapped.
  mate_unmapped? The mate is unmapped.
  mapped_to_reverse? The read is mapped to the reverse strand.
  mate_mapped_to_reverse? The mate is mapped to the reverse strand.
  raw_flag(int) The read matches the specified SAM flag.
  read1? The read is the first read in a pair.
  read2? The read is the second read in a pair.
  secondary? The alignment is not primary.
  failed_qc? The read failed platform/vendor quality control checks.
  duplicate? The read is either a PCR or optical duplicate
  supplementary? The alignment is supplementary.
Mapping Information chr(glob) The read is mapped to the specified chromosome.
  mapping_quality(probability) Matches the read if the proability of error is less than the specified probability.
  mate_chr(glob) The mate is mapped to the specified chromosome.
  split_pair? Matches if both the read and it’s mate pair are mapped, but only if to different chromosomes.
Position after(position) Matches all reads that cover the specified position or any higher position.
  before(position) Matches all reads that cover the specified position or any lower position.
  position(start,end) Matches all sequences that cover the range of position from specified start to end, i.e. N matches any base.
Sequence nt(position,n) Matches all reads that are classified as the IUPAC-style nucleotide n at the specified position, i.e. N matches N.
  nt_exact(position,n) Matches all reads that exactly match the IUPAC-style nucleotide n at the specified position.
Miscellaneous read_group(glob) Matches the read group.
  header ~ /regex/ Matches a Perl-compatible regular expression against the read’s header.
  random(probability) The read is chosen based on a uniform pseudo-random variable.
  true Always satisfied.
  false Never satisfied.