let print_read_group (x:read_group) =
let s tag value = match value with
| None -> ""
| Some x -> sprintf "\t%s:%s" tag x
in
sprintf "@RG\tID:%s%s%s%s%s%s%s%s%s%s%s%s"
x.id
(s "CN" x.seq_center)
(s "DS" x.description)
(s "DT" (Option.map x.run_date
~f:(function
| `Date x -> Date.to_string x
| `Time x -> Time.to_string x) )
)
(s "FO" x.flow_order)
(s "KS" x.key_seq)
(s "LB" x.library)
(s "PG" x.program)
(s "PI" (Option.map x.predicted_median_insert_size ~f:Int.to_string))
(s "PL" (Option.map x.platform ~f:print_platform))
(s "PU" x.platform_unit)
(s "SM" x.sample)