Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Btab_queries.In_channel
SourceIn_channel
for Btab files where each query in the file is a single record.
WARNING: This module assumes that queries are sorted. One case in which this assumption does not hold is with mmseqs
when using more than one iteration. E.g., mmseqs easy-search --num-iterations 3
. This behavior will likely change in the future.
You should consider this module experimental.
Here is a short example program. It reads a btab file and prints out the records.
open! Base
open! Bio_io.Btab_queries
let parse_argv () =
match Sys.get_argv () with
| [| _; file_name |] -> file_name
| _ -> failwith "missing file_name"
let () =
let file_name = parse_argv () in
In_channel.with_file_iter_records file_name ~f:(fun r ->
Stdio.print_endline "===";
Stdio.print_endline @@ Record.query r;
let hits = List.map ~f:Bio_io.Btab.Record.parse @@ Record.hits r in
Stdio.print_s @@ [%sexp_of: Bio_io.Btab.Record.Parsed.t list] hits)
The output will be somthing like.
===
Q 1
(((query "Q 1") (target q1t1) (pident 0.1) (alnlen 2) (mismatch 3)
(gapopen 4) (qstart 5) (qend 6) (tstart 7) (tend 8) (evalue 9.99E-05)
(bits 10) (qlen ()) (tlen ()))
((query "Q 1") (target q1t2) (pident 0.11) (alnlen 12) (mismatch 13)
(gapopen 14) (qstart 15) (qend 16) (tstart 17) (tend 18) (evalue 1.9E-05)
(bits 20) (qlen ()) (tlen ())))
===
Q_2
(((query Q_2) (target q2t1) (pident 0.21) (alnlen 22) (mismatch 23)
(gapopen 24) (qstart 25) (qend 26) (tstart 27) (tend 28) (evalue 2.9E-05)
(bits 30) (qlen ()) (tlen ())))
include module type of struct include T end
include module type of struct include Private.Peekable_in_channel end
include Ppx_compare_lib.Equal.S with type t := t
Both peek
functions are safe to call in the context of one of the iterator functions.
include sig ... end
val with_file_foldi_records :
Base.string ->
init:'a ->
f:(Base.int -> 'a -> T.record -> 'a) ->
'a