<p>Hi,</p>

<p>I am trying to subsample from a <a href='http://samtools.sourceforge.net/SAM1.pdf'>bam</a> file using the <a href='http://samtools.sourceforge.net/'>samtools</a> view -s command.
This is working when sampling 50% or lower (-s 42.50, 42 being the seed), but anything higher fails (returns an empty file).</p>

<p>He are the exact commands i use</p>

<pre><code>samtools view -s 0.25 -b chr6_all.bam &gt; chr6_25p.sam
</code></pre>

<p>Working.</p>

<pre><code>samtools view -s 0.50 -b chr6_all.bam &gt; chr6_50p.sam
</code></pre>

<p>Working.</p>

<pre><code>samtools view -s 0.75 -b chr6_all.bam &gt; chr6_75p.sam
</code></pre>

<p>Not working. </p>

<p>I also made sure that 49% is working, but 51% is not. 
Any ideas, suggestions, or is this an intented mechanic ? There doesn't seem to by any documentation about the subsampling parameter in <a href='http://samtools.sourceforge.net/'>samtools</a> docfile. </p>

<p>Thanks. </p>

Subsampling not working for fractions above 50% is a known bug in samtools 0.1.18. (See [[Samtools-help] Randomized Subsampling Bam File / Subsampling above 50%][1].)

The bug was fixed in [March last year][2]; samtools 0.1.19 contains the corrected version.

 [1]: http://sourceforge.net/mailarchive/message.php?msg_id=29174919
 [2]: https://github.com/samtools/samtools/commit/8cf329904235d82c6c781113c404f298d06bc2b0