This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Does A Bwa Bam File Contain Entries For All Unaligned Paired-End Reads?

i have a basic question: I am using default parameter to run the bwa to align to a a reference geneome. I would like to know if bam represents all the reads used in the paired end fastq file? (including reads from pairs where one mate maps, and where no mates map). Why Iam asking this is, I need to rebuild the fastq using bam?

bam bwa read counts fastq

1 answer

Yes the file contains all reads from your input file. You may use samtools to filter for reads that have proper pairs, only one end etc.

thanks @Istvan Albert: I tried flag 8 for mate unmapped: and flag 4 for read unmapped; both these have lot of intersections....BTW how to fetch out using flags both reads unmapped.

thanks @Istvan Albert: I tried flag 8 for mate unmapped: and flag 4 for read unmapped; both these have lot of intersections....BTW how to fetch out using flags both reads unmapped (is it samtools view -f 12 ).

I have used that link...still it doenot solve my problem...

samtools -u -f 4 input.bam | samtools view -f 8 - >both.unaligned.sam ;

Log in to answer this question.