使用deeptools将bam文件转换为bw文件

整理ChIP-seq / CUT & Tag 分析时用到的工具。本文只对使用的工具用法进行简单介绍。

deeptools 提供两个bam转换为bw的命令,分别是bamCoveragebamCompare。两者的区别在于bamCoverage是对单个bam文件进行转换,而bamCompare接受两个bam文件,生成两者信号比值的bw文件。

用法

bamCoverage

以下是ChIP-seq 数据转换的一个示例用法

bamCoverage --bam a.bam -o a.SeqDepthNorm.bw \
    --binSize 10
    --normalizeUsing RPGC
    --effectiveGenomeSize 2150570000

-b, --bam: 输入的bam文件
-o:输出的bw文件
-bs, --binSize:分割的bin size
--normalizeUsing:每个bins中read counts的校正单位,可以从RPKM, CPM ,BPM, RPM, RPGC中选择

  • RPKM = Reads Per Kilobase per Million mapped reads;
  • CPM= Counts Per Million mapped reads, same as CPM in RNA-seq;
  • BPM = Bins Per Million mapped reads, same as TPM in RNA-seq;
  • RPGC = reads per genomic content (1x normalization); Mapped reads are considered after blacklist filtering (if applied).
    需要注意的是选择了RPGC后,需要提供--effectiveGenomeSize

--effectiveGenomeSize:可比对基因组区域的大小(bp),可以从这里查http://deeptools.readthedocs.io/en/latest/content/feature/effectiveGenomeSize.html

--scaleFactor:数值,可以是由spike-in推算的校正因子
--numberOfProcessors, -p :使用的线程数


bamCompare

bamCompare的基本用法如下

bamCompare -b1 treatment.bam -b2 control.bam -o log2ratio.bw \
    --scaleFactorsMethod readCount \
    --binSize 10 \
    --operation log2 \
    --pseudocount 1 

其中,
-b1:处理组的bam文件
-b2:控制组的bam文件
-o:输出的bw文件
--scaleFactorsMethod: Possible choices: readCount, SES, None。用于校正样本间文库测序深度的方法,也可以将该参数设置为 None ,然后使用--normalizeUsing进行校正。

SES method reference: "Normalization, bias correction, and peak calling for ChIP-seq”. Statistical Applications in Genetics and Molecular Biology, 11(3).

--operation:Possible choices: log2, ratio, subtract, add, mean, reciprocal_ratio, first, second.

The default is to output the log2 ratio of the two samples. The reciprocal ratio returns the the negative of the inverse of the ratio if the ratio is less than 0. The resulting values are interpreted as negative fold changes. Instead of performing a computation using both files, the scaled signal can alternatively be output for the first or second file using the ‘–operation first’ or ‘–operation second’. (Default: “log2”)

--pseudocount: 添加一个较小的数值避免分母为0,默认是 1

另外,bamCoverage中使用的多数参数在bamCompare中都能使用。


本文只是简单总结了bamCoverge, bamCompare两个命令中的部分参数,关于其详细的参数列表可以到其官方文档,或者在linux下加上--help 参数查看。

ref
https://deeptools.readthedocs.io/en/develop/content/tools/bamCoverage.html?highlight=bamCoverage
https://deeptools.readthedocs.io/en/develop/content/tools/bamCompare.html?highlight=bamcompare

完。

你可能感兴趣的:(使用deeptools将bam文件转换为bw文件)