let bwa_mem_opt_inputs_exn inp =     let open Input in     let is_gz r =       Filename.check_suffix r ".gz" || Filename.check_suffix r ".fqz" in     let inputs =       match inp with       | Bam _ -> failwith "Can't pass Input.t Bam to bwa_mem_opt_inputs"       | Fastq {fastq_sample_name; files} ->         let sample_name = fastq_sample_name in         List.map files ~f:(fun (fragment_id, source) ->             match source with             | PE (r1, r2) when is_gz r1 && is_gz r2 ->               `Fastq_gz Bfx.(                   let r1 = input_url r1 in                   let r2 = input_url r2 in                   Bfx.fastq_gz ~sample_name ?fragment_id ~r1 ~r2 ()                 )             | PE (r1, r2) when not (is_gz r1 || is_gz r2) ->               `Fastq Bfx.(                   let r1 = input_url r1 in                   let r2 = input_url r2 in                   Bfx.fastq ~sample_name ?fragment_id ~r1 ~r2 ()                 )             | PE _ (* heterogeneous *) ->               failwithf "Heterogeneous gzipped / non-gzipped input paired-end FASTQs not implemented"             | SE r when is_gz r ->               `Fastq_gz Bfx.(                   let r1 = input_url r in                   Bfx.fastq_gz ~sample_name ?fragment_id ~r1 ()                 )             | SE r (* when not (is_gz r) *) ->               `Fastq_gz Bfx.(                   let r1 = input_url r in                   Bfx.fastq_gz ~sample_name ?fragment_id ~r1 ()                 )             | Of_bam (how, sorting, reference_build, path) ->               let f = Bfx.input_url path in               let bam = Bfx.bam  ~sample_name ?sorting ~reference_build f in               `Bam (bam, how)           )     in     inputs