let index
~reference_build
~(run_with : Machine.t) =
let open KEDSL in
let reference_transcriptome =
Machine.get_reference_genome run_with reference_build
|> Reference_genome.cdna_exn in
let kallisto_tool = Machine.get_tool run_with Machine.Tool.Default.kallisto in
let name =
sprintf "kallisto-index-%s" (Filename.basename reference_transcriptome#product#path) in
let reference_dir = (Filename.dirname reference_transcriptome#product#path) in
let result = sprintf "%s.kallisto.idx" reference_dir in
workflow_node ~name
(single_file ~host:(Machine.(as_host run_with)) result)
~edges:[
on_failure_activate (Workflow_utilities.Remove.file ~run_with result);
depends_on reference_transcriptome;
depends_on Machine.Tool.(ensure kallisto_tool);
]
~make:(Machine.run_big_program run_with ~name
~self_ids:["kallisto"; "index"]
Program.(
Machine.Tool.(init kallisto_tool)
&& shf "kallisto index -i %s %s"
result
reference_transcriptome#product#path
))