Deeptools使用

2022-05-07  本文已影响0人  余绕

安装

conda install -c bioconda deeptools
pip install deeptools

计算覆盖度,生成npz文件

/bin/anaconda3/bin/multiBamSummary bins --bamfiles Mutant-1.sort.bam Mutant-2.sort.bam Wildtype-1.sort.bam Wildtype-2.sort.bam -o results.npz

相关性散点图

/bin/anaconda3/bin/plotCorrelation -in results.npz --corMethod pearson --skipZeros --plotTitle "Pearson Correlation" --whatToPlot scatterplot -o scatterplot_PearsonCorr_bigwigScores.png --outFileCorMatrix PearsonCorr_bigwigScores.tab
image.png

相关性热图

/bin/anaconda3/bin/plotCorrelation -in results.npz --corMethod spearman --skipZeros --plotTitle "Spearman Correlation" --whatToPlot heatmap --colorMap RdYlBu --plotNumbers -o heatmap_SpearmanCorr_readCounts.png --outFileCorMatrix SpearmanCorr_readCounts.tab

PCA图

/bin/anaconda3/bin/plotPCA -in results.npz -o PCA_readCounts.png -T "PCA of read counts"
image.png

指纹图

/bin/anaconda3/bin/plotFingerprint -b  Mutant-1.sort.bam Mutant-2.sort.bam Wildtype-1.sort.bam Wildtype-2.sort.bam --labels Mutant-1 Mutant-2 Wildtype-1 Wildtype-2 --minMappingQuality 30 --skipZeros --region 1 --numberOfSamples 50000 -T "Fingerprints of different samples"  --plotFile fingerprints.png --outRawCounts fingerprints.tab
image.png

把bam文件转化为bw文件,标准化产生覆盖轨迹

/bin/anaconda3/bin/bamCoverage -b Mutant-1.sort.bam -o Mutant-1.bw
/bin/anaconda3/bin/bamCoverage -b Mutant-2.sort.bam -o Mutant-2.bw
/bin/anaconda3/bin/bamCoverage -b Wildtype-1.sort.bam -o Wildtype-1.bw
/bin/anaconda3/bin/bamCoverage -b Wildtype-2.sort.bam -o Wildtype-2.bw

比较bam文件产生比例 (可以用这个去除实验组中input的peaks(既背景peaks),对照设成input既可)

/bin/anaconda3/bin/bamCompare -b1 Mutant-1.sort.bam -b2 Wildtype-1.sort.bam -o log2ratio1.bw
/bin/anaconda3/bin/bamCompare -b1 Mutant-2.sort.bam -b2 Wildtype-2.sort.bam -o log2ratio2.bw

reference-point模式(单文件)

/bin/anaconda3/bin/computeMatrix reference-point --referencePoint TSS -b 3000 -a 10000 -R genome.bed -S log2ratio1.bw --skipZeros -o log2ratio1.gz --outFileSortedRegions log2ratio1_genes.bed

scale-regions模式(多文件)

#/bin/anaconda3/bin/computeMatrix scale-regions -S Mutant-1.bw Mutant-2.bw Wildtype-1.bw  Wildtype-2.bw -R genome.bed --beforeRegionStartLength 3000 --regionBodyLength 5000 --afterRegionStartLength 3000 --skipZeros -o matrix.mat.gz
/bin/anaconda3/bin/computeMatrix scale-regions -R genome.bed -S log2ratio*.bw -b 3000 -a 3000 --regionBodyLength 5000 --skipZeros -o twoGroups_scaled.gz --outFileNameMatrix twoGroups_scaled.tab --outFileSortedRegions twoGroups_genes.bed

过滤bam文件

/bin/anaconda3/bin/alignmentSieve.py -b Mutant-1.sort.bam -o Mutant-1.sort.filtered.bam --minMappingQuality 10 --filterMetrics log.txt

绘制热图

/bin/anaconda3/bin/plotHeatmap -m plotHeatmapMatrix.gz -out Heatmap1.png  #默认颜色
/bin/anaconda3/bin/plotHeatmap -m plotHeatmapMatrix.gz -out Heatmap2.png --colorMap RdBu --whatToShow 'heatmap and colorbar' --zMin -3 --zMax 3 --kmeans 4  #设置颜色,并分组比较,同时手动设置scale bar(zMin,zMax)。
/bin/anaconda3/bin/plotHeatmap -m plotHeatmapMatrix.gz -out ExampleHeatmap3.png --colorList 'black, yellow' 'white,blue' '#ffffff,orange,#000000'  --whatToShow 'heatmap and colorbar' --zMin -2 -2 0 --zMax 2 2 3 --kmeans 4 --dpi 100   #手动设置颜色
/bin/anaconda3/bin/plotHeatmap -m plotHeatmapMatrix.gz -out ExampleHeatmap4.png --colorMap Oranges_r Blues_r Greens --whatToShow 'heatmap and colorbar' --zMin -4 -4 0 --zMax 0 0 5 --kmeans 4 --dpi 100 --boxAroundHeatmaps no    #设置颜色,并分组比较,同时手动设置scale bar(zMin,zMax),并且去掉heatmap的外框。
image.png

绘制Coverage

/bin/anaconda3/bin/plotCoverage -b Mutant-1.sort.bam Mutant-2.sort.bam Wildtype-1.sort.bam Wildtype-2.sort.bam --plotFile example_coverage -n 1000000 --plotTitle "example_coverage" --outRawCounts coverage.tab --ignoreDuplicates --minMappingQuality 10 --region 1

绘制Profile(需要的数据由前面的computer matix 产生。

/bin/anaconda3/bin/plotProfile -m plotHeatmapMatrix.gz -out Profile.png --numPlotsPerRow 2 --plotTitle "Data profile"
image.png

多个plots一起绘制Profile

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"
image.png

参考:http://keyandaydayup-pc.duanshu.com/course/class/af36b69343214d97a2e854f2e68b990a/1600322

上一篇下一篇

猜你喜欢

热点阅读