Question: Remove some reads from a BAM file
0
gravatar for lisadavic66
4.1 years ago by
United States
lisadavic660 wrote:

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.

myposts next-gen • 1.8k views
ADD COMMENTlink modified 4.1 years ago by Biomonika (Noolean)3.1k • written 4.1 years ago by lisadavic660
2
gravatar for Biomonika (Noolean)
4.1 years ago by
State College, PA, USA
Biomonika (Noolean)3.1k wrote:

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 COMMENTlink modified 4.1 years ago • written 4.1 years ago by Biomonika (Noolean)3.1k

Thank you for your help. I used Bowtie2.

ADD REPLYlink written 4.1 years ago by lisadavic660

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

ADD REPLYlink written 4.1 years ago by lisadavic660
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1318 users visited in the last hour