let bwa_mem_opt
?(configuration = Tools.Bwa.Configuration.Mem.default)
~reference_build
input =
let bwa_mem_opt input annot =
let result_prefix =
Name_file.in_directory ~readable_suffix:"bwamemopt" Config.work_dir [
Tools.Bwa.Configuration.Mem.name configuration;
Tools.Bwa.Input_reads.sample_name input;
Tools.Bwa.Input_reads.read_group_id input;
] in
Bam (
Tools.Bwa.mem_align_to_bam
~configuration ~reference_build ~run_with ~result_prefix input
)
|> AF.with_provenance "bwa-mem-opt" ["input", annot]
~string_arguments:[
"reference-build", reference_build;
"configuration-name", Tools.Bwa.Configuration.Mem.name configuration;
]
~json_arguments:[
"configuration", Tools.Bwa.Configuration.Mem.to_json configuration;
]
in
let of_input =
function
| `Fastq fastq ->
let fq = get_fastq (AF.get_file fastq) in
bwa_mem_opt (`Fastq fq) (AF.get_provenance fastq)
| `Fastq_gz fqz ->
let fq = get_gz (AF.get_file fqz) |> get_fastq in
bwa_mem_opt (`Fastq fq) (AF.get_provenance fqz)
| `Bam (b, p) ->
let bam = get_bam (AF.get_file b) in
bwa_mem_opt (`Bam (bam, `PE)) (AF.get_provenance b)
in
of_input input