Question: Stop BWA from storing unmapped reads
0
gravatar for CC
4 weeks ago by
CC20
Melbourne, Australia
CC20 wrote:

I am currently using BWA-MEM to map metagenomic reads to a small (~12kb) virus reference genome for a large number of samples. I have a lot of reads per sample - upwards of 10 million.

The majority of the reads (~99%) do not match my reference - I am not interested in analysing these reads. However, the .sam file that BWA-MEM produces stores the unmapped reads, and I am stuck with these huge files that are taking up disk space (I do convert these into sorted .bam files and delete the .sam file, but they're still huge).

Is there any way to stop BWA-MEM from storing the unmapped reads in the .sam file and only keep the mapped reads?

Thank you for letting me know.

bwa alignment • 113 views
ADD COMMENTlink modified 4 weeks ago by ATpoint23k • written 4 weeks ago by CC20
4
gravatar for ATpoint
4 weeks ago by
ATpoint23k
Germany
ATpoint23k wrote:
bwa mem (...) | samtools view -F 4 -o onlyMapped.bam

See http://broadinstitute.github.io/picard/explain-flags.html

ADD COMMENTlink written 4 weeks ago by ATpoint23k
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: 758 users visited in the last hour