let picard_reorder_sam ?mem_param ?reference_build bam =
let input_bam = get_bam (AF.get_file bam) in
let reference_build_param =
match reference_build with
| None -> input_bam#product#reference_build
| Some r -> r
in
let output_bam_path =
Name_file.from_path input_bam#product#path
~readable_suffix:"reorder_sam.bam" [reference_build_param] in
Bam (
Tools.Picard.reorder_sam
?mem_param ?reference_build
~run_with ~input_bam output_bam_path
)
|> AF.with_provenance "picard-reorder-sam" ["bam", AF.get_provenance bam]
~string_arguments:["reference-build", reference_build_param]