I mapped reads using bwa mem and created a sorted bam file. An example flagstat is as follows:
12446425 + 0 in total (QC-passed reads + QC-failed reads)
178116 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
10794644 + 0 mapped (86.73% : N/A)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (N/A : N/A)
0 + 0 with itself and mate mapped
0 + 0 singletons (N/A : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
So mapping is at 86%. However, when I try to separate out the unmapped reads using this code:
samtools view -f 4 -H -b in.bam > unmapped.bam
I get no reads.
0 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
0 + 0 mapped (N/A : N/A)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (N/A : N/A)
0 + 0 with itself and mate mapped
0 + 0 singletons (N/A : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
What am I missing?
genome
samtools
bwa