let gatk_bqsr ?(configuration = Tools.Gatk.Configuration.default_bqsr) bam =
let input_bam = get_bam (AF.get_file bam) in
let output_bam =
let (bqsr, preads) = configuration in
Name_file.from_path input_bam#product#path
~readable_suffix:"gatk_bqsr.bam" [
bqsr.Tools.Gatk.Configuration.Bqsr.name;
preads.Tools.Gatk.Configuration.Print_reads.name;
] in
let config_bqsr, config_print_reads = configuration in
Bam (
Tools.Gatk.base_quality_score_recalibrator ~configuration
~run_with ~input_bam ~output_bam
)
|> AF.with_provenance "gatk-bqsr" ["bam", AF.get_provenance bam]
~string_arguments:[
"bqsr-configuration-name",
config_bqsr.Tools.Gatk.Configuration.Bqsr.name;
"print-reads-configuration-name",
config_print_reads.Tools.Gatk.Configuration.Print_reads.name;
]
~json_arguments:[
"bqsr-configuration",
Tools.Gatk.Configuration.Bqsr.to_json config_bqsr;
"print-reads-configuration",
Tools.Gatk.Configuration.Print_reads.to_json config_print_reads;
]