package biocaml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fae219e66db06f81f3fd7d9e44717ccf2d6d85701adb12004ab4ae6d3359dd2d
sha512=f6abd60dac2e02777be81ce3b5acdc0db23b3fa06731f5b2d0b32e6ecc9305fe64f407bbd95a3a9488b14d0a7ac7c41c73a7e18c329a8f18febfc8fd50eccbc6
doc/biocaml.unix/Biocaml_unix/Bgzf/index.html
Module Biocaml_unix.Bgzf
Source
I/O on Blocked GNU Zip format (BGZF) files
Representation of files opened for reading.
Opens a BGZF file for reading.
Uses a regular channel to read a BGZF compressed file.
Closes an open file. The channel cannot be used after that call.
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).
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.
virtual_offset iz
provides the current position in the file using the same encoding than for seek_in
.
Exception signaling an incorrect format while reading data from an open file. All input functions may raise this exception.
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.
Same as input
but reads exactly len
characters.
Same as really_input
but returns the result in a fresh string.
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.
Representation of files opened for writing.
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).
Uses a regular channel to write a BGZF compressed file.
Closes a file opened for writing. The channel must not be used after that call.
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).
output oc buf ~pos ~len
writes len
characters of string buf
from position pos
into the compressed file oc
.
Same as output
but reading from a string instead of bytes.
output_u8 oz n
writes the 8 least significant bits onto channel oz
output_s8 oz n
writes a signed representation of n
, if n
is between -128 and 127.
output_u16 oz n
writes the 16 least significant bits onto channel oz
output_s8 oz n
writes a signed representation of n
, if n
is between -32768 and 32767.
output_s32 oz n
writes a signed representation of n
.
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.