ggplot集锦

使用deeptools画热图和平均图

2020-06-10  本文已影响0人  想把生信学好的胡小慧

ATAC后续可视化生成的热图和平均图可以用R包进行绘制,我这里选的是deeptools里的bamCoverage和computeMatrix功能

deeptools安装是用conda一键式安装,我直接安在base环境下,不需要再另外配置环境

看一下deeptools的手册,可以更快帮助自己了解deeptools的参数

先将之前bowtie比对的bam文件进行归一化,转为bigwig文件

需要用samtools先建索引:ls *.rmdum.bam |xargs -i samtools index {}

bamCoverage命令转bw文件,-b是输入文件,-o是是输出文件

bamCoverage -b /home/huilin_hu/Arabidopsis/output/5.clean/57.bowtie.clean.sort.exc.sort.reheader.rmdup.bam -o 57.bw

根据computeMatrix画热图

computeMatrix 有两种不同的模式

reference-point(relative to a point): 计算某个点的信号丰度

scale-regions(over a set of regions): 把所有基因组区段缩放至同样大小,然后计算其信号丰度

我这里是输入多个样本

-b 10000是指上游区域10000bp -a是指下游区域10000bp

-R是拟南芥基因组注释文件中提取的bed文件,共三列,染色体,起始坐标和终止坐标

-S是bamCoverage转的bw文件

会输出两个文件:matrix1_test_TSS.gz  regions1_test_genes.bed 自己命名就好,这两个文件用于后期画热图和平均图

computeMatrix reference-point --referencePoint TSS -p 15 \

-b 10000 -a 10000    \

-R /home/huilin_hu/Arabidopsis/output/5.clean/genes.bed \

-S /home/huilin_hu/Arabidopsis/output/5.clean/*.bw  \

--skipZeros  -o matrix1_test_TSS.gz  \

--outFileSortedRegions regions1_test_genes.bed

使用上述命令的时候运行的比较慢

plotHeatmap -m matrix1_test_TSS.gz -out 57_Heatmap_1K.png

我这里会报这个错,但是也出图了,下方所示,这个错误的网址目前我没打开

Bad key "text.kerning_factor" on line 4 in

/home/huilin_hu/miniconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle.

You probably need to get an updated matplotlibrc file from

https://github.com/matplotlib/matplotlib/blob/v3.1.3/matplotlibrc.template

or from the matplotlib source distribution

平均图:plotProfile -m matrix1_test_TSS.gz -out 57_test.png

上一篇 下一篇

猜你喜欢

热点阅读