package biocaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Biocaml_unix.BgzfSource

I/O on Blocked GNU Zip format (BGZF) files

Sourcetype in_channel

Representation of files opened for reading.

Sourceval open_in : string -> in_channel

Opens a BGZF file for reading.

  • raises Sys_error

    if the path given in argument does not refer to an existing file.

Sourceval of_in_channel : in_channel -> in_channel

Uses a regular channel to read a BGZF compressed file.

Sourceval close_in : in_channel -> unit

Closes an open file. The channel cannot be used after that call.

Sourceval dispose_in : in_channel -> unit

Releases the resources associated to a (BGZF) channel (it can thus not be used after that call), apart from the underlying regular channel (which can be used further).

Sourceval seek_in : in_channel -> Core.Int64.t -> unit

seek_in iz p moves the current handler to the position p, a so-called virtual file offset, as described in paragraph 4.1.1 of the SAM/BAM format specification. The upper 48 bits correspond to a standard file offset which must match a block beginning, and the lower 16 correspond to an offset in the uncompressed data of the block.

Sourceval virtual_offset : in_channel -> Core.Int64.t

virtual_offset iz provides the current position in the file using the same encoding than for seek_in.

Sourceexception Error of string

Exception signaling an incorrect format while reading data from an open file. All input functions may raise this exception.

Sourceval input_char : in_channel -> char
Sourceval input_u8 : in_channel -> int
Sourceval input_s8 : in_channel -> int
Sourceval input_u16 : in_channel -> int
Sourceval input_s16 : in_channel -> int
Sourceval input_s32 : in_channel -> int32
Sourceval input : in_channel -> bytes -> int -> int -> int

input ic buf pos len reads at most len characters in file ic, stores them in string buf at position pos, and returns the number of characters actually read.

Sourceval really_input : in_channel -> bytes -> int -> int -> unit

Same as input but reads exactly len characters.

  • raises

    End_of_file if there are less than len characters available.

Sourceval input_string : in_channel -> int -> string

Same as really_input but returns the result in a fresh string.

Sourceval with_file_in : string -> f:(in_channel -> 'a) -> 'a

with_file_in fn ~f opens a channel for reading, pass it to f, and returns the result after having closed the channel. If the call to f raises an exception, it is caught and the channel is closed before the exception is re-raised.

Sourcetype out_channel

Representation of files opened for writing.

Sourceval open_out : ?level:int -> string -> out_channel

open_out ~level fn opens the file at path fn for writing a BGZF-compressed file with compression level level (default is 6, legal values are 1 to 9).

  • raises Sys_error

    if fn does not refer to an existing file.

    @raise Invalid_arg

    if level is not between 1 and 9.

Sourceval of_out_channel : ?level:int -> out_channel -> out_channel

Uses a regular channel to write a BGZF compressed file.

Sourceval close_out : out_channel -> unit

Closes a file opened for writing. The channel must not be used after that call.

Sourceval dispose_out : out_channel -> unit

Releases the resources associated to a (BGZF) channel (it can thus not be used after that call), apart from the underlying regular channel (which can be used further).

Sourceval output : out_channel -> bytes -> pos:int -> len:int -> unit

output oc buf ~pos ~len writes len characters of string buf from position pos into the compressed file oc.

Sourceval output_from_string : out_channel -> string -> pos:int -> len:int -> unit

Same as output but reading from a string instead of bytes.

Sourceval output_char : out_channel -> char -> unit
Sourceval output_u8 : out_channel -> int -> unit

output_u8 oz n writes the 8 least significant bits onto channel oz

Sourceval output_s8 : out_channel -> int -> unit

output_s8 oz n writes a signed representation of n, if n is between -128 and 127.

  • raises Invalid_arg

    if n is outside this range.

Sourceval output_u16 : out_channel -> int -> unit

output_u16 oz n writes the 16 least significant bits onto channel oz

Sourceval output_s16 : out_channel -> int -> unit

output_s8 oz n writes a signed representation of n, if n is between -32768 and 32767.

  • raises Invalid_arg

    if n is outside this range.

Sourceval output_s32 : out_channel -> int32 -> unit

output_s32 oz n writes a signed representation of n.

Sourceval output_string : out_channel -> string -> unit
Sourceval with_file_out : ?level:int -> string -> f:(out_channel -> 'a) -> 'a

with_file_out ~level fn ~f opens a file for writing at compression level level (default is 6), passes the channel to f and returns the result after closing the channel. If the call to f raises an exception, it is re-raised after closing the channel.

OCaml

Innovation. Community. Security.