<?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; HTseq</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/htseq/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>自学miRNA-seq分析第五讲~miRNA表达量获取</title>
		<link>http://www.bio-info-trainee.com/1712.html</link>
		<comments>http://www.bio-info-trainee.com/1712.html#comments</comments>
		<pubDate>Sat, 25 Jun 2016 09:34:46 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[HTseq]]></category>
		<category><![CDATA[miRNA-seq]]></category>
		<category><![CDATA[表达量]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1712</guid>
		<description><![CDATA[拿到比对后的sam/bam文件之后，这只能算是level2的数据，一般我们给他人 &#8230; <a href="http://www.bio-info-trainee.com/1712.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>拿到比对后的sam/bam文件之后，这只能算是level2的数据，一般我们给他人share我们的结果也是直接给表达矩阵的， miRNA分析跟mRNA分析类似，但是它的表达矩阵更好获取一点。如果是mRNA，我们一般会跟基因组来比较，而基因组就那24条参考染色体，想知道具体比对到了哪个基因，需要根据基因组注释文件来写程序提取表达量信息，现在比较流行的是htseq这个软件，我前面也写过教程如何安装和使用，这里就不啰嗦了。但是对于miRNA，因为我比对的就是那1881条前体miRNA序列，所以直接分析比对的sam/bam文件就可以知道每条参考miRNA序列的表达量了。 <span id="more-1712"></span></p>
<blockquote>
<div>## step6: counts the reads which mapping to each miRNA reference.</div>
<div></div>
<div>## we need to exclude unmapped as well as multiple-mapped  reads</div>
<div></div>
<div>## XS:i:&lt;n&gt; Alignment score for second-best alignment. Can be negative. Can be greater than 0 in --local mode</div>
<div>## NM:i:1   ## NM i Edit distance to the reference, including ambiguous bases but excluding clipping</div>
<div>#The following command exclude unmapped (-F 4) as well as multiple-mapped (grep -v “XS:”) reads</div>
<div>#samtools view -F 4 input.bam | grep -v "XS:" | wc -l</div>
<div></div>
<div>## 180466//1520320</div>
<div></div>
<div>##cat &gt;<a href="http://count.hairpin.sh/">count.hairpin.sh</a></div>
<div></div>
<div>ls *hairpin.sam  | while read id</div>
<div>do</div>
<div><strong>samtools view  -SF 4 $id |perl -alne '{$h{$F[2]}++}END{print "$_\t$h{$_}" foreach sort keys %h }'  &gt; ${id%%_*}.hairpin.counts</strong></div>
<div>done</div>
<div></div>
<div>## bash <a href="http://count.hairpin.sh/">count.hairpin.sh</a></div>
<div></div>
<div>##cat &gt;<a href="http://count.mature.sh/">count.mature.sh</a></div>
<div></div>
<div>ls *mature.sam  | while read id</div>
<div>do</div>
<div><strong>samtools view  -SF 4 $id |perl -alne '{$h{$F[2]}++}END{print "$_\t$h{$_}" foreach sort keys %h }'  &gt; ${id%%_*}.mature.counts</strong></div>
<div>done</div>
<div></div>
<div>## bash <a href="http://count.mature.sh/">count.mature.sh</a></div>
</blockquote>
<div>上面的代码，是我自己写的脚本来算表达量，非常简单，因为我没有考虑细节，直接想得到各个样本测序数据的表达量而已。如果是比对到了参考基因组，就要根据miRNA的gff注释文件用htseq等软件来计算表达量啦。</div>
<div>得到了表达量，就可以跟文献来做比较啦：</div>
<blockquote>
<div>### step7: compare the results with paper's</div>
<div>GSM1470353: control-CM, experiment1; Homo sapiens; miRNA-Seq   SRR1542714</div>
<div>GSM1470354: ET1-CM, experiment1; Homo sapiens; miRNA-Seq  SRR1542715</div>
<div>GSM1470355: control-CM, experiment2; Homo sapiens; miRNA-SeqSRR1542716</div>
<div>GSM1470356: ET1-CM, experiment2; Homo sapiens; miRNA-Seq SRR1542717</div>
<div>GSM1470357: control-CM, experiment3; Homo sapiens; miRNA-Seq SRR1542718</div>
<div>GSM1470358: ET1-CM, experiment3; Homo sapiens; miRNA-Seq SRR1542719</div>
<div>### 下面我用R语言来检验一下，我得到的分析结果跟文章发表的结果的区别。</div>
<div> <strong>a=read.table("bowtie_bam/SRR1542714.mature.counts")</strong></div>
<div><strong> b=read.table("paper_results/GSM1470353_iPS_010313_Unstim_known_miRNA_counts.txt")</strong></div>
<div> plot(log(tmp[,2]),log(tmp[,3]))</div>
<div> cor(tmp[,2],tmp[,3])</div>
<div><strong>##[1] 0.8413439</strong></div>
</blockquote>
<div>相关性还不错，总算没有分析错咯。</div>
<div>这个代码是我自己根据文章的理解写出的，因为我本身不擅长miRNA数据分析，所以在进行alignment的时候参数选择可能并不是那么友好，如果有高手能指正就最好了，可以直接打我电话告诉我，或者发邮箱给我，邮箱用户名是jmzeng1314，是163邮箱。</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1712.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转录组HTseq对基因表达量进行计数</title>
		<link>http://www.bio-info-trainee.com/244.html</link>
		<comments>http://www.bio-info-trainee.com/244.html#comments</comments>
		<pubDate>Mon, 16 Mar 2015 14:39:44 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[生信组学技术]]></category>
		<category><![CDATA[转录组软件]]></category>
		<category><![CDATA[HTseq]]></category>
		<category><![CDATA[差异基因]]></category>
		<category><![CDATA[计数]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=244</guid>
		<description><![CDATA[转录组HTseq对基因表达量进行计数 一：下载安装该软件 下载htseq这个py &#8230; <a href="http://www.bio-info-trainee.com/244.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><strong>转录组HTseq对基因表达量进行计数</strong></p>
<p><b>一：下载安装该软件</b></p>
<p>下载htseq这个python模块安装解压包，依赖于很多python的其它安装包及库，模块，我最讨厌python了，在有些电脑上特别难安装，而且服务器还有权限的问题。</p>
<p>解压进入该目录，输入 python setup.py   install  --user  记住，是- - 而不是—</p>
<p>这样只是把这个软件安装到自己的目录</p>
<p>安装完毕后，会出现这两个程序，在自己的python库里面，可以直接调用这两个程序的，我这里它们的路径是 .local/bin ，很奇怪的一个路径，我也是用find命令才找到的</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数451.png"><img class="alignnone size-full wp-image-245" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数451.png" alt="转录组HTseq对基因表达量进行计数451" width="301" height="44" /></a></p>
<p><span id="more-244"></span></p>
<p>我在这里主要讲解，在这里调用这个命令来进行操作，直接把它当做一个程序来使用，而不是仅仅当做是python里面的一个模块调用，不需要import HTseq。</p>
<p><b>二：准备数据</b></p>
<p><b>输入文件</b></p>
<p><b>输入为sam格式的文件，如果是paired-end数据必须按照reads名称排序（sort by name）。先用samtools先对bam文件（tophat2的输出结果为bam）排序，再转换为sam。</b></p>
<p><b>  命令：samtools sort -n file.bam #sort bam by name</b></p>
<p><b>        samtools view -h bamfile.bam&gt;samfile.sam</b></p>
<p><b>其实</b><b>可以是任意的sam文件，在这里我主要演示我自己跑tophat出来的bam文件转为的sam文件，就是三个RNA数据的结果</b></p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1002.png"><img class="alignnone size-full wp-image-246" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1002.png" alt="转录组HTseq对基因表达量进行计数1002" width="605" height="110" /></a><b><br />
</b></p>
<p><b>    这样得到的三个sam文件特别大，bam文件是sam的二进制文件才三五个G，到了sam格式就是十几二十个G了，其实完全没必要自己把它转为sam文件，因为htseq有个参数-f可以控制输入格式是bam文件</b><b>。</b></p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1315.png"><img class="alignnone size-full wp-image-247" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1315.png" alt="转录组HTseq对基因表达量进行计数1315" width="333" height="66" /></a></p>
<p><b>三：运行命令</b></p>
<p><b>官方的</b><b>Usage：htseq-count [options] &lt;sam_file&gt; &lt;gff_file&gt;</b></p>
<p><b>HTSeq的作者Simon Anders建议使用ENSEMBL的gtf文件。  但是如果用了ensembl的，那么之前tophat就应该用ensembl的gtf作为参考来比对</b></p>
<p><b>也可以使用</b><b>python -m HTSeq.scripts.count</b><b> </b><b>instead of htseq-count</b></p>
<p><b>我的命令是：</b></p>
<p><b> </b><b>/home/jmzeng/.local/bin/htseq-count case1.sam   /home/jmzeng/ref-database/hg19.gtf</b></p>
<p><b>但是</b><b>我还是喜欢批处理来运行</b><b>，一次性解决所有的bam文件计数问题</b></p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1852.png"><img class="alignnone size-full wp-image-248" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数1852.png" alt="转录组HTseq对基因表达量进行计数1852" width="628" height="70" /></a></p>
<p>出来得到的日志是这样的</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2063.png"><img class="alignnone size-full wp-image-249" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2063.png" alt="转录组HTseq对基因表达量进行计数2063" width="435" height="317" /></a></p>
<p>&nbsp;</p>
<p>约等待几个小时就OK啦</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2275.png"><img class="alignnone size-full wp-image-250" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2275.png" alt="转录组HTseq对基因表达量进行计数2275" width="299" height="142" /></a></p>
<p>&nbsp;</p>
<p><b> </b></p>
<p><b>四：输出文件解读</b></p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2484.png"><img class="alignnone size-full wp-image-251" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2484.png" alt="转录组HTseq对基因表达量进行计数2484" width="259" height="88" /></a></p>
<p>&nbsp;</p>
<p>共两万多个基因，每个基因一行，基因名加上count数</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2709.png"><img class="alignnone size-full wp-image-252" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2709.png" alt="转录组HTseq对基因表达量进行计数2709" width="203" height="45" /></a></p>
<p>可以head看一下里面的内容如下</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2924.png"><img class="alignnone size-full wp-image-253" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/转录组HTseq对基因表达量进行计数2924.png" alt="转录组HTseq对基因表达量进行计数2924" width="146" height="139" /></a></p>
<p>&nbsp;</p>
<p>tips; 1，你可以用--idattr transcript_id来指定程序计算转录本而不是基因，但是这样会导致共有转录本重合地方太多</p>
<p>参考：</p>
<p>安装<a href="http://pgfe.umassmed.edu/ou/archives/2549">http://pgfe.umassmed.edu/ou/archives/2549</a></p>
<p>操作htseq的方法<a href="http://www-huber.embl.de/users/anders/HTSeq/doc/tour.html">http://www-huber.embl.de/users/anders/HTSeq/doc/tour.html</a></p>
<p><a href="http://chenxindayangzhou.blog.163.com/blog/static/2809209220137234916786/">http://chenxindayangzhou.blog.163.com/blog/static/2809209220137234916786/</a></p>
<p>另外一个操作方法<a href="http://www-huber.embl.de/users/anders/HTSeq/doc/count.html">http://www-huber.embl.de/users/anders/HTSeq/doc/count.html</a></p>
<p><b> </b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/244.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
