deepTools 使用指南

deepTools

deepTools 是一套基于python開發(fā)的工具,適用于有效處理分析高通量測(cè)序數(shù)據(jù)始衅,可用于ChIP-seq, RNA-seq 或 MNase-seq汛闸。


#1. deepTools 系列工具

deepTools workflow

##1.1 deepTools 系列工具信息匯總

tool type input files main output file(s) application
multiBamSummary data integration 2 or more BAM interval-based table of values perform cross-sample analyses of read counts –> plotCorrelation, plotPCA
multiBigwigSummary data integration 2 or more bigWig interval-based table of values perform cross-sample analyses of genome-wide scores –> plotCorrelation, plotPCA
plotCorrelation visualization bam/multiBigwigSummary output clustered heatmap visualize the Pearson/Spearman correlation
plotPCA visualization bam/multiBigwigSummary output 2 PCA plots visualize the principal component analysis
plotFingerprint QC 2 BAM 1 diagnostic plot assess enrichment strength of a ChIP sample
computeGCBias QC 1 BAM 2 diagnostic plots calculate the exp. and obs. GC distribution of reads
correctGCBias QC 1 BAM, output from computeGCbias 1 GC-corrected BAM obtain a BAM file with reads distributed according to the genome’s GC content
bamCoverage normalization BAM bedGraph or bigWig obtain the normalized read coverage of a single BAM file
bamCompare normalization 2 BAM bedGraph or bigWig normalize 2 files to each other (e.g. log2ratio, difference)
computeMatrix data integration 1 or more bigWig, 1 or more BED zipped file for plotHeatmap or plotProfile compute the values needed for heatmaps and summary plots
estimateReadFiltering information 1 or more BAM files table of values estimate the number of reads filtered from a BAM file or files
alignmentSieve QC 1 BAM file 1 filtered BAM or BEDPE file filters a BAM file based on one or more criteria
plotHeatmap visualization computeMatrix output heatmap of read coverages visualize the read coverages for genomic regions
plotProfile visualization computeMatrix output summary plot (“meta-profile”) visualize the average read coverages over a group of genomic regions
plotCoverage visualization 1 or more BAM 2 diagnostic plots visualize the average read coverages over sampled genomic positions
bamPEFragmentSize information 1 BAM text with paired-end fragment length obtain the average fragment length from paired ends
plotEnrichment visualization 1 or more BAM and 1 or more BED/GTF A diagnostic plot plots the fraction of alignments overlapping the given features
computeMatrixOperations miscellaneous 1 or more BAM and 1 or more BED/GTF A diagnostic plot plots the fraction of alignments overlapping the given features

##1.2 BAM 和bigWig文件處理工具

? 利用兩個(gè)或多個(gè)bam文件計(jì)算基因組區(qū)段reads覆蓋度厘肮;BED-file 指定基因組區(qū)域,bins模式可用于全基因組范圍分析大咱;產(chǎn)生的結(jié)果(.npz)可用于plotCorrelation進(jìn)行相關(guān)性分析和用于plotPCA進(jìn)行主成分分析溯捆。

