Possible To Convert Bam To Bam?
3
1
Entering edit mode
12.4 years ago
Bioscientist ★ 1.7k

Is it possible to convert bam to bam? I have bam produced by default BWA; but I may also need bam filtered by tossing out those with mapping quality< 20. We can convert sam to bam with a quality cut-off as 20, but storage of sam file is painful (simply too large). So just wondering if I can convert default bam to quality-control bam, so that I only need to store bam file in my system.

thx

bwa bam samtools • 2.9k views
ADD COMMENT
4
Entering edit mode
12.4 years ago
Gww ★ 2.7k

samtools view -b -q 20 in.bam > out.bam

This will filter any alignments with a mapping quality < 20 from in.bam to out.bam

ADD COMMENT
3
Entering edit mode
12.4 years ago

You can do this with [?]samtools[?]:

Samtools view has these options:

-b        Output in the BAM format.
-q INT    Skip alignments with MAPQ smaller than INT [0]
ADD COMMENT
1
Entering edit mode
12.4 years ago
Rm 8.3k

samtools view -q 20 -b inputbam > outputq20.bam

ADD COMMENT

Login before adding your answer.

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