<p>I got several <a href='http://samtools.sourceforge.net/SAM1.pdf'>SAM</a>/BAM files, and I am interested in 5'ends of the mapped reads. Is there any tools or scripts to count how many 5'ends are mapped at a specific genomic position? </p>

<p><strong>N.B.</strong> I am not try to count the total reads number mapped to the specific genomic position. </p>

<p>For example, in the following window, I get 5 reads, 3 of them have a 5'ends at 14488, the other 2 have a 5'ends at 14487. </p>

<p><img src='http://s23.postimg.org/83y733kp7/Screen_Shot_2013_08_30_at_20_12_37.png' alt='enter image description here' /></p>

<p>And I want produce a table like this.</p>

<p><img src='http://s9.postimg.org/r1xebaei3/Screen_Shot_2013_08_30_at_20_15_30.png' alt='enter image description here' />. </p>

<pre>
<code>bedtools genomecov -d -5 -ibam input.bam -g genome.fa &gt; output.txt</code></pre>

<p>More options see bedtools documents at http://bedtools.readthedocs.org/en/latest/content/tools/genomecov.html</p>
