This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extracting Reads That Are Properly Paired From Bam File

How to filter BAM file

Hey Guys

I have a bam file of which I have to extract reads that are mapping in proper pair as per library construction protocol.

The definition of proper pair is PE reads facing inwards. (-----> <-----)

Not able to perfectly form the filters that I should use to extract the properly mapped pair.

I would like to add that I am not looking for all the pairs in a bam file. I understand that is trivial enough and can be pulled out with -f 3 filter in the samtools.

What I am looking for is specific pair which is mapped inwards (----> <-----) . I know many read pairs in this particular library could be mappee (<----- <-----) or (-----> ---->)

Thanks! -Abhi

bam samtools

Well I am not sure how I could re-open this thread but I dont think the other thread pointed by Keith provides the answer I am looking for. I am looking to find a specific directional pair and not all the reads that are paired. I need to know reads that are (---> <---) mapped inwards and not any pair in the data.

-Abhi

Although what constitutes a "proper pair" is, I think, up to the aligner, I think most aligners require a pair to point inwards (an "innie") and within some reasonable distance. So I don't think you'll get "lefties" or "righties" as proper pairs, and at least bwa doesn't seem to accept "outties" either - at least not my mate pair library.

1 answer

These were mentioned in the comments and I only repeat them here because I think they qualify as an answer.

The definition of a proper pair is already the one that you are looking for. The other orientations are probably not reported as a pair unless the aligner has a setting that reports these as well. In that case it is up to the aligner to tag this (with a custom tag perhaps) and you would need to look for these tags.

The BAM format only supports the concept of proper pair, but it does not specify what the proper pair means - that job is up to the aligner.

Log in to answer this question.