<p>Hello, 
I am having a hard time opening a very large bedgraph. I have been suggested to split my <a href='http://samtools.sourceforge.net/SAM1.pdf'>bam</a> file by chromosome with chrom-bed.py but it didn't work.
Is there any other alternative?
Thanks,
GP.</p>

<p>in <a href='http://www.biostars.org/p/9130/'>this other answer</a>, Aaron Quinlan stated:</p>

<blockquote>
  <p>bamtools has a "split" command for exactly this purpose</p>
</blockquote>

<p>I can only add that I've just tried it with this simple command</p>

<pre><code>bamtools split -in file.bam -reference
</code></pre>

<p>and it works like a charm. the <a href='http://samtools.sourceforge.net/SAM1.pdf'>bam</a> file gets split into different <a href='http://samtools.sourceforge.net/SAM1.pdf'>bam</a> files, which are suffixed with .REF_xxx.bam by default, which is very convenient.</p>
