Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Btab.In_channelSourceIn_channel for Btab records.
For more general info, see the Bio_io.Record_in_channel module mli file.
For some examples, see Bio_io.Fasta.In_channel. Those are for the FASTA files, but the API is the same..
include Record_in_channel.S with type record := Record.tcreate file_name opens an input channel on the file specified by file_name. You may want to use Base.Exn.protectx with this.
with_file file_name ~f executes ~f on the channel created from file_name and ensures it is closed properly.
input_record t returns Some record if there is a record to return. If there are no more records, None is returned. Raises exceptions on bad input (e.g., bad file format).
fold_records t ~init ~f reduces all records from a t down to a single value of type 'a.
fold'_records t ~init ~f is like fold_records except that f is provided the 0-based record index as its first argument.
with_file_fold_records file_name ~init ~f is like fold_records t ~init ~f except that it is passed a file name, and it manages t automatically. See with_file.
val with_file_foldi_records :
Base.string ->
init:'a ->
f:(Base.int -> 'a -> Record.t -> 'a) ->
'awith_file_foldi_records file_name ~init ~f is like foldi_records t ~init ~f except that it is passed a file name, and it manages t automatically. See with_file.
The iter functions are like the fold functions except they do not take an init value and the f function returns unit insead of some other value 'a, and thus return unit rather than a value 'a.
Use them for side-effects.
iter_records t ~f calls f on each record in t. As f returns unit this is generally used for side effects.
iteri_records t ~f is like iteri_records t ~f except that f is passed in the 0-indexed record index as its first argument.
with_file_iter_records file_name ~init ~f is like iter_records t ~init ~f except that it is passed a file name, and it manages t automatically. See with_file.
val with_file_iteri_records :
Base.string ->
f:(Base.int -> Record.t -> Base.unit) ->
Base.unitwith_file_iteri_records file_name ~init ~f is like iteri_records t ~init ~f except that it is passed a file name, and it manages t automatically. See with_file.
These functions return record lists.
These are a bit different:
* There are no with_file versions as you would have to do some fiddly things to keep the channel open, making them not so nice to use.
* If an exception is raised sometime during the pipeline, it will blow up, but any successful processing that happended, will have happened. So be careful if you are doing side-effecting things.
record_sequence t returns a Sequence.t of record.