let mhc_alleles how =
match how with
| `File raw ->
MHC_alleles (get_raw_file (AF.get_file raw))
|> AF.with_provenance "mhc-alleles" ["file", AF.get_provenance raw]
| `Names strlist ->
let path =
Name_file.in_directory ~readable_suffix:"MHC_allleles.txt"
Config.work_dir strlist in
let open KEDSL in
let host = Machine.as_host Config.machine in
let product = single_file ~host path in
let node =
workflow_node product
~name:(sprintf "Inline-MHC-alleles: %s"
(String.concat ~sep:", " strlist))
~make:(
Machine.quick_run_program Config.machine Program.(
let line s =
shf "echo %s >> %s" (Filename.quote s) (Filename.quote path) in
shf "mkdir -p %s" (Filename.dirname path)
&& shf "rm -f %s" (Filename.quote path)
&& chain (List.map ~f:line strlist)
)
)
in
MHC_alleles node
|> AF.with_provenance "mhc-allelles" []
~string_arguments:(List.mapi strlist
~f:(fun i s -> sprintf "allele-%d" i, s))