let decode al header =
flags al >>= fun flags ->
rname al header >>= fun rname ->
cigar al >>= fun cigar ->
rnext al header >>= fun rnext ->
qual al >>= fun qual ->
optional_fields al >>= fun optional_fields ->
Sam.alignment
?qname:(qname al) ~flags ?rname ?pos:(pos al) ?mapq:(mapq al)
~cigar ?rnext ?pnext:(pnext al) ?tlen:(tlen al)
?seq:(seq al) ~qual ~optional_fields
()