GO slim

1. GO slim简介

GO slims are cut-down versions of the GO ontologies containing a subset of the terms in the whole GO. They give a broad overview of the ontology content without the detail of the specific fine grained terms.
简单地讲,GO slim 能简化 GO 的注释结果,将所有的 GO 注释归类到指定的数个 GO 功能分类上。
点击进入:GO Database Guide
点击进入:Ontology Downloads

2. 安装go-perl

方法1:

# perl -MCPAN -e shell
cpan[1]> install GO::Parser

方法2:

$ wget http://search.cpan.org/CPAN/authors/id/C/CM/CMUNGALL/go-perl-0.15.tar.gz
$ tar zxf go-perl-0.15.tar.gz
$ cd go-perl-0.15
$ perl Makefile.PL
$ make 
$ sudo make install

查看go-perl的说明文档

$ perldoc go-perl.pod

3. map2slim的使用

用法:

$ map2slim GO_slims/goslim_generic.obo ontology/gene_ontology.obo \
gene-associations/gene_association.fb

gene_ontology.obo和goslim_generic.obo文件在Ontology Downloads中下载。
操作的对象为GAF格式文件。当然此文件可以用blast2go的专业版生成。

使用map2slim的优点是可以自己构建属于自己物种的obo文件,然后运行该程序查看所感兴趣的功能基因的数目。

4. 使用blast2go做goslim

blast2go做goslim就很简单了,但是只能使用官网所公认的几个obo文件做goslim。

RSEM的使用

RSEM简介

RSEM is a software package for estimating gene and isoform expression levels from RNA-Seq data. The RSEM package provides an user-friendly interface, supports threads for parallel computation of the EM algorithm, single-end and paired-end read data, quality scores, variable-length reads and RSPD estimation. In addition, it provides posterior mean and 95% credibility interval estimates for expression levels. For visualization, It can generate BAM and Wiggle files in both transcript-coordinate and genomic-coordinate. Genomic-coordinate files can be visualized by both UCSC Genome browser and Broad Institute’s Integrative Genomics Viewer (IGV). Transcript-coordinate files can be visualized by IGV. RSEM also has its own scripts to generate transcript read depth plots in pdf format. The unique feature of RSEM is, the read depth plots can be stacked, with read depth contributed to unique reads shown in black and contributed to multi-reads shown in red. In addition, models learned from data can also be visualized. Last but not least, RSEM contains a simulator.

edgeR的使用

1. edgeR简介与安装

edgeR,Empirical analsis of digital gene expression data in R. Differential expression analysis of RNA-seq and digital gene expression profiles with biological replication. Uses empirical Bayes estimation and exact tests based on the negative binomial distribution. Also useful for differential signal analysis with other types of genome-scale count data.

To install this package, start R and enter:

    source("http://bioconductor.org/biocLite.R")
    biocLite("edgeR")

To cite this package in a publication, start R and enter:

    citation("edgeR")

To open the edgeR User’s Guide, start R and enter. edgeRUsersGuide.pdf will be downloaded.

    library(edgeR)
    edgeRUsersGuide()

2.

Trinity进行转录组分析的一条龙服务

1. Trinity进行转录组组装

Trinity进行转录组组装的典型命令如下:

$ /opt/biosoft/trinityrnaseq_r20131110/Trinity.pl --seqType fq --JM 50G\
 --left sample1_1.clean.fastq sample2_1.clean.fastq\
 --right sample1_2.clean.fastq sample2_2.clean.fastq\
 --jaccard_clip --CPU 6 --SS_lib_type FR

–JM后的参数设定与转录组的大小有关,在内存足够的情况下,设定大点能节约时间;
–left 和 –right后可以接多个样平的数据,并用空格隔开,值得注意的是,left reads name以/1结尾,rigth reads name以/2结尾;
–jaccard_clip 适合于基因稠密的真菌物种;
–SS_lib_type 适合于链特异性测序

大数据量(>300M pairs)的RNA-seq数据,最好使用TRINITY_RNASEQ_ROOT/util/normalize_by_kmer_coverage.pl对reads进行处理后再使用trinity进行组装,以降低内存消耗和大量时间。
也可以设置–min_kmer_cov 2,丢弃uniquely occurring kmer, 从而降低内存消耗。

