生信基础知识

gff文件转换成gtf文件

2020-11-25  本文已影响0人  生信交流平台

做测序数据分析的时候经常需要将gff格式的注释文件转换成gtf格式的文件。今天小编就给大家介绍一个工具,gffread来实现这个目的。注意这个工具需要在linux或者mac操作系统上运行。

下面是一个gff3格式文件的例子

##gff-version 3
scaffold625  maker  gene  337818  343277  .  +  .  ID=CLUHARG00000005458;Name=TUBB3_2
scaffold625  maker  mRNA  337818  343277  .  +  .  ID=CLUHART00000008717;Parent=CLUHARG00000005458
scaffold625  maker  tss  337916  337918  .  +  .  ID=CLUHART00000008717:tss;Parent=CLUHART00000008717
scaffold625  maker  start_codon  337916  337918  .  +  .  ID=CLUHART00000008717:start;Parent=CLUHART00000008717
scaffold625  maker  CDS  337915  337971  .  +  0  ID=CLUHART00000008717:cds;Parent=CLUHART00000008717
scaffold625  maker  CDS  340733  340841  .  +  0  ID=CLUHART00000008717:cds;Parent=CLUHART00000008717
scaffold625  maker  CDS  341518  341628  .  +  2  ID=CLUHART00000008717:cds;Parent=CLUHART00000008717
scaffold625  maker  CDS  341964  343033  .  +  2  ID=CLUHART00000008717:cds;Parent=CLUHART00000008717
scaffold625  maker  stop_codon  343031  343033  .  +  .  ID=CLUHART00000008717:stop;Parent=CLUHART00000008717
scaffold625  maker  exon  337818  337971  .  +  .  ID=CLUHART00000008717:exon1;Parent=CLUHART00000008717
scaffold625  maker  exon  340733  340841  .  +  .  ID=CLUHART00000008717:exon2;Parent=CLUHART00000008717
scaffold625  maker  exon  341518  341628  .  +  .  ID=CLUHART00000008717:exon3;Parent=CLUHART00000008717
scaffold625  maker  exon  341964  343277  .  +  .  ID=CLUHART00000008717:exon4;Parent=CLUHART00000008717
scaffold625  maker  five_prime_utr  337818  337914  .  +  .  ID=CLUHART00000008717:five_prime_utr;Parent=CLUHART00000008717
scaffold625  maker  three_prime_UTR  343034  343277  .  +  .  ID=CLUHART00000008717:three_prime_utr;Parent=CLUHART00000008717

而gtf格式文件是这样的

##gtf-version 3
scaffold625  maker  gene  337818  343277  .  +  .  gene_id "CLUHARG00000005458"; ID "CLUHARG00000005458"; Name "TUBB3_2";
scaffold625  maker  transcript  337818  343277  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717"; Parent "CLUHARG00000005458"; original_biotype "mrna";
scaffold625  maker  exon  337818  337971  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:exon1"; Parent "CLUHART00000008717";
scaffold625  maker  exon  340733  340841  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:exon2"; Parent "CLUHART00000008717";
scaffold625  maker  exon  341518  341628  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:exon3"; Parent "CLUHART00000008717";
scaffold625  maker  exon  341964  343277  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:exon4"; Parent "CLUHART00000008717";
scaffold625  maker  CDS  337915  337971  .  +  0  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:cds"; Parent "CLUHART00000008717";
scaffold625  maker  CDS  340733  340841  .  +  0  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:cds"; Parent "CLUHART00000008717";
scaffold625  maker  CDS  341518  341628  .  +  2  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:cds"; Parent "CLUHART00000008717";
scaffold625  maker  CDS  341964  343033  .  +  2  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:cds"; Parent "CLUHART00000008717";
scaffold625  maker  five_prime_utr  337818  337914  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:five_prime_utr"; Parent "CLUHART00000008717";
scaffold625  maker  start_codon  337916  337918  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:start"; Parent "CLUHART00000008717";
scaffold625  maker  stop_codon  343031  343033  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:stop"; Parent "CLUHART00000008717";
scaffold625  maker  three_prime_utr  343034  343277  .  +  .  gene_id "CLUHARG00000005458"; transcript_id "CLUHART00000008717"; ID "CLUHART00000008717:three_prime_utr"; Parent "CLUHART00000008717"; original_biotype "three_prime_UTR";

那么如何安装gffread这个工具呢

1.首先安装conda

https://www.anaconda.com/products/individual

可以根据自己的操作系统选择相应的版本

2. 通过conda安装gffread

conda install -c bioconda gffread 

3.格式转换,下面这一条命令就可以将gff3格式的注释文件转换成gtf格式的文件了。

gffread gencode.v19.annotation.gff3 -T -o gencode.v19.gtf

当然也可以将gtf格式的文件转换成gff3格式的文件

gffread gencode.vM13.annotation.gtf -o gencode.vM13.annotation.gff3

gff文件转换成gtf文件

上一篇下一篇

猜你喜欢

热点阅读