() = struct
type t = {
name: string;
filter_reads_with_n_cigar: bool;
filter_mismatching_base_and_quals: bool;
filter_bases_not_stored: bool;
parameters: (string * string) list;
}
let name t = t.name
let to_json t: Yojson.Basic.json =
let {name;
filter_reads_with_n_cigar;
filter_mismatching_base_and_quals;
filter_bases_not_stored;
parameters} = t in
`Assoc [
"name", `String name;
"filter_reads_with_N_cigar", `Bool filter_reads_with_n_cigar;
"filter_mismatching_base_and_quals", `Bool filter_mismatching_base_and_quals;
"filter_bases_not_stored", `Bool filter_bases_not_stored;
"parameters",
`Assoc (List.map parameters ~f:(fun (a, b) -> a, `String b));
]
let render {name;
filter_reads_with_n_cigar;
filter_mismatching_base_and_quals;
filter_bases_not_stored;
parameters} =
(if filter_reads_with_n_cigar
then "--filter_reads_with_N_cigar" else "") ::
(if filter_mismatching_base_and_quals
then "--filter_mismatching_base_and_quals" else "") ::
(if filter_bases_not_stored
then "--filter_bases_not_stored" else "") ::
List.concat_map parameters ~f:(fun (a, b) -> [a; b])
|> List.filter ~f:(fun s -> not (String.is_empty s))
let default =
{name = "default";
filter_reads_with_n_cigar = false;
filter_mismatching_base_and_quals = false;
filter_bases_not_stored = false;
parameters = []}
end