参考文献:
1. Grabherr MG, Haas BJ, Yassour M, Levin JZ, Thompson DA, Amit I, Adiconis X, Fan L, Raychowdhury R, Zeng Q, Chen Z, Mauceli E, Hacohen N, Gnirke A, Rhind N, di Palma F, Birren BW, Nusbaum C, Lindblad-Toh K, Friedman N, Regev A. Full-length transcriptome assembly from RNA-seq data without a reference genome. Nat Biotechnol. 2011 May 15;29(7):644-52. doi: 10.1038/nbt.1883. PubMed PMID: 21572440.
2. Borodina T, Adjaye J, Sultan M. A strand-specific library preparation protocol for RNA sequencing. Methods Enzymol. 2011;500:79-98. PubMed PMID: 21943893.

2. Trinity输出结果的统计

Trinity默认的输出结果为:trinity_out_dir/Trinity.fasta。
该fasta格式文件中序列名例如:

>comp6749_c0_seq1 len=328 path=[471:0-83 388:84-208 679:209-327]
>comp6749_c0_seq2 len=328 path=[304:0-83 388:84-208 679:209-327]
>comp6749_c0_seq3 len=245 path=[901:0-125 679:126-244]

可以看到,trinity生成的结果为components,而一个components可能有多个seq。这相当于一个gene能有多个transcripts。

可以使用trinity自带的程序TrinityStats.pl对components和transcripts的数目,大小和N50等进行统计。

$ $TRINITY_HOME/util/TrinityStats.pl trinity_out_dir/Trinity.fasta
Total trinity transcripts:	40138
Total trinity components:	31067
Percent GC: 61.31

3. 将reads比对到转录组,并进行可视化

TRINITY_RNASEQ_ROOT/util/alignReads.pl能调用bowtie将reads map到转录组,并可以设置链特异性参数。

$ TRINITY_RNASEQ_ROOT/util/alignReads.pl --left left.fq --right right.fq --seqType fq\
 --target Trinity.fasta --aligner bowtie --retain_intermediate_files

结果中生成coordSorted和nameSorted的sam和bam文件。如果设置了链特异性参数,则额外生成+链和-链的比对结果文件。

TRINITY_RNASEQ_ROOT/util/SAM_nameSorted_to_uniq_count_stats.pl用于统计比对结果

$ $TRINITY_HOME/util/SAM_nameSorted_to_uniq_count_stats.pl bowtie_out.nameSorted.sam.+.sam
#read_type  count   pct
proper_pairs    21194964    93.22    both read pairs align to a single contig and point toward each other.
left_only   836213  3.68             only the left (/1) read is reported in an alignment
right_only  687576  3.02             only the right (/2) read is reported in an alignment
improper_pairs  16640   0.07         both left and right reads align, but to separate contigs, or to a single contig in the wrong expected relative orientations.

可以将Trinity.fasta导入到IGV中作为genome,上载bam文件,从而可视化比对结果。

4. 使用RSEM进行表达量计算

首先,需要下载最新版本的RSEM,安装并将程序加入到$PATH中。

$ wget http://deweylab.biostat.wisc.edu/rsem/src/rsem-1.2.8.tar.gz
$ tar zxf rsem-1.2.8.tar.gz
$ cd rsem-1.2.8
$ make
$ echo "PATH=$PWD:\$PATH" >> ~/.bashrc

使用$TRINITY_HOME/util/RSEM_util/run_RSEM_align_n_estimate.pl可以调用RSEM,从而计算表达量。如果是链特异性测序,则加入–SS_lib_type参数。

$TRINITY_HOME/util/RSEM_util/run_RSEM_align_n_estimate.pl --transcripts Trinity.fasta \
        --seqType fq --left left.reads.fq --right right.reads.fq --SS_lib_type FR \
        --prefix RSEM --thread_count 4 -- --bowtie-phred64-quals --no-bam-output

将rsem-calculate-expression程序的参数–bowtie-phred64-quals和–no-bam-output加入到run_RSEM_align_n_estimate.pl中,则如上所示。这两个参数分别代表fastq的质量格式是phred64,不输出bam文件(节约大量时间)。
若运行出现问题,点击:RSEM的README文件

结果生成两个abundance estimation information文件:
RSEM.isoforms.results : EM read counts per Trinity transcript
RSEM.genes.results : EM read counts on a per-Trinity-component (aka… gene) basis, ‘gene’ used loosely here.

