Is there a out of the box to convert a .bam file to a .wig file at specific resolution/bin size?

I was thinking to use igvtools, but I am not sure how it works:

igvtools count -z 5 -w 25 -e 250 alignments.bam alignments.cov.tdf hg19

What is the diffrence between -w,-z,-e?

-z num  Specifies the maximum zoom level to precompute. The default
               value is 7 and is sufficient for most files. To reduce file
               size at the expense of IGV performance this value can be

 -e, --extFactor num

The read or feature is extended by the specified distance in bp prior to counting. This option is useful for chip-seq and rna-seq applications. The value is generally set to the average fragment length of the library minus the average read length.

-w, --windowSize num

The window size over which coverage is averaged. Defaults to 25 bp.


Using deepTools to get a bin size of 10 and 20 threads:

bamCoverage -of bedgraph -bs 10 -b input.bam -p 20

You'll probably prefer the default bigWig format if you need random access or to use something like IGV.

Regarding the options to igvtools, -w is equivalent to -bs/--binSize in deepTools and denotes the resolution of the output data. -e (it's the same option in bamCoverage) denotes whether and how much to extend a read in its 3' direction. This done such that the output represents the sequences fragments. -z is specific to things like bigWig files (and apparently tdf files), where there are precomputed values that IGV will load as you zoom out (the various resolutions are "zoom levels", which is parlance taken from the bigWig format).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.