let of_buffer b =
let n = Buffer.length b in
if n > Caml.Sys.max_string_length then raise_bad too_long
else
let ans = String.create n in
for i = 0 to n-1 do
let c = Char.uppercase (Buffer.nth b i) in
if is_nucleic_acid c then ans.[i] <- c
else raise_bad (bad_acid (Buffer.nth b i))
done;
ans