可以根据得到的结果,去除掉IsoPct低于1%的transcripts。可以依据RSEM.isoforms.results使用TRINITY_RNASEQ_ROOT/util/filter_fasta_by_rsem_values.pl过滤掉trinity组装结果中的lowly supported transcripts。
但不推荐过滤掉这些序列。

5. 鉴定差异表达transcripts

Trinity可以使用Bioconductor package中的edgeR或DESeq来鉴定差异表达trancripts。因此,需要安装R和相关的一些包。

source("http://bioconductor.org/biocLite.R")
biocLite('edgeR')
biocLite('DESeq')
biocLite('ctc')
biocLite('Biobase')
install.packages('gplots’)
install.packages(‘ape’)

5.1 使用上一节中的RSEM来分别对每个样品的每个生物学重复进行表达量计算

5.2 将每个样的RSEM的结果进行合并

$ $TRINITY_HOME/util/RSEM_util/merge_RSEM_frag_counts_single_table.pl \
sampleA.RSEM.isoform.results sampleB.RSEM.isoform.results ... \
> transcripts.counts.matrix
$ TRINITY_HOME/util/RSEM_util/merge_RSEM_frag_counts_single_table.pl \
sampleA.RSEM.gene.results sampleB.RSEM.gene.results ... \
> genes.counts.matrix

然后修改生成的两个matrix文件的column headers(代表着样品和重复的名字),有利于下游的分析。如果要分析transcripts水平的差异表达,则使用transcripts.counts.matrix文件;若要分析gene水平的差异表达,则使用genes.counts.matrix。

5.3 无生物学重复进行差异表达分析

$TRINITY_HOME/Analysis/DifferentialExpression/run_DE_analysis.pl用于调用edgeR或DESeq进行差异表达基因分析。直接输入该命令查看其用法。
Trinty推荐使用edgeR进行差异表达分析。

$TRINITY_HOME/Analysis/DifferentialExpression/run_DE_analysis.pl \
--matrix counts.matrix --method edgeR

注意输入的matrix是counts的数据,而不要是FPKM的数据。

5.4 有生物学重复进行差异表达分析

首先,要建立文件samples_described.txt,内容为:

conditionA   condA-rep1
conditionA   condA-rep2

conditionB   condB-rep1
conditionB   condB-rep2

conditionC   condC-rep1
conditionC   condC-rep2

condA-rep1, condA-rep2, condB-rep1… 等对应着counts.matrix文件中的column names。
命令如下:

$TRINITY_HOME/Analysis/DifferentialExpression/run_DE_analysis.pl \
--matrix SP2.rnaseq.counts.matrix --method edgeR \
--samples_file samples_described.txt

结果文件中 logFC 是 log2 Fold Change; logCPM 是 log2-counts-per-million。

值得注意的是:程序默认去除counts数都少于10的transcripts或genes,不对其进行差异分析。所以有差异分析的genes或transcripts数目低于原始的数目。

5.5 提取差异表达基因,对其进行聚类分析

5.5.1 表达量的 normalized

使用TMM方法将counts转换为FPKM。
首先从1个样平的RSEM结果中提取长度数据:

$ cut -f 1,3,4 sampleA.RSEM.isoforms.results > feature_lengths.txt

然后使用TMM方法将counts数据转换为FPKM数据:

$ $TRINITY_HOME/Analysis/DifferentialExpression/run_TMM_normalization_write_FPKM_matrix.pl \
--matrix counts.matrix --lengths feature_lengths.txt

5.5.2 提取差异表达转录子

注意的是,这一步要在edgeR的结果文件中运行程序:

$ $TRINITY_HOME/Analysis/DifferentialExpression/analyze_diff_expr.pl \
--matrix matrix.TMM_normalized.FPKM -P 0.001 -C 2

默认下选择FDR值低于0.001,log2fold-change的绝对值>=2为差异表达基因。
程序输出差异表达基因FPKM、log2FC、FDR等值 和 聚类图 Heat Map.

5.5.3 根据聚类图提取子类

根据聚类结果,可以自动或手动确定子类。
自动确定子类:

$ $TRINITY_HOME/Analysis/DifferentialExpression/define_clusters_by_cutting_tree.pl \
--Ptree 20 -R file.all.RData

上例中从数的20%处来自动划分子类。
手动确定子类:

$ R
> load("all.RData") # check for your corresponding .RData file name to use here, replace all.RData accordingly
> source("$TRINITY_HOME/Analysis/DifferentialExpression/R/manually_define_clusters.R")
> manually_define_clusters(hc_genes, centered_data)
然后左键点击选择子类,右键结束选择

6. 提取蛋白编码区

使用transdecoder从trinity的转录子中提取coding region。最新版的transdecoder貌似有点问题。

$ $TRINITY_HOME/trinity-plugins/transdecoder/transcripts_to_best_scoring_ORFs.pl \
-t transcripts.fasta -m 100

默认下允许的最小的protein长度为100.
提取出了coding region,得出对应的protein序列,有利于于下一步的功能注释。

解决Apache中文网页乱码

CentOS系统默认情况下,显示GB2312的中文,会显示乱码,解决方法如下:

1. 修改/etc/httpd/conf/httpd.conf文件

AddDefaultCharset off

默认下,设置的Charset为UTF-8。将其设为 off。

2. 网页中指定charset的值

在很多中文网页中,存在如下一行:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

使用浏览器去浏览此类网页的时候,若没有做第一步中的修改,则中文会显示乱码。

但是作了第一步中的修改,则会在普通网页中显示中文乱码。解决方法是在html文件的head部分添加:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

apache的网页安全设置

1. 限制IP访问

使用deny和allow来设定允许和不允许访问网页的IP段。

Order deny,allow:以 deny 优先处理,但没有写入规则的则默认为 allow 。常用于:拒绝所有,开放特定的条件;
Order allow,deny:以 allow 为优先处理,但没有写入规则的则默认为 deny。 常用于:开放所有,拒绝特定的条件。
如果 allow 与 deny 的规则当中有重复的,则以预设的情况 (Order 的规范) 为主。

一般情况下,这样写,用于不允许某些IP的访问:

<Directory "/var/www/html">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    allow from all
    deny from 192.168.1.0/24
    deny from .gov.tw
</Directory>

2. 设置保护网页的用户名密码访问

2.1 修改/etc/httpd/conf/httpd.conf文件

[root@linux ~]# vi /etc/httpd/conf/httpd.conf
# 确定底下这几行是存在的!
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# 在某个不受影响的地方加入这一段:
<Directory "/var/www/html/protect">
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>

[root@linux ~]# apachectl restart  <==重新启动,不要忘记了!

2.2 在保护目录下建立.htaccess 档案

[root@linux ~]# cd /var/www/html/protect
[root@linux ~]# vi .htaccess
# 只要加入底下这几行即可
AuthName     "Protect test by .htaccess"
Authtype     Basic
AuthUserFile /var/www/apache.passwd
require user test

2.3 建立密码档案 htpasswd

Apache 默认读取的账号/密码设定数据是由 htpasswd 所建立的,这个指令的语法是这样的:

[root@linux ~]# htpasswd [-c] 密码文件文件名 用户账号
参数:
-c :建立后面的密码档案。如果该档案已经存在,则原本的数据会被删除!
     所以如果只是要新增使用者(档案已存在时),不必加上 -c 的参数!

1. 建立 apache.passwd ,账号为 test
[root@linux ~]# htpasswd -c /var/www/apache.passwd test
New password:  <==这里输入一次密码,注意,屏幕不会有任何讯息。
Re-type new password:  <==这里再输入一次
Adding password for user test

[root@linux ~]# cat /var/www/apache.passwd
test:FIquw/..iS4yo   <==您瞧瞧!已经建立一个新使用者!

2. 在已存在的 apache.passwd 内增加 test1 这个账号:
[root@linux ~]# htpasswd /var/www/apache.passwd test1

Pfam

1. simple introduction

The Pfam database is a large collection of protein families, each represented by multiple sequence alignments and hidden Markov models (HMMs).

There are two components to Pfam: Pfam-A and Pfam-B. Pfam-A entries ara high quality, manually curated families. Pfam-B families are of lower quality, but can be useful for identifying functionally conserved regions when no Pfam-A entries are found.

Pfam also generates higher-level groupings of related families, known as clans. A clan is a collection of Pfam-A entries which are related by similarity of sequence, structure of profile-HMM.

2. citation

Bateman A, Coin L, Durbin R, et al. The Pfam protein families database[J]. Nucleic acids research, 2004, 32(suppl 1): D138-D141.

The latest version of Pfam is release 27.0, which contains 14,831 manually curated protein families.

3.

wine的安装与microsoft office在linux上的运行

1. CentOS 64位系统上安装wine

1.1 使用yum进行安装

此方法安装的版本较低。推荐安装使用此方法进行wine的安装:安装容易;版本稳定;快捷方便。

# rpm -ivh http://mirrors.sohu.com/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
# yum makecache
# yum install wine

1.2 源码包安装

可以安装最新版,建议使用普通用户安装。

# yum -y groupinstall 'Development Tools'
# yum -y install libX11-devel freetype-devel
$ wget http://citylan.dl.sourceforge.net/project/wine/Source/wine-1.7.3.tar.bz2
$ tar -xvf wine-1.7.3.tar.bz2
$ cd wine-1.7.3/

32位系统的安装:
$ ./tools/wineinstall

64位系统的安装
$ ./configure --enable-win64 --prefix=/opt/wine
$ make -j 8; make install

# yum groupinstall "X Window System" "GNOME Desktop Environment"
OR
# yum groupinstall "X Window System" "KDE (K Desktop Environment)"

2. 使用wine安装microsoft office 2007

office 2003不能打开office2007的文件,同时wine安装office2010出错,故选择安装office 2007。office 2007不区分64位和32位。应该为32位。

2.1 安装wine下中文支持

此处参考:http://www.360doc.com/content/13/0811/16/7256015_306408693.shtml

2.2 下载office2007并安装

首先,运行winecfg进行wine的配置。模拟环境windows xp, 在函数库选项卡中新增函数库顶替riched20(原装先于内建),即使用系统自带的riched20,而不是wine内置的riched20。然后使用wine安装office2007。

$ winecfg

然后,从Microsoft官网下载MSXML 3.0并安装。

$ msiexec /i msxml3.msi

最后安装office2007.

$ sudo mount -o loop cn_office_professional_plus_2007_sp3_dvd_X12-38713.iso /mnt/
$ cd /mnt
$ wine setup.exe

运行程序的方法:

$ wine /home/chenlianfu/.wine/drive_c/Program\ Files\ \(x86\)/Microsoft\ Office/Office12/WINWORD.EXE
$ wine /home/chenlianfu/.wine/drive_c/Program\ Files\ \(x86\)/Microsoft\ Office/Office12/POWERPNT.EXE
$ wine /home/chenlianfu/.wine/drive_c/Program\ Files\ \(x86\)/Microsoft\ Office/Office12/EXCEL.EXE

最后,运行PPT和EXCEL正常,但是运行word的问题是关闭word总是“遇到问题需要关闭”,这个时候,去掉复选框的勾,点击“不发送”即可。

3. yozo office

发现永中office在linux上运行很不错。

4. CrossOver

发现使用CrossOver才是王道。它是wine的商业版本。使用CrossOver能非常简单的安装并使用Office;同时也能正常使用QQ2013。不过是需要人民币,也不贵,88元永久性使用。

有关non-coding RNA的知识

1. rRNA

1.1 rRNA,即核糖体RNA,是3类RNA(tRNA,mRNA,rRNA)中相对分子质量最大,数量最多的一类RNA。它与蛋白质结合而形成核糖体,其功能是作为mRNA的支架,使mRNA分子在其上展开,实现蛋白质的合成。

1.2 原核生物和真核生物的核糖体均由大、小两种亚基组成。原核生物中,5S 和 23S rRNAs 在大亚基(large subunit)中, 16S rRNA 在小亚基(small subunit)中; 真核生物中,5S, 5.8S 和 28S rRNAs 在大亚基中,18S rRNA 在小亚基中。

1.3 原核生物中的 16S, 23S 和 5S rRNAs 通常串联在一起进行转录;真核生物中 18S, 28S 和 5.8S rRNAs 在一起形成一个转录单元,而 5S rRNA 则则为高度串联重复。

1.4 在大部分物种中,全基因组上一般有几个拷贝的 rRNA 转录单元,这些转录单元的序列差异通常很低,低于1%。最高的也只有11%。