let item_to_string ?(tags=Tags.default) =
function
| `comment c -> if tags.Tags.sharp_comments then sprintf "#%s\n" c else ""
| `variable_step_state_change (chrom, span) ->
sprintf "variableStep chrom=%s%s\n" chrom
Option.(value_map ~default:"" span ~f:(sprintf " span=%d"))
| `variable_step_value (pos, v) -> sprintf "%d %g\n" pos v
| `fixed_step_state_change (chrom, start, step, span) ->
sprintf "fixedStep chrom=%s start=%d step=%d%s\n" chrom start step
Option.(value_map ~default:"" span ~f:(sprintf " span=%d"))
| `fixed_step_value v -> sprintf "%g\n" v
| `bed_graph_value (chrom, start, stop, v) ->
sprintf "%s %d %d %g\n" chrom start stop v