Remove some reads from a BAM file
1
0
Entering edit mode
9.1 years ago

Hi,

I have a paired-end BAM file and I found that some pairs/mates have identical positions on the chromosome, i.e., the numbers in the POS and PNEXT fields are exactly the same. I want to remove these reads.

I also found that some reads present more than 2 times in my BAM file (same QNAME) (I think paired-end reads should have two records/rows in a BAM file). I want to keep the first two records/rows and remove the others.

I used samtools rmdup to remove duplicates.

Any help will be greatly appreciated. Thank you.

next-gen • 3.7k views
ADD COMMENT
2
Entering edit mode
9.1 years ago

For your first task, picard's Mark Duplicates might do better job than rmdup. For your second task, maybe you have some supplementary alignments? Those would show up as multiple rows. Try removing them with samtools:

samtools view -bh -F 2048 input.bam >output.bam

Also please add which mapper you used, that will be helpful.

ADD COMMENT
0
Entering edit mode

Thank you for your help. I used Bowtie2.

ADD REPLY
0
Entering edit mode

Is there any simple way, e.g., a Linux command solution, for these problem? Thanks.

ADD REPLY

Login before adding your answer.

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