NGS基因组

#GTF/GFF格式# gffread入门使用

2018-10-10  本文已影响767人  土豆_leah

首先了解一下GTF/GFF的格式
https://asia.ensembl.org/info/website/upload/gff.html
两者的关系如下

GTF (gene transfer format) is identical to GFF (general feature format) version 2

  1. 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编号)
  2. source - name of the program that generated this feature, or the data source (database or project name) (注释的来源,如果未知用.代替)
  3. type - type of feature. Must be a term or accession from the SOFA sequence ontology (注释信息的类型,比如Gene、cDNA、mRNA、CDS等)
  4. start - Start position of the feature, with sequence numbering starting at 1.
  5. end - End position of the feature, with sequence numbering starting at 1.
  6. score - A floating point value. (序列相似性比对时的E-values值或者基因预测是的P-values值,“.”表示为空)
  7. strand - defined as + (forward) or - (reverse).(正反义链)
  8. 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类型中指出该值,值为CDS的起始位置,除以3得到的余数)
  9. 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. (以多个键值对组成的注释信息描述,键与值之间用“=”,不同的键值用“;)

安装如下:

  cd /some/build/dir
  git clone https://github.com/gpertea/gclib
  git clone https://github.com/gpertea/gffread
  cd gffread
  make

程序是c++编写的因此并不需要预装一些包,当然也可以使用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分别解压,并合并下载内容获得hg19.fa
cat *.fa >hg19.fa
#根据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
#格式转换
gffread gencode.v19.annotation.gff3 -T -o gencode.v19.gtf
gffread merged.gtf -o- > merged.gff3

程序非常简约,通过man gffread查看使用说明
github地址 https://github.com/gpertea/gffread

上一篇下一篇

猜你喜欢

热点阅读