package biocaml

  1. Overview
  2. Docs
The OCaml Bioinformatics Library

Install

Dune Dependency

Authors

Maintainers

Sources

biocaml-0.11.2.tbz
sha256=fae219e66db06f81f3fd7d9e44717ccf2d6d85701adb12004ab4ae6d3359dd2d
sha512=f6abd60dac2e02777be81ce3b5acdc0db23b3fa06731f5b2d0b32e6ecc9305fe64f407bbd95a3a9488b14d0a7ac7c41c73a7e18c329a8f18febfc8fd50eccbc6

doc/biocaml.unix/Biocaml_unix/Bam/index.html

Module Biocaml_unix.BamSource

Read and write BAM format.

The implementation does its best to comply with the official specification.

A BAM file is composed of a header and a list of alignment records. The datatypes used in this module are based on those defined in the Sam module.

Sourcemodule Header : sig ... end

BAM header files contain a plain text SAM header, plus additional information related to the encoding of the file.

Sourcetype alignment = Sam.alignment
Sourcemodule Alignment0 : sig ... end

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.

Sourceval read0 : Core.In_channel.t -> (Header.t * Alignment0.t Core.Or_error.t Stream.t) Core.Or_error.t

read0 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.

Sourceval with_file0 : string -> f:(Header.t -> Alignment0.t Core.Or_error.t Stream.t -> 'a Core.Or_error.t) -> 'a Core.Or_error.t

with_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.

Sourceval write0 : Header.t -> Alignment0.t Stream.t -> Core.Out_channel.t -> unit

write0 h xs oc writes the header h and (partially parsed) alignments xs to oc.

Sourceval read : Core.In_channel.t -> (Header.t * alignment Core.Or_error.t Stream.t) Core.Or_error.t

read 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.

Sourceval with_file : string -> f:(Header.t -> alignment Core.Or_error.t Stream.t -> 'a Core.Or_error.t) -> 'a Core.Or_error.t

with_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.

Sourceval write : Header.t -> alignment Stream.t -> Core.Out_channel.t -> unit Core.Or_error.t

write h xs oc writes the header h and the alignments xs to oc.

Low-level access

Sourceval read_alignment : Bgzf.in_channel -> Alignment0.t Core.Or_error.t option
Sourceval read_alignment_stream : Bgzf.in_channel -> Alignment0.t Core.Or_error.t Stream.t
OCaml

Innovation. Community. Security.