Question: Possible To Convert Bam To Bam?
1
gravatar for Bioscientist
8.2 years ago by
Bioscientist1.7k
Bioscientist1.7k wrote:

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

bam samtools bwa • 1.8k views
ADD COMMENTlink written 8.2 years ago by Bioscientist1.7k
4
gravatar for Gww
8.2 years ago by
Gww2.7k
Canada
Gww2.7k wrote:

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 COMMENTlink written 8.2 years ago by Gww2.7k
3
gravatar for Damian Kao
8.2 years ago by
Damian Kao15k
USA
Damian Kao15k wrote:

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 COMMENTlink written 8.2 years ago by Damian Kao15k
1
gravatar for Rm
8.2 years ago by
Rm7.9k
Danville, PA
Rm7.9k wrote:

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

ADD COMMENTlink written 8.2 years ago by Rm7.9k
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: 942 users visited in the last hour