<?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/%e8%ae%a1%e6%95%b0/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>RNA-seq流程对基因和转录本的表达量的计算</title>
		<link>http://www.bio-info-trainee.com/755.html</link>
		<comments>http://www.bio-info-trainee.com/755.html#comments</comments>
		<pubDate>Thu, 21 May 2015 07:36:24 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[转录组软件]]></category>
		<category><![CDATA[差异]]></category>
		<category><![CDATA[计数]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=755</guid>
		<description><![CDATA[bedtools multicov和htseq-count都可以用来对基因和转录 &#8230; <a href="http://www.bio-info-trainee.com/755.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<h3></h3>
<p>bedtools multicov和htseq-count都可以用来对基因和转录本的表达量的计算！！！</p>
<p>我们总共有四个样本，已经比对到小鼠的mm9基因组上面了，数据大小如下</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算111.png"><img class="alignnone size-full wp-image-756" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算111.png" alt="RNA-seq流程对基因和转录本的表达量的计算111" width="448" height="189" /></a></p>
<p>然后对基因和转录本计数需要一些额外的信息，即各个基因及转录本的位置信息，gtf文件需要在UCSC等各大数据库下载</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算170.png"><img class="alignnone size-full wp-image-757" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算170.png" alt="RNA-seq流程对基因和转录本的表达量的计算170" width="554" height="369" /></a></p>
<p>然后我们制作一个config文件配置我们的数据地址</p>
<p>cat sample_bam.config 可以看到文件内容如下</p>
<p>/data/mouse/ptan/740WT1.bam</p>
<p>/data/mouse/ptan/741WT2.bam</p>
<p>/data/mouse/ptan/742KO1.bam</p>
<p>/data/mouse/ptan/743KO2.bam</p>
<p>几个批处理文件名及内容分别如下</p>
<p>bedtools_multicov.sh  bedtools_multicov_transcript.sh  htseq.sh  htseq_transcript.sh</p>
<p>&nbsp;</p>
<p>while read id</p>
<p>do</p>
<p>echo $id</p>
<p>new=`echo $id |cut -d"/" -f 5`</p>
<p>echo $new</p>
<p>bedtools multicov -bams $id -bed /data/mouse/mouse_mm9_gene.bed  &gt; $new.gene.bedtools_multicov.count</p>
<p>done &lt;$1</p>
<p>&nbsp;</p>
<p>while read id</p>
<p>do</p>
<p>echo $id</p>
<p>new=`echo $id |cut -d"/" -f 5`</p>
<p>echo $new</p>
<p>bedtools multicov -bams $id -bed /data/mouse/mouse_mm9_transcript.bed  &gt; $new.transcript.bedtools_multicov.count</p>
<p>done &lt;$1</p>
<p>&nbsp;</p>
<p>while read id</p>
<p>do</p>
<p>echo $id</p>
<p>new=`echo $id |cut -d"/" -f 5`</p>
<p>htseq-count -f bam $id /data/mouse/Mus_musculus.NCBIM37.67.gtf.chr  &gt; $new.gene.htseq.count</p>
<p>done &lt;$1</p>
<p>&nbsp;</p>
<p>while read id</p>
<p>do</p>
<p>echo $id</p>
<p>new=`echo $id |cut -d"/" -f 5`</p>
<p>htseq-count -f bam --idattr transcript_id $id /data/mouse/Mus_musculus.NCBIM37.67.gtf.chr  &gt; $new.transcript.htseq.count</p>
<p>done &lt;$1</p>
<p>&nbsp;</p>
<p>批量运行这些程序后就能对它们分别分情况进行计数，也能比较这两种计数方法的区别！</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算1201.png"><img class="alignnone size-full wp-image-758" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算1201.png" alt="RNA-seq流程对基因和转录本的表达量的计算1201" width="553" height="246" /></a></p>
<p>&nbsp;</p>
<p>可以看出区别还是很大的！！！</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算1219.png"><img class="alignnone size-full wp-image-759" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/05/RNA-seq流程对基因和转录本的表达量的计算1219.png" alt="RNA-seq流程对基因和转录本的表达量的计算1219" width="553" height="253" /></a></p>
<p>我肯定没搞懂它们的原理，这完全就不一样，已经不是区别的问题了！！！</p>
<p>对于每个个体输出的计数文件，接下来就可以用DESeq等包来进行差异基因分析啦！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/755.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>
