package bio_io

  1. Overview
  2. Docs
A library for reading and writing common file formats used in bioinformatics like FASTA files

Install

Dune Dependency

Authors

Maintainers

Sources

0.5.1.tar.gz
md5=6cc64d38a9cba13754cae52db1ade85d
sha512=5008a30225ec306378e282dab2c00d545949be0e778e4b352c5e29012e08f88acef4ed75cf03a55276b657a057355399be3a55ea77d58231a03efc66a03a8b13

doc/index.html

Bio_io

Build and test Coverage Status

The full API is browsable here.

Bio_io is an OCaml library that provides programmatic access to common file formats used in bioinformatics like FASTA files.

If you have any problems or find any bugs, open an issue on the GitHub page.

License

license MIT or Apache 2.0

Licensed under the Apache License, Version 2.0 or the MIT license, at your option. This program may not be copied, modified, or distributed except according to those terms.

Quick Start

Install

opam install bio_io

Example

Read a FASTA file and print the ID and sequence length for each record.

open! Base

let fasta_file = "sequences.fasta"

let () =
  (* This open gives you [In_channel] and [Record]. *)
  let open Bio_io.Fasta in
  In_channel.with_file_iter_records_exn fasta_file ~f:(fun record ->
      (* Print the ID and the length of the sequence. *)
      Stdio.printf "%s => %d\n" (Record.id record) (Record.seq_length record))

Overview

The Bio_io library provides input channels that return records.

For an overview see the Record_in_channel module signature. In fact, all the In_channels in this library satisfy this signature.

The Fasta module provides a Record and In_channel for reading FASTA files.

There are modules for reading "delimited" files like Btab and Btab_queries.

Extending Bio_io

The Record_in_channel.Make functor can be used to make new specialized records and input channels. To do so, you need a module that satisfies the In_channel_input_record signature. Bio_io has a couple of In_channel types in the Private module you can use for this, and then add in the input_record_exn function.

For examples, see the definitions of Fasta.In_channel and Btab.In_channel.

OCaml

Innovation. Community. Security.