$ deepTools2.0/bin/multiBamSummary bins \
 --bamfiles testFiles/*bam \ # using all BAM files in the folder
 --minMappingQuality 30 \
 --region 19 \ # limiting the binning of the genome to chromosome 19
 --labels H3K27me3 H3K4me1 H3K4me3 HeK9me3 input \
 -out readCounts.npz --outRawCounts readCounts.tab

 $ head readCounts.tab
 #'chr'     'start' 'end'   'H3K27me3'      'H3K4me1'       'H3K4me3'       'HeK9me3'       'input'
 19 10000   20000   0.0     0.0     0.0     0.0     0.0
 19 20000   30000   0.0     0.0     0.0     0.0     0.0
 19 30000   40000   0.0     0.0     0.0     0.0     0.0
 19 40000   50000   0.0     0.0     0.0     0.0     0.0
 19 50000   60000   0.0     0.0     0.0     0.0     0.0
 19 60000   70000   1.0     1.0     0.0     0.0     1.0
 19 70000   80000   0.0     1.0     7.0     0.0     1.0
 19 80000   90000   15.0    0.0     0.0     6.0     4.0
 19 90000   100000  73.0    7.0     4.0     16.0    5.0
  • multiBigwigSummary
    ? 與multiBamSummary相比煮仇,輸入文件格式是bigWig 刨仑。

  • correctGCBias
    ? 矯正GC-bias;

  • bamCoverage

    norm_IGVsnapshot_indFiles

    ? bamCoverage 利用測(cè)序數(shù)據(jù)比對(duì)結(jié)果轉(zhuǎn)換為基因組區(qū)域reads覆蓋度結(jié)果轻抱。可以自行設(shè)定覆蓋度計(jì)算的窗口大小(bin)夭问;bamCoverage 內(nèi)置了各種標(biāo)準(zhǔn)化方法:scaling factor, Reads Per Kilobase per Million mapped reads (RPKM), counts per million (CPM), bins per million mapped reads (BPM) and 1x depth (reads per genome coverage, RPGC).

Example : bamCoverage 用于ChIPseq分析

bamCoverage --bam a.bam -o a.SeqDepthNorm.bw \
    --binSize 10
    --normalizeUsing RPGC
    --effectiveGenomeSize 2150570000
    --ignoreForNormalization chrX
    --extendReads
    --outFileFormat bedgraph
  • bamCompare
    ? 兩個(gè)BAM 文件相比較陕见,計(jì)算二者之間窗口中的reads豐度比率灰粮。
usage:  bamCompare -b1 treatment.bam -b2 control.bam -o log2ratio.bw
  • bigwigCompare
  • computeMatrix
    ? 給基因組區(qū)段打分粘舟,產(chǎn)生的文件可用于plotHeatmapplotProfiles作圖霞揉;基因組區(qū)段可以是基因或其他區(qū)域,使用BED格式文件定義即可秽荞。

computeMatrix 有兩種不同的模式

computeMatrix two modes

  • reference-point(relative to a point): 計(jì)算某個(gè)點(diǎn)的信號(hào)豐度
  • scale-regions(over a set of regions): 把所有基因組區(qū)段縮放至同樣大小凌节,然后計(jì)算其信號(hào)豐度
    如下命令查看幫助:
$ computeMatrix scale-regions –help
$ computeMatrix scale-regions -S <biwig file(s)> -R <bed file> -b 1000
$ computeMatrix reference-point –help
$ computeMatrix reference-point -S <biwig file(s)> -R <bed file> -a 3000 -b 3000

Example 1:?jiǎn)蝹€(gè)輸入文件 (reference-point mode)

$ computeMatrix reference-point \ # choose the mode
       --referencePoint TSS \ # alternatives: TSS, TES, center
       -b 3000 -a 10000 \ # define the region you are interested in
       -R testFiles/genes.bed \
       -S testFiles/log2ratio_H3K4Me3_chr19.bw  \
       --skipZeros \
       -o matrix1_H3K4me3_l2r_TSS.gz \ # to be used with plotHeatmap and plotProfile
       --outFileSortedRegions regions1_H3K4me3_l2r_genes.bed

? 注:point-BED文件指定基因組區(qū)段的起始位置

Example 2:多個(gè)輸入文件 (scale-regions mode)

$ deepTools2.0/bin/computeMatrix scale-regions \
  -R genes_chr19_firstHalf.bed genes_chr19_secondHalf.bed \ # separate multiple files with spaces
  -S testFiles/log2ratio_*.bw  \ or use the wild card approach
  -b 3000 -a 3000 \
  --regionBodyLength 5000 \
  --skipZeros -o matrix2_multipleBW_l2r_twoGroups_scaled.gz \
  --outFileNameMatrix matrix2_multipleBW_l2r_twoGroups_scaled.tab \
  --outFileSortedRegions regions2_multipleBW_l2r_twoGroups_genes.bed
Note that the reported regions will have the same coordinates as the ones in 

##1.3 質(zhì)控工具

  • plotCorrelation
    ? 基于multiBamSummary 或multiBigwigSummary結(jié)果計(jì)算樣品間的相關(guān)性娱挨。并且還可以通過ScatterplotHeatmap進(jìn)行展示跷坝。

Example 1:Scatterplot

$ deepTools2.0/bin/plotCorrelation \
-in scores_per_transcript.npz \
--corMethod pearson --skipZeros \
--plotTitle "Pearson Correlation of Average Scores Per Transcript" \
--whatToPlot scatterplot \
-o scatterplot_PearsonCorr_bigwigScores.png   \
--outFileCorMatrix PearsonCorr_bigwigScores.tab
scatterplot_PearsonCorr_bigwigScores

Example 2:Heatmap

$ deepTools2.0/bin/plotCorrelation \
    -in readCounts.npz \
    --corMethod spearman --skipZeros \
    --plotTitle "Spearman Correlation of Read Counts" \
    --whatToPlot heatmap --colorMap RdYlBu --plotNumbers \
    -o heatmap_SpearmanCorr_readCounts.png   \
    --outFileCorMatrix SpearmanCorr_readCounts.tab
heatmap_SpearmanCorr_readCounts1
  • plotPCA
    ? 基于multiBamSummary 或multiBigwigSummary結(jié)果進(jìn)行主成分分析贴届,并作出基于兩個(gè)主成分的圖和前五個(gè)特征代表性的圖。

Example

$ deepTools2.0/bin/plotPCA -in readCounts.npz \
-o PCA_readCounts.png \
-T "PCA of read counts"
PCA_readCounts
  • plotFingerprint
    ? 對(duì)樣本比對(duì)結(jié)果reads累積情況進(jìn)行展示元潘。一定長(zhǎng)度窗口(bin)上reads數(shù)進(jìn)行計(jì)數(shù)牲距,然后排序,再依次累加畫圖皮服。input (能測(cè)到90%DNA片段)在基因組理論上是均勻分布龄广,隨著測(cè)序深度增加趨近于直線,實(shí)驗(yàn)組在排序越高的窗口處reads累積速度越快敲才,說明這些區(qū)域富集的越特異紧武。
    QC_fingerprint

Example

$ deepTools2.0/bin/plotFingerprint \
 -b testFiles/*bam \
--labels H3K27me3 H3K4me1 H3K4me3 H3K9me3 input \
--minMappingQuality 30 --skipZeros \
--region 19 --numberOfSamples 50000 \
-T "Fingerprints of different samples"  \
--plotFile fingerprints.png \
--outRawCounts fingerprints.tab
fingerprints1
  • bam PEFragmentSize
    ? 計(jì)算bam文件中雙端reads的fragment size長(zhǎng)度已添。
  • compute GCBias
    ? 計(jì)算GC-bias
  • plot Coverage
    ? 計(jì)算樣品測(cè)序深度畦幢。隨機(jī)抽取1 million bp 宇葱,計(jì)算reads數(shù),統(tǒng)計(jì)堿基覆蓋率和覆蓋次數(shù)雷逆。

##1.4 熱圖和總結(jié)圖

Example 1: 根據(jù)computeMatrix結(jié)果畫熱圖

# run compute matrix to collect the data needed for plotting
$ computeMatrix scale-regions -S H3K27Me3-input.bigWig \
                                 H3K4Me1-Input.bigWig  \
                                 H3K4Me3-Input.bigWig \
                              -R genes19.bed genesX.bed \
                              --beforeRegionStartLength 3000 \
                              --regionBodyLength 5000 \
                              --afterRegionStartLength 3000
                              --skipZeros -o matrix.mat.gz
$ plotHeatmap -m matrix.mat.gz \
      -out ExampleHeatmap1.png \
plot Heatmap

Example 2: plotHeatmap還可以進(jìn)行聚類分析

$ plotHeatmap -m matrix_two_groups.gz \
     -out ExampleHeatmap2.png \
     --colorMap RdBu \
     --whatToShow 'heatmap and colorbar' \
     --zMin -3 --zMax 3 \
     --kmeans 4  #聚類參數(shù)

[圖片上傳失敗...(image-d28547-1556115525034)]
其他參數(shù)

顏色自定義:--colorList 'black, yellow' 'white,blue' '#ffffff,orange,#000000'
去掉熱圖邊框:--boxAroundHeatmaps no
  • plotProfile
    根據(jù)computeMatrix結(jié)果畫圖。

Example 1: 根據(jù)樣本畫圖

# run compute matrix to collect the data needed for plotting
$ computeMatrix scale-regions -S H3K27Me3-input.bigWig \
                                 H3K4Me1-Input.bigWig  \
                                 H3K4Me3-Input.bigWig \
                              -R genes19.bed genesX.bed \
                              --beforeRegionStartLength 3000 \
                              --regionBodyLength 5000 \
                              --afterRegionStartLength 3000
                              --skipZeros -o matrix.mat.gz

$ plotProfile -m matrix.mat.gz \
              -out ExampleProfile1.png \
              --numPlotsPerRow 2 \
              --plotTitle "Test data profile"
Example Profile1

Example 2: 根據(jù)基因畫圖

$ plotProfile -m matrix.mat.gz \
     -out ExampleProfile2.png \
     --plotType=fill \ # add color between the x axis and the lines
     --perGroup \ # make one image per BED file instead of per bigWig file
     --colors red yellow blue \
     --plotTitle "Test data profile"
Example Profile2

Example 3: 聚類畫圖

$ plotProfile -m matrix.mat.gz \
      --perGroup \
      --kmeans 2 \
      -out ExampleProfile3.png
Example Profile3

Example 4: 畫熱圖

$ plotProfile -m matrix.mat.gz \
      --perGroup \
      --kmeans 2 \
      -plotType heatmap \
      -out ExampleProfile3.png

Example Profile4

plotEnrichment
? 統(tǒng)計(jì)樣本BED文件中peak或者GTF文件中feature 在chipseq結(jié)果中富集情況

Example

$ plotEnrichment -b Input.bam H3K4Me1.bam H3K4Me3.bam \
--BED up.bed down.bed \
--regionLabels "up regulated" "down regulated" \
-o enrichment.png
plot Enrichment

參考:

The tools of deeptools

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市云矫,隨后出現(xiàn)的幾起案子让禀,更是在濱河造成了極大的恐慌,老刑警劉巖腮敌,帶你破解...
    沈念sama閱讀 206,839評(píng)論 6 482
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件斗这,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡赁咙,警方通過查閱死者的電腦和手機(jī)彼水,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,543評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門拆魏,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事刑峡⊥幻危” “怎么了?”我有些...
    開封第一講書人閱讀 153,116評(píng)論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)畜吊。 經(jīng)常有香客問我,道長(zhǎng)捌年,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,371評(píng)論 1 279
  • 正文 為了忘掉前任,我火速辦了婚禮励堡,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘摊趾。我一直安慰自己漩绵,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,384評(píng)論 5 374
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著不同,像睡著了一般。 火紅的嫁衣襯著肌膚如雪百新。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,111評(píng)論 1 285
  • 那天,我揣著相機(jī)與錄音斟珊,去河邊找鬼雏节。 笑死钩乍,一個(gè)胖子當(dāng)著我的面吹牛变过,可吹牛的內(nèi)容都是我干的媚狰。 我是一名探鬼主播类嗤,決...
    沈念sama閱讀 38,416評(píng)論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼嗤形,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼笔咽!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起扶叉,我...
    開封第一講書人閱讀 37,053評(píng)論 0 259
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤垮刹,失蹤者是張志新(化名)和其女友劉穎酪劫,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體滩字,經(jīng)...
    沈念sama閱讀 43,558評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡漓藕,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,007評(píng)論 2 325
  • 正文 我和宋清朗相戀三年诀蓉,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了划滋。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片处坪。...
    茶點(diǎn)故事閱讀 38,117評(píng)論 1 334
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡部脚,死狀恐怖丧没,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情夺饲,我是刑警寧澤,帶...
    沈念sama閱讀 33,756評(píng)論 4 324
  • 正文 年R本政府宣布浩销,位于F島的核電站,受9級(jí)特大地震影響且警,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜杏头,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,324評(píng)論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望寓娩。 院中可真熱鬧,春花似錦、人聲如沸阱穗。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,315評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)倦淀。三九已至,卻和暖如春科展,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背琅攘。 一陣腳步聲響...
    開封第一講書人閱讀 31,539評(píng)論 1 262
  • 我被黑心中介騙來泰國(guó)打工坞琴, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人浙于。 一個(gè)月前我還...
    沈念sama閱讀 45,578評(píng)論 2 355
  • 正文 我出身青樓紊服,卻偏偏與公主長(zhǎng)得像欺嗤,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,877評(píng)論 2 345