<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生信菜鸟团 &#187; 热图</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/%e7%83%ad%e5%9b%be/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bio-info-trainee.com</link>
	<description>欢迎去论坛biotrainee.com留言参与讨论，或者关注同名微信公众号biotrainee</description>
	<lastBuildDate>Sat, 28 Jun 2025 14:30:13 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.33</generator>
	<item>
		<title>deeptools辅助CHIP-seq数据分析-可视化</title>
		<link>http://www.bio-info-trainee.com/2136.html</link>
		<comments>http://www.bio-info-trainee.com/2136.html#comments</comments>
		<pubDate>Thu, 15 Dec 2016 11:20:00 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[CHIP-seq]]></category>
		<category><![CDATA[CHIP-seq数据]]></category>
		<category><![CDATA[deeptools]]></category>
		<category><![CDATA[热图]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=2136</guid>
		<description><![CDATA[有很多读者来信，CHIP-seq数据比对后的bam文件如果根据基因组的所有基因来 &#8230; <a href="http://www.bio-info-trainee.com/2136.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div>有很多读者来信，CHIP-seq数据比对后的bam文件如果根据基因组的所有基因来画热图，profile图呢？</div>
<p><span id="more-2136"></span></p>
<div><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/13.png"><img class="alignnone size-full wp-image-2137" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/13.png" alt="1" width="684" height="831" /></a></div>
<div>这里隆重推荐deeptools这个软件：</div>
<div></div>
<div><span style="color: #ff0000;"><strong>第一个功能，把bam文件转换为bw格式文件：</strong></span></div>
<div>bamCoverage -b tmp.sorted.bam -o tmp.bw</div>
<div>里面有一个参数非常重要，就是--extendReads 在 macs软件里面也有，macs2 pileup --extsize 200 ，就算是你的reads长度可能不一致，是否需要把它们补齐成一个统一的长度，因为我们只要是测到了reads，就代表那里是有signal的，只是因为我们的测序仪限制，测到的长度不够，或者质量不好，我们QC的时候，把前后碱基给trim掉了。还可以安装基因组的有效大小来对测序深度进行normlization。</div>
<div></div>
<div><span style="color: #ff0000;"><strong>第二个功能，画所有基因附近的信号热图，</strong></span>tools: <a href="http://deeptools.readthedocs.io/en/latest/content/tools/computeMatrix.html">computeMatrix</a>, then <a href="http://deeptools.readthedocs.io/en/latest/content/tools/plotHeatmap.html">plotHeatmap</a></div>
<div><a href="http://deeptools.readthedocs.io/en/latest/content/example_step_by_step.html#heatmaps-and-summary-plots">http://deeptools.readthedocs.io/en/latest/content/example_step_by_step.html#heatmaps-and-summary-plots</a></div>
<div>需要自行下载合适的基因坐标记录文件，BED格式的。把上面两个命令结合起来即可，代码和图形实例如下:</div>
<div><img src="file:///C:/Users/jimmy1314/AppData/Local/YNote/data/jmzeng1314@163.com/31606fda35e24c23a77b611d4270ff9e/clipboard.png" alt="" data-media-type="image" data-attr-org-src-id="F1E18CB636DE4CCEA0318F2F99E2CB43" /></div>
<div><span style="color: #ff0000;"><strong>第3个功能，画profile的图！</strong></span></div>
<div>use <a href="http://deeptools.readthedocs.io/en/latest/content/tools/computeMatrix.html">computeMatrix</a> for all of the signal files (bigWig format) at once</div>
<div>use <a href="http://deeptools.readthedocs.io/en/latest/content/tools/plotProfile.html">plotProfile</a> on the resulting file</div>
<div></div>
<div>还有很多小功能，欢迎大家去探索，这个软件是python软件，安装非常简单：</div>
<blockquote>
<div>## Download and install deepTools</div>
<div>## https://github.com/fidelram/deepTools</div>
<div>## http://deeptools.readthedocs.io/en/latest/content/example_usage.html</div>
<div>pip install pyBigWig --user</div>
<div></div>
<div>cd ~/biosoft</div>
<div>mkdir deepTools &amp;&amp; cd deepTools</div>
<div>git clone https://github.com/fidelram/deepTools ## 130M,</div>
<div>cd deepTools</div>
<div>python setup.py install --user</div>
<div>## 17 tools in ~/.local/bin/</div>
<div>~/.local/bin/deeptools</div>
</blockquote>
<div>安装之后，很多小工具都放到了~/.local/bin/目录：</div>
<div><img src="file:///C:/Users/jimmy1314/AppData/Local/YNote/data/jmzeng1314@163.com/8f0bcadfe7cc4740aa372b33bf2b72b7/clipboard.png" alt="" data-media-type="image" data-attr-org-src-id="1D2CF21DB0C346B9928BBACA7E20859B" /><img class="alignnone size-full wp-image-2138" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/12/21.png" alt="2" width="315" height="393" /></div>
<div>如果你有大批量的bam文件，需要批量做，用下面的脚本啦：</div>
<blockquote>
<div>ls ../bamFiles/*bam |while read id</div>
<div>do</div>
<div>file=$(basename $id )</div>
<div>sample=${file%%.*}</div>
<div>echo $sample</div>
<div>bamCoverage -b $id -o $sample.bw</div>
<div>computeMatrix reference-point --referencePoint TSS -b 10000 -a 10000 -R ~/annotation/CHIPseq/mm10/ucsc.refseq.bed -S $sample.bw --skipZeros -o matrix1_${sample}_TSS.gz --outFileSortedRegions regions1_${sample}_genes.bed</div>
<div>plotHeatmap -m matrix1_${sample}_TSS.gz -out ${sample}.png</div>
<div>done</div>
</blockquote>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/2136.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>热图最佳实践-pheatmap</title>
		<link>http://www.bio-info-trainee.com/1980.html</link>
		<comments>http://www.bio-info-trainee.com/1980.html#comments</comments>
		<pubDate>Thu, 03 Nov 2016 02:30:21 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[基础软件]]></category>
		<category><![CDATA[pheatmap]]></category>
		<category><![CDATA[热图]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1980</guid>
		<description><![CDATA[用pheatmap来绘图首先要安装这个包，它就一个功能，画出热图即可，号称是pr &#8230; <a href="http://www.bio-info-trainee.com/1980.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;">用pheatmap来绘图首先要安装这个包，它就一个功能，画出热图即可，号称是pretty heatmap，的确比其它的好用很多。我以前写过《<strong><span style="color: #ff0000;">一步一步学习heatmap.2</span></strong>》的教程，很简单的那种，所以就没有公布在博客上面，结果发现很多其它博客居然能先我一步发出。其实包括本次的pheatmap指南，都没什么好发，的在R里面也是傻瓜式出图，无法就是自己熟练一下参数而已，又不是开发一个包，没什么技术含量。我这里单独提一下pheatmap是因为它的确非常好用，将会是我画热图的不二之选。比如下面这个，是我最喜欢的：<span id="more-1980"></span></p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/11/pheatmap-best-practise.png"><img class=" size-full wp-image-1981 aligncenter" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/11/pheatmap-best-practise.png" alt="pheatmap-best-practise" width="651" height="541" /></a></p>
<p>&nbsp;</p>
<p>里面该有的信息一应俱全了，包括基因可以分成上下调来显色，基因和样本都可以单独聚类，单独排序，样本也可以具体再分组。热图也可以调整配色方案，单元格的宽度和高度都可以自由调整。把它说明书的代码一句句运行一遍就明白了：<a href="ftp://cran.r-project.org/pub/R/web/packages/pheatmap/pheatmap.pdf" target="_blank">ftp://cran.r-project.org/pub/R/web/packages/pheatmap/pheatmap.pdf</a></p>
<blockquote><p>代码如下：</p>
<p>## PS：我代码复制到博客就中英文标点被弄混了，请不要直接复制我的点，一行行点敲到R里面</p>
<p>## ftp://cran.r-project.org/pub/R/web/packages/pheatmap/pheatmap.pdf<br />
# Create test matrix<br />
## Just replace the test matrix with your own data.<br />
test = matrix(rnorm(200), 20, 10)<br />
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3<br />
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2<br />
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4<br />
colnames(test) = paste("Test", 1:10, sep = "")<br />
rownames(test) = paste("Gene", 1:20, sep = "")<br />
# Draw heatmaps<br />
pheatmap(test)<br />
pheatmap(test, kmeans_k = 2)<br />
pheatmap(test, scale = "row", clustering_distance_rows = "correlation")<br />
pheatmap(test, color = colorRampPalette(c("navy", "white", "firebrick3"))(50) )<br />
pheatmap(test, cluster_row = FALSE)<br />
pheatmap(test, legend = FALSE)<br />
# Show text within cells<br />
pheatmap(test, display_numbers = TRUE)<br />
pheatmap(test, display_numbers = TRUE, number_format = "\%.1e")<br />
pheatmap(test, display_numbers = matrix(ifelse(test &gt; 5, "*", ""), nrow(test)))<br />
pheatmap(test, cluster_row = FALSE, legend_breaks = -1:4, legend_labels = c("0",<br />
"1e-4", "1e-3", "1e-2", "1e-1", "1"))<br />
# Fix cell sizes and save to file with correct size<br />
pheatmap(test, cellwidth = 15, cellheight = 12, main = "Example heatmap")<br />
pheatmap(test, cellwidth = 15, cellheight = 12, fontsize = 8, filename = "test.pdf")<br />
# Generate annotations for rows and columns<br />
annotation_col = data.frame(<br />
CellType = factor(rep(c("CT1", "CT2"), 5)),<br />
Time = 1:5<br />
)<br />
rownames(annotation_col) = paste("Test", 1:10, sep = "")<br />
annotation_row = data.frame(<br />
GeneClass = factor(rep(c("Path1", "Path2", "Path3"), c(10, 4, 6)))<br />
)<br />
rownames(annotation_row) = paste("Gene", 1:20, sep = "")<br />
# Display row and color annotations<br />
pheatmap(test, annotation_col = annotation_col)<br />
pheatmap(test, annotation_col = annotation_col, annotation_legend = FALSE)<br />
pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row)<br />
# Specify colors<br />
ann_colors = list(<br />
Time = c("white", "firebrick"),<br />
CellType = c(CT1 = "#1B9E77", CT2 = "#D95F02"),<br />
GeneClass = c(Path1 = "#7570B3", Path2 = "#E7298A", Path3 = "#66A61E")<br />
)<br />
pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors, main = "Title")<br />
pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row,<br />
annotation_colors = ann_colors)<br />
pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors[2])<br />
# Gaps in heatmaps<br />
pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14))<br />
pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14),<br />
cutree_col = 2)<br />
# Show custom strings as row/col names<br />
labels_row = c("", "", "", "", "", "", "", "", "", "", "", "", "", "", "",<br />
"", "", "Il10", "Il15", "Il1b")<br />
pheatmap(test, annotation_col = annotation_col, labels_row = labels_row)<br />
# Specifying clustering from distance matrix<br />
drows = dist(test, method = "minkowski")<br />
dcols = dist(t(test), method = "minkowski")<br />
pheatmap(test, clustering_distance_rows = drows, clustering_distance_cols = dcols)<br />
# Modify ordering of the clusters using clustering callback option<br />
callback = function(hc, mat){<br />
sv = svd(t(mat))$v[,1]<br />
dend = reorder(as.dendrogram(hc), wts = sv)<br />
as.hclust(dend)<br />
}<br />
pheatmap(test, clustering_callback = callback)<br />
## Not run:<br />
# Same using dendsort package<br />
library(dendsort)<br />
callback = function(hc, ...){dendsort(hc)}<br />
pheatmap(test, clustering_callback = callback)<br />
## End(Not run)</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1980.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
