let bgzip ~run_with input_file output_path =
let open KEDSL in
let samtools = Machine.get_tool run_with Machine.Tool.Default.samtools in
let program =
Program.(Machine.Tool.(init samtools)
&& shf "bgzip %s -c > %s" input_file#product#path output_path) in
let name =
sprintf "samtools-bgzip-%s" Filename.(basename input_file#product#path) in
let make = Machine.run_program ~name run_with program in
let host = Machine.(as_host run_with) in
workflow_node
(single_file output_path ~host) ~name ~make
~edges:[
depends_on input_file;
depends_on Machine.Tool.(ensure samtools);
on_failure_activate (Remove.file ~run_with output_path);
]