Remove reads from bam file that partially covers a region
1
0
Entering edit mode
3 months ago
arbarharw • 0

Hi,

I have several bam files and am working with a 15bp deletion at a specific region. There are reads that support the deletion and there are reads that partially cover the deleted region.

I want to filter out those reads (as shown in circle in the attached IGV snapshot) that partially cover the deleted region from the bam files. I am new in this area, so any suggestions of suitable tool or way to do that is much appreciated.

enter image description here

indel filter bam • 416 views
ADD COMMENT
0
Entering edit mode

I am not sure if it is as accurate, but the inverse (selecting reads with a 15bp deletion) would be definitely easier.

ADD REPLY
2
Entering edit mode
3 months ago

using samjdk:

java -jar dist/samjdk.jar -e 'if(record.getReadUnmappedFlag() || !record.getContig().equals("chr12")) return true; final int start=100; final int end=115; int x= record.getStart(); if(x>=start && x<=end) return false; x= record.getEnd(); if(x>=start && x<=end) return false; return true;' input.bam
ADD COMMENT
0
Entering edit mode

Thanks Pierre. It's working well for me. Below is an example of coverage before and after processing.

Before enter image description here

After: enter image description here

ADD REPLY

Login before adding your answer.

Traffic: 2129 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