How to filter bam file for only reads that span certain regions of the genome?
1
0
Entering edit mode
2.5 years ago

Hello, is there a tool that can find only the reads that span the entire section(s) that I am interested in. Ideally I would just need a sorted and indexed bam file and a bed file with the regions that I am interested in and it would output a new bam with just the reads of interest. I do not think that bedtools intersect would get me what I want, though I would be happy if someone could explain what arguments I might need if it can do what I want.

I want only the reads that span the entire region(s) of interest, as I am looking at highly repetitive regions using long read sequencing technologies.

Just checking in before I go ahead and make such a tool...

Thanks!

edit: it is possible that the bedtools intersect flag -f can let me do this, reading more now... "-f Minimum overlap required as a fraction of A. Default is 1E-9 (i.e. 1bp)." if I set f to a value of 1, it should only include reads that capture the entire region. I will continue to report back

reference-genome bam sam bedtools • 1.6k views
ADD COMMENT
1
Entering edit mode

How to Extract Specific Region on Bam file

If you need to extract the reads then a similar strategy works. Looks for similar threads here.

ADD REPLY
0
Entering edit mode

Thank you for the quick reply, but I believe that solution will include partial reads that are at that location. I want only reads that span the entire region(s) to build a consensus from. I have the read depth for it.

ADD REPLY
2
Entering edit mode
ADD COMMENT
0
Entering edit mode

Yes I believe this will solve my problem! Thank you! GenoMax

ADD REPLY

Login before adding your answer.

Traffic: 3515 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6