Question: Filtering BAM file to extract PE reads that mapped as proper pairs, including PE reads that did not map, but their mate did
0
gravatar for macielrodriguez2
3 months ago by
macielrodriguez220 wrote:

Hi!

I'm working on the assembly of a chloroplast genome. I have a bam file and I wanted to:

  1. Remove pairs that did not map to the reference genome
  2. Keep reads that are mapped as proper pairs
  3. Keep reads in a pair where one read mapped but the other did not (I want to include the unmapped read if its pair mapped properly)

I have been reading about the flags and my teacher and I did the following steps:

samtools fastq   -f 3   -1 paired_1.fastq   -2 paired_2.fastq   zm_cp.bam           
samtools fastq   -f 9   -1 unmapped_1.fastq   -2 unmapped_2.fastq   zm_cp.bam   
samtools fastq   -f 5   -1 unmapped_t1.fastq  -2 unmapped_t2.fastq  zm_cp.bam

cat   unmapped_1.fastq   unmapped_t1.fastq   >   tmp1.fastq         
cat   unmapped_t2.fastq   unmapped_2.fastq   >   tmp2.fastq          
cat   paired_1.fastq   tmp1.fastq   >   chloroplast_reads_1.fastq            
cat   paired_2.fastq   tmp2.fastq   >   chloroplast_reads_2.fastq

I wanted to be sure if this workflow is appropiate. I'll be very happy to read some advice :)

Thanks a lot in advance!

alignment next-gen assembly • 150 views
ADD COMMENTlink modified 3 months ago by finswimmer12k • written 3 months ago by macielrodriguez220
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: 1733 users visited in the last hour