This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do you remove reads from .bam file with FLAG = 0?

I have used the following command to remove alignments with FLAG = 16 from sam file

samtools view -h -F 16 in.bam out.sam

This command does not remove bits with 0...

samtools view -h -F 0 in.bam out.sam

Thoughs??

samtools

1 answer

Nevermind. After looking at this page I know the identity of 0 and 16 FLAGs are unpaired but mapping reads. You can remove them by this command:

samtools view -h -f 1 in.bam out.sam

Log in to answer this question.