let compile ~reference {name; use_dbsnp; use_cosmic; additional_arguments} =
let with_db use opt_name get_exn =
if not use then None
else
let node = get_exn reference in
Some ( [opt_name; node#product#path], [KEDSL.depends_on node])
in
let args, edges =
List.filter_opt [
with_db use_dbsnp "--dbsnp" Reference_genome.dbsnp_exn;
with_db use_cosmic "--cosmic" Reference_genome.cosmic_exn;
]
|> List.split
in
(`Arguments (List.concat args @ additional_arguments),
`Edges (List.concat edges))