bam file parser in erlang