这里是佳奥!表观调控的分析进入尾声,我们来看看ChIP-Seq分析也会使用的可视化操作吧。
1 单个.bed文件可视化
回到第十步的环境。
##根据gr生成.bed文件
lapply(1:7,function(i){
gr=ol$peaklist[[i]]
dat=as.data.frame(gr)[,1:3]
dat[,1]=gsub('chr','',dat[,1])##去除chr开头
write.table(dat,sep = '\t',##'\t',不是空格隔开
col.names = F,file = paste0('G',i,'_in.bed')##生产G1-G7in
,quote = F,row.names = F)
})
ol <- findOverlapsOfPeaks(tmp1$peaklist$fs..1..,
tmp2$peaklist$fs..2..,
tmp3$peaklist$fs..3..)
png('3_factors_overlapVenn_not_domain.png')
makeVennDiagram(ol,
NameOfPeaks=str_split(bedFiles,'_',simplify = T)[,1],
TxDb=txdb)
dev.off()
lapply(1:7,function(i){
gr=ol$peaklist[[i]]
dat=as.data.frame(gr)[,1:3]
dat[,1]=gsub('chr','',dat[,1])##去除chr开头
write.table(dat,sep = '\t',##'\t',不是空格隔开
col.names = F,file = paste0('G',i,'_out.bed')##生产G1-G7out
,quote = F,row.names = F)
})
获得了17个.bed文件,用deeptools画图。
进入bw目录:
computeMatrix reference-point -- referencePoint TSS -p 4 \
-b 10000 -a 10000 \ ##上下10kb
-R G1_in.bed \ ##刚刚生成的14个.bed,要去除chr开头
-S Spps_TW.bw \
--skipZeros -0 G1_in_matrix1_test_TSS.gz \
--outFileSortedRegions G1_in_regions1_test_genes.bed
生成G1_in_matrix1_test_TSS.gz,进行可视化:
plotHeatmap -m matrix1_test_TSS.gz -out G1_in_Heatmap.png
plotHeatmap -m matrix1_test_TSS.gz -out test_Heatmap.pdf --plotFileFormat pdf --dpi 720
plotProfile -m matrix1_test_TSS.gz -out test_Profile.png
plotProfile -m matrix1_test_TSS.gz -out test_Profile.pdf --plotFileFormat pdf --perGroup --d
更换对象就换比如G4_in.bed
另外,需要把.bam文件的内容一一对应上:用bamCompare
##读取.bam文件,匹配输出.bw,会比较耗时
bamCompare -b1 ../Spps_WT.merge.bam -b2 ../Input_WT.merge.bam \
--operation log2 -of bigwig -o Spps_WT.log2.bw -p 4
##生成新热图
computeMatrix reference-point --referencePoint center -p 4 \
-b 5000 -a 5000 \
-R G4_in.bed \
-S Spps_WT.log2.bw \
--skipZeros -o G4_in_matrix1_log2_TSS.gz \
--outFileSortedRegions G4_in_regions1_log2_genes.bed
plotHeatmap -m matrix1_log2_TSS.gz -out G4_in_log2_Heatmap.png
2 批量.bed文件可视化
ls ../*_WT.merge.bam | while read id;
do
bamCompare -b1 $id -b2 ../Input_WT.merge.bam \
--operation log2 -of bigwig -o $(basename $id "_WT.merge.bam" ).log2.bw -p 4
done
##获得了全部的log2.bw文件
computeMatrix reference-point --referencePoint center -p 4 \
-b 5000 -a 5000 \
-R G{1..7}_in.bed \
-S *.log2.bw \
--skipZeros -o G4_in_matrix1_log2_TSS.gz \
--outFileSortedRegions all_in_regions1_log2_genes.bed
plotHeatmap -m all_matrix1_log2_TSS.gz -out all_in_log2_Heatmap.png
第十一步,bw-heatmap。(上述代码整理)
computeMatrix reference-point --referencePoint TSS -p 4 \
-b 5000 -a 5000 \
-R G4_in.bed \
-S Spps_WT.bw \
--skipZeros -o G4_in_matrix1_test_TSS.gz \
--outFileSortedRegions G4_in_regions1_test_genes.bed
plotHeatmap -m G4_in_matrix1_test_TSS.gz -out G4_in_Heatmap.png
bamCompare -b1 ../Spps_WT.merge.bam -b2 ../Input_WT.merge.bam \
--operation log2 -of bigwig -o Spps_WT.log2.bw -p 4
computeMatrix reference-point --referencePoint center -p 4 \
-b 5000 -a 5000 \
-R G4_in.bed \
-S Spps_WT.log2.bw \
--skipZeros -o G4_in_matrix1_log2_TSS.gz \
--outFileSortedRegions G4_in_regions1_log2_genes.bed
plotHeatmap -m G4_in_matrix1_log2_TSS.gz -out G4_in_log2_Heatmap.png
##批量代码
ls ../*_WT.merge.bam |while read id;
do
echo bamCompare -b1 $id -b2 ../Input_WT.merge.bam \
--operation log2 -of bigwig -o $(basename $id "_WT.merge.bam" ).log2.bw -p 4
done
echo computeMatrix reference-point --referencePoint center -p 4 \
-b 5000 -a 5000 \
-R G{1..7}_in.bed \
-S *_WT.log2.bw \
--skipZeros -o G4_in_matrix1_log2_TSS.gz \
--outFileSortedRegions all_in_regions1_log2_genes.bed
plotHeatmap -m all_in_matrix1_log2_TSS.gz -out all_in_log2_Heatmap.png
QQ截图20220825203126.png
G4_in_Heatmap和G4_in_log2_Heatmap
下一篇我们最后处理一下RNA-Seq处理的数据。
我们下一篇再见!
网友评论