This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter Reads Where Both A Read And Its Pair Is Unmapped.

I have a bam file with all reads. I would like to filter out reads where both the read and its mate are unaligned. If either of them is aligned, I would like to keep both. Would

samtools view -F 12 file.bam

work?

Thanks,

samtools next-gen sequencing mapping

1 answer

yes,

[?]

will throw away only those reads that are unmapped and their pair is unmapped as well.

I wonder of how the assumption of a mate's existence work - say if a read unmapped but the mate is missing - Is that considered as unmapped?

To be honest, I don't know. you could specify -f 1 to take into account only paired reads. have a look here.

mate missing? it might not be possible unless paired reads are unequal?

Log in to answer this question.