
当我们需要在UCSC browser中可视化的时候,将bam文件转化为bigwig文件会更加方便。而deeptools中的bamCoverage可以方便的实现这个功能。

conda或者pip安装:
conda install -c bioconda deeptools
# 或者
pip install deeptoolsgithub源代码安装:
git clone https://github.com/deeptools/deepTools.git
wget https://github.com/deeptools/deepTools/archive/1.5.12.tar.gz
tar -xzvf
python setup.py install --prefix /User/Tools/deepTools2.0一定要注意一下的依赖包必须满足要求:

如果不满足要求的话,bam2Coverage可能会引发如下错误: "The XXX file does not have BAM or CRAM format"; "ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'"等等。
必需参数:

需指定输入文件,输出文件名。输出文件格式默认为bigwig,如果想输出bedgraph文件需指定。
非必需参数:


此外还有Read coverage normalization options和Read coverage normalization options,有具体需要可以查阅。
ChIP-seq的例子:
bamCoverage --bam a.bam -o a.SeqDepthNorm.bw \
--binSize 10
--normalizeUsing RPGC
--effectiveGenomeSize 2150570000
--ignoreForNormalization chrX
--extendReadsRNA-seq的例子:
bamCoverage -b a.bam -o a.bw当我们需要分离正负链时(单端):
bamCoverage -b a.bam -o forward.bw --filterRNAstrand forward
bamCoverage -b a.bam -o reverse.bw --filterRNAstrand reverse
# 如果在2.2版本之前:
bamCoverage -b a.bam -o a.fwd.bw --samFlagExclude 16
bamCoverage -b a.bam -o a.rev.bw --samFlagInclude 16相当于我们做了如下操作:
samtools view -@ 8 a.bam | \
awk -F '\t' '$2==0' | \
bamCoverage -b a.bam -o a.fwd.bw