Next up we create three filter categories for:
- An unmapped read whose mate is mapped.
- A mapped read who's mate is unmapped
- Both reads of the pair are unmapped
samtools view -u -f 4 -F264 alignments.bam > tmps1.bam samtools view -u -f 8 -F 260 alignments.bam > tmps2.bam samtools view -u -f 12 -F 256 alignments.bam > tmps3.bamThe above step will work on sorted or unsorted BAM files.
We then merge these temporary bam files and sort into read name order. The sort is required to get the mates into the correct order.
samtools merge -u - tmps[123].bam | samtools sort -n - unmapped
No comments:
Post a Comment