Question: Downsample BAM file according to coverage
2
gravatar for QVINTVS_FABIVS_MAXIMVS
4.5 years ago by
USA SoCal
QVINTVS_FABIVS_MAXIMVS2.3k wrote:

I have a BAM file that has 33X whole genome coverage. 

I would like to create a new BAM file from the original that has 10X genome coverage. 

Is this the correct method? 

samtools view -h -s 0.3 in.bam >10x.bam

Also what methods do you use for fast calculation of whole genome coverage? GATK is bloody slow. 

 

sequencing samtools bam reads • 4.2k views
ADD COMMENTlink modified 4.5 years ago by Devon Ryan91k • written 4.5 years ago by QVINTVS_FABIVS_MAXIMVS2.3k

~/programs/jvarkit/dist/bamstats04 is pretty good... but it's a pain to compile with ant... nevertheless, I managed after a day or so and now im happy, it's really useful.

 

USAGE: BamStats04 [options]

 Coverage statistics for a BED file. It uses the Cigar string instead of the start/end to get the voverageVersion: 1.0

Version: null


Options:

--help
-h                            Displays options specific to this tool.

--stdhelp
-H                            Displays options specific to this tool AND options common to all Picard command line
                              tools.

--version                     Displays program version.

IN=File
I=File                        BAM file to process.  Required.

BEDILE=File
BED=File                      BED File.  Required.

NO_DUP=Boolean
NODUP=Boolean                 discard duplicates  Default value: true. This option can be set to 'null' to clear the
                              default value. Possible values: {true, false}

NO_ORPHAN=Boolean
NOORPHAN=Boolean              discard not properly paired  Default value: true. This option can be set to 'null' to
                              clear the default value. Possible values: {true, false}

NO_VENDOR=Boolean
NOVENDOR=Boolean              discard failing Vendor Quality  Default value: true. This option can be set to 'null' to
                              clear the default value. Possible values: {true, false}

MMQ=Integer
MIN_MAPING_QUALITY=Integer    min mapping quality  Default value: 0. This option can be set to 'null' to clear the
                              default value.

MIN_COVERAGE=Integer
MIN_COV=Integer               min coverage to say the position is not covered  Default value: 0. This option can be set
                              to 'null' to clear the default value.

 

ADD REPLYlink written 4.5 years ago by apelin20470
3
gravatar for Devon Ryan
4.5 years ago by
Devon Ryan91k
Freiburg, Germany
Devon Ryan91k wrote:

Yes, the -s 0.3 will result in an average 10x coverage. One simple method to get total coverage is to simply parse the output of samtools depth.

ADD COMMENTlink written 4.5 years ago by Devon Ryan91k
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: 576 users visited in the last hour