struct
type t = {
name: string;
sam_mapq_unique: int option;
overhang_length: int option;
parameters: (string * string) list;
}
let name t = t.name
let default = {
name = "default";
sam_mapq_unique = None;
overhang_length = None;
parameters = [];
}
let to_json t: Yojson.Basic.json =
let {name;
sam_mapq_unique;
overhang_length;
parameters} = t in
`Assoc [
"name", `String name;
"sam_mapq_unique",
(match sam_mapq_unique with
| None -> `Null
| Some x -> `Int x);
"overhang_length",
(match overhang_length with
| None -> `Null
| Some x -> `Int x);
"parameters",
`Assoc (List.map parameters ~f:(fun (a, b) -> a, `String b));
]
let render {name;
sam_mapq_unique;
overhang_length;
parameters} =
(match overhang_length with
| None -> ""
| Some x ->
sprintf "--sjdbOverhang %d" x
) ::
(match sam_mapq_unique with
| None -> ""
| Some x ->
if 0 > x || x > 255
then failwith "STAR Align sam_mapq_unique must be between 0 and 255"
else ();
sprintf "--outSAMmapqUnique %d" x) ::
List.concat_map parameters ~f:(fun (a, b) -> [a; b])
end