Read and write BAM format.
The implementation does its best to comply with the official
specification.
module Biocaml_bam_alt: sigBiocaml.SAM module.BAM header files contain a plain text SAM header, plus additional
information related to the encoding of the file.
module Header: sigendtype alignment = Biocaml_sam.alignment
Representation of partially parsed alignments. When traversing a
BAM file for a specific calculation, it may be that only some
fields of the alignment records are actually used. In that case,
it can be significantly faster to use this representation. As a
downside, some encoding errors in the BAM file can go
unnoticed.
module Alignment0: sigtype t
val flags : t -> Biocaml_sam.Flags.t Core.Std.Or_error.tval rname : t ->
Biocaml_bam_alt.Header.t -> string option Core.Std.Or_error.tval cigar : t -> Biocaml_sam.cigar_op list Core.Std.Or_error.tval rnext : t ->
Biocaml_bam_alt.Header.t -> Biocaml_sam.rnext option Core.Std.Or_error.tval qual : t ->
Biocaml_phred_score.t list Core.Std.Or_error.tval optional_fields : t ->
Biocaml_sam.optional_field list Core.Std.Or_error.tval decode : t ->
Biocaml_bam_alt.Header.t -> Biocaml_bam_alt.alignment Core.Std.Or_error.tval encode : Biocaml_bam_alt.alignment ->
Biocaml_bam_alt.Header.t -> t Core.Std.Or_error.tendval read0 : Pervasives.in_channel ->
(Header.t *
Alignment0.t Core.Std.Or_error.t Stream.t)
Core.Std.Or_error.tread0 ic returns an error if a valid header cannot be read from
ic or a pair containing a header and a stream of possibly
errored (partially parsed) alignments. The stream stops after the first error.val with_file0 : string ->
f:(Header.t ->
Alignment0.t Core.Std.Or_error.t Stream.t ->
'a Core.Std.Or_error.t) ->
'a Core.Std.Or_error.twith_file fn ~f opens a BAM file for reading, applies f and
closes the file after that, even if f raises an exception. Beware: the result of f should not lazily depend on the
stream it receives as a second argument, since after the call to
with_file the underlying channel is closed.val write0 : Header.t ->
Alignment0.t Stream.t -> Pervasives.out_channel -> unitwrite0 h xs oc writes the header h and (partially parsed)
alignments xs to oc.val read : Pervasives.in_channel ->
(Header.t *
alignment Core.Std.Or_error.t Stream.t)
Core.Std.Or_error.tread ic returns an error if a valid header cannot be read from
ic or a pair containing a header and a stream of possibly
errored alignments. The stream stops after the first error.val with_file : string ->
f:(Header.t ->
alignment Core.Std.Or_error.t Stream.t ->
'a Core.Std.Or_error.t) ->
'a Core.Std.Or_error.twith_file fn ~f opens a BAM file for reading, applies f and
closes the file after that, even if f raises an exception. Beware: the result of f should not lazily depend on the
stream it receives as a second argument, since after the call to
with_file the underlying channel is closed.end