struct

  type parse_optional = [
  | `wrong_auxiliary_data of
      [ `array_size of int
      | `null_terminated_hexarray
      | `null_terminated_string
      | `wrong_int32 of string
      | `out_of_bounds
      | `unknown_type of char ] * string
  ]
  with sexp

  type raw_bam = [
  | `read_name_not_null_terminated of string
  | `reference_information_name_not_null_terminated of string
  | `reference_information_overflow of int * string
  | `wrong_magic_number of string
  | `wrong_int32 of string
  ]
  with sexp

  type parse_cigar = [
  | `wrong_cigar of string
  | `wrong_cigar_length of int ]
  with sexp

  type raw_to_item = [
  | `header_line_not_first of int
  | `header_line_without_version of (string * string) list
  | `header_line_wrong_sorting of string
  | `invalid_header_tag of int * string
  | `invalid_tag_value_list of int * string list
  | `reference_sequence_not_found of raw_alignment
  | parse_optional
  | parse_cigar
  | `wrong_flag of raw_alignment
  | `wrong_mapq of raw_alignment
  | `wrong_pnext of raw_alignment
  | `wrong_pos of raw_alignment
  | `wrong_qname of raw_alignment
  | `wrong_tlen of raw_alignment ]
  with sexp


  type item_to_raw =
  [ `cannot_get_sequence of Sam.alignment
  | `header_item_not_first of string
  | `reference_name_not_found of Sam.alignment * string ]
  with sexp

  type t = [ raw_bam | raw_to_item | item_to_raw ] with sexp

end