Hi everyone,
I've been missing functions that would be the symetric to the in_channel_to_*_items, that is simple sequential wrappers of [Transform]s to save a fasta/fastq/bed/gff file. I wrote one for fasta files, as follows:
let char_seq_items_to_out_channel ?tags items oc =
let open Fasta in
let t =
Biocaml_transform.compose
(Transform.char_seq_item_to_raw_item ?tags ())
(Transform.char_seq_raw_item_to_string ?tags ())
in
Stream.iter
(Biocaml_transform.to_stream_fun t items)
~f:(output_string oc)
Is this a correct use of [Transform]s?
More generally, how about adding similar functions in all modules proposing transforms? I think just as the in_channel_to_*_items permit a concise incantation to read values, we should have the same for writing to files. I would start by adding a general function in Biocaml_transform:
val stream_to_out_channel : ('a, string) Biocaml_transform.t -> 'a Stream.t -> out_channel -> unit
Please tell me how it sounds, and if relevant I'll submit a patch.
Philippe.