<?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; fastqc</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/fastqc/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>自学CHIP-seq分析第四讲~必要软件安装以及文章结果下载</title>
		<link>http://www.bio-info-trainee.com/1740.html</link>
		<comments>http://www.bio-info-trainee.com/1740.html#comments</comments>
		<pubDate>Tue, 05 Jul 2016 00:34:53 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[tutorial]]></category>
		<category><![CDATA[CHIP-seq]]></category>
		<category><![CDATA[fastqc]]></category>
		<category><![CDATA[软件安装]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1740</guid>
		<description><![CDATA[博文的顺序有点乱，因为怕读到前面的公共测序数据下载这篇文章的朋友搞不清楚，我如何 &#8230; <a href="http://www.bio-info-trainee.com/1740.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>博文的顺序有点乱，因为怕读到前面的公共测序数据下载这篇文章的朋友搞不清楚，我如何调用各种软件的，所以我这里强势插入一篇博客来描述这件事，当然也只是略过，我所有的软件理论上都是安装在我的home目录下的biosoft文件夹，所以你看到我一般安装程序都是:</p>
<p>cd ~/biosoft<br />
mkdir macs2 &amp;&amp; cd macs2 ##指定的软件安装在指定文件夹里面<span id="more-1740"></span></p>
<p>这只是我个人的安装习惯，因为我不是root，所以不能在linux系统下做太多事，我这里贴出我所有的软件安装代码：</p>
<blockquote><p>## pre-step: download <span style="color: #ff0000;">sratoolkit /fastx_toolkit_0.0.13/fastqc/bowtie2/bwa/MACS2/HOMER/QuEST/mm9/hg19/bedtools</span><br />
## http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software<br />
## http://www.ncbi.nlm.nih.gov/books/NBK158900/</p>
<p>## Download and install sratoolkit<br />
cd ~/biosoft<br />
mkdir sratoolkit &amp;&amp; cd sratoolkit<br />
wget http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.6.3/sratoolkit.2.6.3-centos_linux64.tar.gz<br />
##<br />
## Length: 63453761 (61M) [application/x-gzip]<br />
## Saving to: "sratoolkit.2.6.3-centos_linux64.tar.gz"<br />
tar zxvf sratoolkit.2.6.3-centos_linux64.tar.gz</p>
<p>## Download and install bedtools<br />
cd ~/biosoft<br />
mkdir bedtools &amp;&amp; cd bedtools<br />
wget https://github.com/arq5x/bedtools2/releases/download/v2.25.0/bedtools-2.25.0.tar.gz<br />
## Length: 19581105 (19M) [application/octet-stream]<br />
tar -zxvf bedtools-2.25.0.tar.gz<br />
cd bedtools2<br />
make</p>
<p>## Download and install PeakRanger<br />
cd ~/biosoft<br />
mkdir PeakRanger &amp;&amp; cd PeakRanger<br />
wget https://sourceforge.net/projects/ranger/files/PeakRanger-1.18-Linux-x86_64.zip/<br />
## Length: 1517587 (1.4M) [application/octet-stream]<br />
unzip PeakRanger-1.18-Linux-x86_64.zip<br />
~/biosoft/PeakRanger/bin/peakranger -h</p>
<p>## Download and install bowtie<br />
cd ~/biosoft<br />
mkdir bowtie &amp;&amp; cd bowtie<br />
wget https://sourceforge.net/projects/bowtie-bio/files/bowtie2/2.2.9/bowtie2-2.2.9-linux-x86_64.zip/download<br />
#Length: 27073243 (26M) [application/octet-stream]<br />
#Saving to: "download" ## I made a mistake here for downloading the bowtie2<br />
mv download bowtie2-2.2.9-linux-x86_64.zip<br />
unzip bowtie2-2.2.9-linux-x86_64.zip</p>
<p>mkdir -p ~/biosoft/bowtie/hg19_index<br />
cd ~/biosoft/bowtie/hg19_index</p>
<p># download hg19 chromosome fasta files<br />
wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/chromFa.tar.gz<br />
# unzip and concatenate chromosome and contig fasta files<br />
tar zvfx chromFa.tar.gz<br />
cat *.fa &gt; hg19.fa<br />
rm chr*.fa<br />
## ~/biosoft/bowtie/bowtie2-2.2.9/bowtie2-build ~/biosoft/bowtie/hg19_index/hg19.fa ~/biosoft/bowtie/hg19_index/hg19<br />
## Download and install BWA<br />
cd ~/biosoft<br />
mkdir bwa &amp;&amp; cd bwa</p>
<p>http://sourceforge.net/projects/bio-bwa/files/</p>
<p>tar xvfj bwa-0.7.12.tar.bz2 # x extracts, v is verbose (details of what it is doing), f skips prompting for each individual file, and j tells it to unzip .bz2 files<br />
cd bwa-0.7.12<br />
make<br />
export PATH=$PATH:/path/to/bwa-0.7.12 # Add bwa to your PATH by editing ~/.bashrc file (or .bash_profile or .profile file)<br />
# /path/to/ is an placeholder. Replace with real path to BWA on your machine<br />
source ~/.bashrc<br />
# bwa index [-a bwtsw|is] index_prefix reference.fasta<br />
bwa index -p hg19bwaidx -a bwtsw ~/biosoft/bowtie/hg19_index/hg19.fa<br />
# -p index name (change this to whatever you want)<br />
# -a index algorithm (bwtsw for long genomes and is for short genomes)<br />
## Download and install macs2<br />
## // https://pypi.python.org/pypi/MACS2/<br />
cd ~/biosoft<br />
mkdir macs2 &amp;&amp; cd macs2<br />
wget ~~~~~~~~~~~~~~~~~~~~~~MACS2-2.1.1.20160309.tar.gz<br />
tar zxvf MACS2-2.1.1.20160309.tar.gz<br />
cd MACS2-2.1.1.20160309<br />
python setup.py install --user</p>
<p>#################### The log for installing MACS2:<br />
Creating ~/.local/lib/python2.7/site-packages/site.py<br />
Processing MACS2-2.1.1.20160309-py2.7-linux-x86_64.egg<br />
Copying MACS2-2.1.1.20160309-py2.7-linux-x86_64.egg to ~/.local/lib/python2.7/site-packages<br />
Adding MACS2 2.1.1.20160309 to easy-install.pth file<br />
Installing macs2 script to ~/.local/bin<br />
Finished processing dependencies for MACS2==2.1.1.20160309<br />
############################################################<br />
~/.local/bin/macs2 --help</p>
<p>Example for regular peak calling:<br />
macs2 callpeak -t ChIP.bam -c Control.bam -f BAM -g hs -n test -B -q 0.01<br />
Example for broad peak calling:<br />
macs2 callpeak -t ChIP.bam -c Control.bam --broad -g hs --broad-cutoff 0.1</p>
<p>## Download and install homer (Hypergeometric Optimization of Motif EnRichment)<br />
## // http://homer.salk.edu/homer/<br />
## // http://blog.qiubio.com:8080/archives/3024<br />
## pre-install: Ghostscript，seqlogo,blat<br />
cd ~/biosoft<br />
mkdir homer &amp;&amp; cd homer<br />
wget http://homer.salk.edu/homer/configureHomer.pl<br />
perl configureHomer.pl -install<br />
perl configureHomer.pl -install hg19</p></blockquote>
<p>一般来说，对我这样水平的人来说，软件安装就跟家常便饭一样，没有什么问题了，但如果你是初学者呢，肯定没那么轻松，所以请加强学习，我无法在这里讲解太具体的知识了。</p>
<p>所有软件安装完毕后就可以下载文章对这些CHIP-seq的处理结果了，这个很重要，检验我们是否重复了人家的数据分析过程：</p>
<blockquote><p>## step3 : download the results from paper<br />
## http://www.bio-info-trainee.com/1571.html<br />
mkdir paper_results &amp;&amp; cd paper_results<br />
wget ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE52nnn/GSE52964/suppl/GSE52964_RAW.tar<br />
tar xvf GSE52964_RAW.tar</p>
<p>ls *gz |xargs gunzip</p>
<p>## step4 : run FastQC to check the sequencing quality.</p>
<p>##这里可以看到我们下载的原始数据已经被作者处理好了，去了接头，去了低质量序列</p>
<p>ls *.fastq | while read id ; do ~/biosoft/fastqc/FastQC/fastqc $id;done<br />
## Sequence length 51<br />
## %GC 39<br />
## Adapter Content passed</p>
<p>The quality of the reads is pretty good, we don't need to do any filter or trim</p>
<p>mkdir QC_results<br />
mv *zip *html QC_results/</p></blockquote>
<p>所以我们可以直接拿这些数据去做比对了！！！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1740.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>草莓基因组数据预处理</title>
		<link>http://www.bio-info-trainee.com/467.html</link>
		<comments>http://www.bio-info-trainee.com/467.html#comments</comments>
		<pubDate>Tue, 24 Mar 2015 10:03:34 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[基因组学]]></category>
		<category><![CDATA[fastqc]]></category>
		<category><![CDATA[基因组]]></category>
		<category><![CDATA[草莓]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=467</guid>
		<description><![CDATA[今天先 对7个单端数据做处理，是454数据，平均长度300bp左右，明天再处理3 &#8230; <a href="http://www.bio-info-trainee.com/467.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>今天先 对7个单端数据做处理，是454数据，平均长度300bp左右，明天再处理3KB和20KB的配对reads。</p>
<p>首先跑fastqc</p>
<p>打开一个个看结果</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理28.png"><img class="alignnone size-full wp-image-468" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理28.png" alt="草莓基因组数据预处理28" width="458" height="322" /></a></p>
<p>可以看到前面一些碱基的质量还是不错的， 因为这是454平台测序数据，序列片段长度差异很大，一般前四百个bp的碱基质量还是不错的，太长了的测序片段也不可靠</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理39.png"><img class="alignnone size-full wp-image-469" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理39.png" alt="草莓基因组数据预处理39" width="465" height="342" /></a></p>
<p>重点在下面这个图片，可以看到，前面的4个碱基是adaptor，肯定是要去除的，不是我们的测序数据。是TCAG，需要去除掉。</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理118.png"><img class="alignnone size-full wp-image-470" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理118.png" alt="草莓基因组数据预处理118" width="453" height="336" /></a></p>
<p>所以我们用了 solexaQA 这个套装软件对原始测序数据进行过滤</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理214.png"><img class="alignnone size-full wp-image-471" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理214.png" alt="草莓基因组数据预处理214" width="553" height="232" /></a></p>
<p>可以看到过滤的非常明显！！！甚至有个样本基本全军覆没了！然后我查看了我的批处理脚本，发现可能是perl DynamicTrim.pl -454 $id这个参数有问题</p>
<p>for id in *fastq</p>
<p>do</p>
<p>echo $id</p>
<p>perl DynamicTrim.pl -454 $id</p>
<p>done</p>
<p>for id in *trimmed</p>
<p>do</p>
<p>echo $id</p>
<p>perl LengthSort.pl $id</p>
<p>done</p>
<p>&nbsp;</p>
<p>可以看到末尾的质量差的碱基都被去掉了，但是头部的TCAG还是没有去掉。</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理425.png"><img class="alignnone size-full wp-image-472" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理425.png" alt="草莓基因组数据预处理425" width="553" height="259" /></a></p>
<p>处理完毕后的数据如下：</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理475.png"><img class="alignnone size-full wp-image-473" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/草莓基因组数据预处理475.png" alt="草莓基因组数据预处理475" width="351" height="155" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/467.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>仿写fastqc软件的一些功能-R代码</title>
		<link>http://www.bio-info-trainee.com/179.html</link>
		<comments>http://www.bio-info-trainee.com/179.html#comments</comments>
		<pubDate>Sun, 15 Mar 2015 02:53:11 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[基础软件]]></category>
		<category><![CDATA[生信基础]]></category>
		<category><![CDATA[计算机基础]]></category>
		<category><![CDATA[fastqc]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=179</guid>
		<description><![CDATA[仿写fastqc软件的一些功能(下) 文件来自于上面perl代码的输出文件，好像 &#8230; <a href="http://www.bio-info-trainee.com/179.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><b>仿写fastqc软件的一些功能(下)</b></p>
<p>文件来自于上面perl代码的输出文件，好像算法有点问题，26G的文件居然处理近一个小时才出数据！</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码263.png"><img class="alignnone size-full wp-image-180" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码263.png" alt="仿写fastqc软件的一些功能-下-R代码263" width="361" height="161" /></a></p>
<p>R语言本身自带的画图工具都很丑，懒得说了，可以用ggplot2来重新画一个，不是项目要求没有报酬我就懒得画了，大家面前看看画图原理即可。</p>
<p><span id="more-179"></span></p>
<p>a=read.table("meanQ.txt")</p>
<p>看看数据结构如下</p>
<p>&gt; head(a)</p>
<p>V1    V2</p>
<p>1  2 93879</p>
<p>2  3 17800</p>
<p>3  4 25295</p>
<p>4  5 33259</p>
<p>5  6 55685</p>
<p>6  7 84866</p>
<p>plot(a,type='l',col='red',ylab='reads number',xlab='mean quality',main='mean Q distribution')</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码755.png"><img class="alignnone size-full wp-image-181" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码755.png" alt="仿写fastqc软件的一些功能-下-R代码755" width="645" height="630" /></a></p>
<p>可以看出绝大部分的reads的Q值都在30-35直接，也就是说本次测序挺符合要求的，但是还是需要对那些平均Q20以下的reads过滤掉。</p>
<p>a=read.table('meanGC.txt')</p>
<p>看看数据结构如下</p>
<p>&gt; head(a)</p>
<p>V1  V2</p>
<p>1  0 503</p>
<p>2  1 151</p>
<p>3  2 163</p>
<p>4  3 179</p>
<p>5  4 315</p>
<p>6  5 443</p>
<p>plot(a,type='l',col='red',ylab='reads number',xlab='reads bp',main='GC% distribution')</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1160.png"><img class="alignnone size-full wp-image-182" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1160.png" alt="仿写fastqc软件的一些功能-下-R代码1160" width="648" height="636" /></a></p>
<p>可以看出GC含量的分布看起来挺符合正态分布的，大部分reads的GC含量都是在40%-60%直接</p>
<p>a=read.table('fivenum.txt',header=T)</p>
<p>看看数据结构如下</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1405.png"><img class="alignnone size-full wp-image-183" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1405.png" alt="仿写fastqc软件的一些功能-下-R代码1405" width="252" height="107" /></a></p>
<p>boxplot(t(a[,3:7]),xlab='reads bp',ylab='Q value',main='mean Q boxplot')</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1676.png"><img class="alignnone size-full wp-image-184" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1676.png" alt="仿写fastqc软件的一些功能-下-R代码1676" width="643" height="628" /></a></p>
<p>可以看出测序质量从1-100bp过去质量越来越差，但是大部分都是高于Q30，但是88bp之后的碱基测序质量不咋地，可能需要trim掉</p>
<p>对于这个数据还可以画一个图</p>
<p>plot(a[,1:2],type='l',col='red',ylab='Q value',xlab='reads bp',main='mean Q value distribution')</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1987.png"><img class="alignnone size-full wp-image-185" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的一些功能-下-R代码1987.png" alt="仿写fastqc软件的一些功能-下-R代码1987" width="650" height="623" /></a></p>
<p>可以看到88bp之后的平均Q值小于30，根据我们的阈值可能要把所有的reads的后面约10个bp的碱基要trim掉</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/179.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>仿写fastqc软件的部分功能-perl代码</title>
		<link>http://www.bio-info-trainee.com/149.html</link>
		<comments>http://www.bio-info-trainee.com/149.html#comments</comments>
		<pubDate>Sat, 14 Mar 2015 00:21:08 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[计算机基础]]></category>
		<category><![CDATA[fastqc]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=149</guid>
		<description><![CDATA[  仿写fastqc软件的部分功能（上） 前面我们介绍了fastqc这个软件的使 &#8230; <a href="http://www.bio-info-trainee.com/149.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><b>  仿写fastqc软件的部分功能（上）</b></p>
<p>前面我们介绍了fastqc这个软件的使用方法 <a href="http://www.bio-info-trainee.com/?p=95">http://www.bio-info-trainee.com/?p=95</a> ，这是一个java软件，但是有些人服务器没有配置好这个java环境，导致无法使用，这里我贴出几个perl代码，也能实现fastqc的部分功能</p>
<p>统一测试文件是illumina的phred33格式的fastq文件，共100000/4=25000条reads，读长都是101个碱基</p>
<p>程序名-fastq2quality.pl</p>
<p>使用命令：perl fastq2quality.pl SRR504517_1.fastq &gt;quality.txt</p>
<p>功能： 把fastq格式的每条原始reads的第四行ascii码质量值，转换为Q值并输出一个矩阵，有多少条reads就有多少行，每条reads的碱基数就是列数。</p>
<p><span id="more-149"></span></p>
<p>[perl]<br />
while (&lt;&gt;){</p>
<p>    next unless $.%4==0;</p>
<p>    chomp;</p>
<p>    s/\r//g;</p>
<p>    @F=split//;</p>
<p>    foreach (@F){</p>
<p>        $num=ord($_);</p>
<p>        $num-=33;</p>
<p>        print &quot;$num\t&quot;;</p>
<p>    }</p>
<p>    print &quot;\n&quot;;</p>
<p>}<br />
[/perl]</p>
<p>&nbsp;</p>
<p>统计结果如下</p>
<p><b><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上817.png"><img class="alignnone size-full wp-image-150" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上817.png" alt="仿写fastqc软件的部分功能-上817" width="608" height="246" /></a></b></p>
<p>程序名-fastq2meanQ.pl</p>
<p>使用命令：perl fastq2meanQ.pl SRR504517_1.fastq</p>
<p>功能： 把fastq格式的原始reads统计每条reads的平均Q值，并画出Q值1到50各有多少条reads的分布图</p>
<p>[perl]<br />
while (&lt;&gt;){</p>
<p>    next unless $.%4==0;</p>
<p>    chomp;</p>
<p>    s/\r//g;</p>
<p>    @F=split//;</p>
<p>    $mean=0;</p>
<p>    $sum=0;</p>
<p>    foreach (@F){</p>
<p>        $num=ord($_);</p>
<p>        $num-=33;</p>
<p>        $sum+=$num;</p>
<p>    }</p>
<p>    $mean=int($sum/@F);</p>
<p>    $hash{$mean}++;</p>
<p>}</p>
<p>print &quot;$_ \t$hash{$_}\n&quot; foreach sort {$a&lt;=&gt;$b}  keys %hash;<br />
[/perl]</p>
<p>&nbsp;</p>
<p>统计结果如下</p>
<p><b><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上1438.png"><img class="alignnone size-full wp-image-151" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上1438.png" alt="仿写fastqc软件的部分功能-上1438" width="532" height="317" /></a></b></p>
<p>&nbsp;</p>
<p>程序名-fastq2fivenum.pl</p>
<p>使用命令：perl fastq2fivenum.pl  SRR504517_1.fastq</p>
<p>功能： 把fastq格式的每条原始reads的第四行ascii码质量值，转换为Q值，并对每一个位点统计所以reads的四分位数，加上平均数。</p>
<p>[perl]<br />
use List::Util qw/max min sum maxstr minstr shuffle/;</p>
<p>while (&lt;&gt;){</p>
<p>    next unless $.%4==0;</p>
<p>    chomp;</p>
<p>    s/\r//g;</p>
<p>    @F=split//;</p>
<p>    foreach (0..@F-1){</p>
<p>        $num=ord($F[$_]);</p>
<p>        $num-=33;</p>
<p>        $tmp[$_]-&gt;{$num}++;</p>
<p>    }</p>
<p>}</p>
<p>print &quot;num\tmean\tmin\tq25\tq50\tq75\tmax\n&quot;;</p>
<p>$i=0;</p>
<p>foreach $hash (@tmp){</p>
<p>    $sum_reads=sum values %{$hash};</p>
<p>    $num_q25=int($sum_reads/4);</p>
<p>    $num_q50=int($sum_reads/2);</p>
<p>    $num_q75=int(3*$sum_reads/4);</p>
<p>    $sum_Q=0;</p>
<p>    $sum_value=0;</p>
<p>    foreach (sort {$a&lt;=&gt;$b} keys %{$hash}){</p>
<p>          #print &quot;$_ \t$hash-&gt;{$_}------&quot;   </p>
<p>            $sum_Q+=$_ * $hash-&gt;{$_};</p>
<p>            $q25_before=($sum_value&lt;$num_q25);</p>
<p>            $q50_before=($sum_value&lt;$num_q50);</p>
<p>            $q75_before=($sum_value&lt;$num_q75);</p>
<p>            $sum_value+=$hash-&gt;{$_};</p>
<p>            $q25_last=($sum_value&gt;$num_q25);</p>
<p>            $q50_last=($sum_value&gt;$num_q50);</p>
<p>            $q75_last=($sum_value&gt;$num_q75);</p>
<p>            $q25=$_ if $q25_before &amp;&amp; $q25_last;</p>
<p>            $q50=$_ if $q50_before &amp;&amp; $q50_last;</p>
<p>            $q75=$_ if $q75_before &amp;&amp; $q75_last;            </p>
<p>        }</p>
<p>    $mean=$sum_Q/$sum_reads;</p>
<p>    $min=min keys %{$hash};</p>
<p>    $max=max keys %{$hash};   </p>
<p>    $i++;</p>
<p>    print &quot;$i\t$mean\t$min\t$q25\t$q50\t$q75\t$max\n&quot;;</p>
<p>}<br />
[/perl]</p>
<p>&nbsp;</p>
<p>统计结果文件如下</p>
<p><b><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上3024.png"><img class="alignnone size-full wp-image-152" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上3024.png" alt="仿写fastqc软件的部分功能-上3024" width="551" height="318" /></a></b></p>
<p>最后一个，统计GC含量</p>
<div>程序名-fastq2meanGC.pl</div>
<div>使用命令：perl fastq2meanGC.pl SRR504517_1.fastq</div>
<div>功能： 把fastq格式的原始reads统计每条reads的平均Q值，并画出Q值1到50各有多少条reads的分布图</div>
<div>
<div>
<p>[perl]&lt;/pre&gt;<br />
while (&lt;&gt;){</p>
<p>next unless $.%4==2;</p>
<p>chomp;</p>
<p>s/\r//g;</p>
<p>@F=split//;</p>
<p>$GC=0;</p>
<p>foreach (@F){</p>
<p>$GC++ if /G/;</p>
<p>$GC++ if /C/;</p>
<p>}</p>
<p>#print &quot;$GC\n&quot;;</p>
<p>$GC=int(100*$GC/length);</p>
<p>$hash{$GC}++;</p>
<p>}</p>
<p>print &quot;$_ \t$hash{$_}\n&quot; foreach sort {$a&lt;=&gt;$b}  keys %hash;<br />
&lt;pre&gt;[/perl]</p>
<p>结果如下所示<br />
<a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上3633.png"><img class="alignnone size-full wp-image-176" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/仿写fastqc软件的部分功能-上3633.png" alt="仿写fastqc软件的部分功能-上3633" width="552" height="343" /></a></p>
</div>
</div>
<p>这个我将会在下一篇讲诉如何用R画图</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/149.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
