实验7:Shell程序开发(1):GFF文件处理程序

一、实验目的
1. 了解GFF文件的概念和特点;
2. 掌握Shell脚本处理GFF文件的方法。
			
二、实验环境
1. 操作系统:客户端Windows,服务器端Linux
2. 主要软件:putty
			
三、实验原理
GFF格式由Sanger研究所定义,是一种简单的、方便的对于DNA、RNA以及蛋白质序列
的特征进行描述的一种数据格式,比如序列的哪里到哪里是基因。GFF已经成为序列
注释的通用格式,比如基因组的基因预测,许多软件都支持输入或者输出GFF格式。
目前格式定义的最新版本是版本3。原始定义见http://www.sequenceontology.org/gff3.shtml。
GFF是纯文本文件,由tab键隔开的9列组成,以下是各列的说明:
Column 1: “seqid”
序列的编号,编号的有效字符[a-zA-Z0-9.:^*$@!+_?-|]
Column 2: “source”
注释信息的来源,比如”Genescan”、”GenBank” 等,可以为空,为空用”.”点号代替
Column 3: “type”
注释信息的类型,比如Gene、cDNA、mRNA等,或者是SO对应的编号
Columns 4 & 5: “start” and “end”
开始与结束的位置,注意计数是从1开始的。结束位置不能大于序列的长度
Column 6: “score”
得分,数字,是注释信息可能性的说明,可以是序列相似性比对时的E-values值或者
基因预测时的P-values值。“.”表示为空。
Column 7: “strand”
序列的方向, +表示正义链, -反义链 , ? 表示未知.
Column 8: “phase”
仅对注释类型为 “CDS”有效,表示起始编码的位置,有效值为0、1、2。
Column 9: “attributes”
以多个键值对组成的注释信息描述,键与值之间用“=”,不同的键值用“;”隔开,一个
键可以有多个值,不同值用“,”分割。注意如果描述中包括tab键以及”,=;”,要用URL
转义规则进行转义,如tab键用 %09代替。键是区分大小写的,以大写字母开头的键
是预先定义好的,在后面可能被其他注释信息所调用。
预先定义的键包括:
    ID 注释信息的编号,在一个GFF文件中必须唯一;
    Name 注释信息的名称,可以重复;
    Alias 别名
    Parent Indicates 该注释所属的注释,值为注释信息的编号,比如外显子所属的
	转录组编号,转录组所属的基因的编号。值可以为多个。
    Target Indicates: the target of a nucleotide-to-nucleotide or protein-to-nucleotide alignment.
    Gap:The alignment of the feature to the target if the two are not collinear (e.g. contain gaps).
    Derives_from:Used to disambiguate the relationship between one feature and another 
	when the relationship is a temporal one rather than a purely structural “part of” one.
	This is needed for polycistronic genes.
    Note 备注
    Dbxref 数据库索引
Ontology_term: A cross reference to an ontology term.

    GFF文件示例:
##gff-version 3
##sequence-region ctg123 1 1497228
ctg123 . gene 1000 9000 . + . ID=gene00001;Name=EDEN
ctg123 . TF_binding_site 1000 1012 . + . Parent=gene00001
ctg123 . mRNA 1050 9000 . + . ID=mRNA00001;Parent=gene00001
ctg123 . mRNA 1050 9000 . + . ID=mRNA00002;Parent=gene00001
ctg123 . mRNA 1300 9000 . + . ID=mRNA00003;Parent=gene00001
ctg123 . exon 1300 1500 . + . Parent=mRNA00003
ctg123 . exon 1050 1500 . + . Parent=mRNA00001,mRNA00002
ctg123 . exon 3000 3902 . + . Parent=mRNA00001,mRNA00003
ctg123 . exon 5000 5500 . + . Parent=mRNA00001,mRNA00002,mRNA00003
ctg123 . exon 7000 9000 . + . Parent=mRNA00001,mRNA00002,mRNA00003
ctg123 . CDS 1201 1500 . + 0 ID=cds00001;Parent=mRNA00001
ctg123 . CDS 3000 3902 . + 0 ID=cds00001;Parent=mRNA00001
ctg123 . CDS 5000 5500 . + 0 ID=cds00001;Parent=mRNA00001
ctg123 . CDS 7000 7600 . + 0 ID=cds00001;Parent=mRNA00001
ctg123 . CDS 1201 1500 . + 0 ID=cds00002;Parent=mRNA00002
ctg123 . CDS 5000 5500 . + 0 ID=cds00002;Parent=mRNA00002
ctg123 . CDS 7000 7600 . + 0 ID=cds00002;Parent=mRNA00002
ctg123 . CDS 3301 3902 . + 0 ID=cds00003;Parent=mRNA00003
ctg123 . CDS 5000 5500 . + 2 ID=cds00003;Parent=mRNA00003
(资料来源
四、实验内容
1. 在自己的主目录下的linux/exp目录中新建目录exp_7;
2. 将/home/pub/seq/637000073.gff复制到exp_7下,并在此目录中编辑Shell脚本
inter_gene_len.sh,实现计算文件637000073.gff中所有蛋白编码基因(序列类型为CDS)
间的距离。程序运行时文件名利用命令行参数读到程序中,结果输出到标准输出。
			
五、实验报告
1.实验环境(包括操作系统和软件),实验步骤,结果文件记录; 
2.实验中遇到的问题,如何解决的。