let qualities_of_line ?(pos=Pos.unknown) ?sequence line =
let line = (line : Line.t :> string) in
match sequence with
| None -> Ok line
| Some sequence ->
let m = String.length sequence in
let n = String.length line in
if m <> n then
error
"length of sequence and qualities differ"
(pos, sequence, line)
<:sexp_of< Pos.t * string * string >>
else
Ok line