首先了解一下GTF/GFF的格式
https://asia.ensembl.org/info/website/upload/gff.html
兩者的關(guān)系如下
GTF (gene transfer format) is identical to GFF (general feature format) version 2
- GFF格式主要是用來(lái)注釋基因組
- GTF主要是用來(lái)對(duì)基因進(jìn)行注釋?zhuān)热缁蛟谌旧w上的位置(coordinate)及這段區(qū)間的其他信息。
兩者在內(nèi)容上前八列相同,最后一列信息顯示不一致炬转,gff文件格式如下:
- seqid - name of the chromosome or scaffold; chromosome names can be given with or without the 'chr' prefix. Important note: the seq ID must be one used within Ensembl, i.e. a standard chromosome name or an Ensembl identifier such as a scaffold ID, without any additional content such as species or assembly. See the example GFF output below. (id印荔,一般為chr或者scanfold編號(hào))
- source - name of the program that generated this feature, or the data source (database or project name) (注釋的來(lái)源抑诸,如果未知用.代替)
- type - type of feature. Must be a term or accession from the SOFA sequence ontology (注釋信息的類(lèi)型彼妻,比如Gene、cDNA冒冬、mRNA伴逸、CDS等)
- start - Start position of the feature, with sequence numbering starting at 1.
- end - End position of the feature, with sequence numbering starting at 1.
- score - A floating point value. (序列相似性比對(duì)時(shí)的E-values值或者基因預(yù)測(cè)是的P-values值缠沈,“.”表示為空)
- strand - defined as + (forward) or - (reverse).(正反義鏈)
- phase - One of '0', '1' or '2'. '0' indicates that the first base of the feature is the first base of a codon, '1' that the second base is the first base of a codon, and so on. (CDS類(lèi)型中指出該值,值為CDS的起始位置错蝴,除以3得到的余數(shù))
- attributes - A semicolon-separated list of tag-value pairs, providing additional information about each feature. Some of these tags are predefined, e.g. ID, Name, Alias, Parent - see the GFF documentation for more details. (以多個(gè)鍵值對(duì)組成的注釋信息描述洲愤,鍵與值之間用“=”,不同的鍵值用“顷锰;)
安裝如下:
cd /some/build/dir
git clone https://github.com/gpertea/gclib
git clone https://github.com/gpertea/gffread
cd gffread
make
程序是c++編寫(xiě)的因此并不需要預(yù)裝一些包柬赐,當(dāng)然也可以使用conda安裝。
conda install gffread -y
使用的例子如下:
#下載gtf/gff文檔及hg19文件
wget ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_19/gencode.v19.annotation.gtf.gz
wget ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_19/gencode.v19.annotation.gff3.gz
wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/chromFa.tar.gz
#使用gunzip及tar分別解壓官紫,并合并下載內(nèi)容獲得hg19.fa
cat *.fa >hg19.fa
#根據(jù)hg19.fa提取CDS序列
gffread gencode.v19.annotation.gff3 -g hg19.fa -y tr_cds.fa
#翻譯后蛋白序列
gffread gencode.v19.annotation.gff3 -g hg19.fa -x cds.fa
#獲得外顯子序列
gffread gencode.v19.annotation.gff3 -g hg19.fa -w exons.fa
#格式轉(zhuǎn)換
gffread gencode.v19.annotation.gff3 -T -o gencode.v19.gtf
gffread merged.gtf -o- > merged.gff3
程序非常簡(jiǎn)約肛宋,通過(guò)man gffread
查看使用說(shuō)明
github地址 https://github.com/gpertea/gffread