Hi all, 

I want to remove all mitochondrial reads from my BAM files, but after doing so the number of mapped reads increased.  Here's what I did after indexing:


    samtools idxstats .bam | cut -f 1 | grep -v chrM | xargs samtools view -b  .bam > clean.bam

However comparing with wc -l says:

    samtools view -F 0x904 -c clean.bam 
    19452291
    samtools view -F 0x904 -c .bam
    18328474

The second number matches the summary output by tophat2 (fr-frstrand)

any suggestions?



Your approach looks pretty strange to me, and I would instead do the following:

    samtools view -h yourbam.bam | grep -v 'chrM' | samtools view -b > yourbamwithoutchrM.bam