<p>Say I want to parse out all split reads. These are reads with a clipped position and a secondary mapping.</p>

<p>How do I identify these reads in samtools? Is there a flag to find reads that are split with a secondary mapping.</p>

<p>Once I have these reads, how I can I tell which chromosome they are mapped to?</p>

<p>Here&#39;s an example of what I&#39;m looking for: <a href="http://i.imgur.com/32xzFB2.png"><img alt="" src="http://i.imgur.com/32xzFB2.png" style="height:205px; width:274px" /></a></p>

<p>The blue read should have a clipped signal, I want to parse out these reads that have the alternate mapping position on the same chromosome.</p>

<p>Thanks!</p>

    samtools view -f 256 Input.bam | awk '$6 ~/S/ && $7 == "=" {print $0}' > Secondary_clipped.sam

Please debug and use it.

PS: post modified.