View Single Post
Old 04-26-2012, 09:16 AM   #5
swbarnes2
Senior Member
 
Location: San Diego

Join Date: May 2008
Posts: 912
Default

Code:
samtools view -bF 4 file.bam > mapped.bam
will make a new .bam that has only mapped reads.

the -F 4 means that it will exclude entries in your .bam that have the 4 flagged in the binary flag; 4 is the code for unmapped read. The -b means that it will output a .bam, instead of a .sam, which is the default behavior for samtools view.
swbarnes2 is offline   Reply With Quote