let do_on_bam
~(run_with:Machine.t)
?(more_depends_on=[]) ~name
?(more_requirements: Machine.Make_fun.Requirement.t list = [])
input_bam ~product ~make_command =
let open KEDSL in
let samtools = Machine.get_tool run_with Machine.Tool.Default.samtools in
let src = input_bam#product#path in
let sub_command = make_command src product#path in
let program =
Program.(Machine.Tool.(init samtools) && exec ("samtools" :: sub_command))
in
let make =
Machine.run_program ~requirements:more_requirements ~name run_with program
in
workflow_node product ~name ~make
~edges:(
depends_on Machine.Tool.(ensure samtools)
:: depends_on input_bam
:: on_failure_activate (Remove.file ~run_with product#path)
:: more_depends_on)