This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert gff3 to gtf with R or shell

Hi,

I have gff3 file in the following format:

#gff-version 3
##sequence-region   Chromosome 1 <some_number>
#!genome-build European Nucleotide Archive <some_number>
#!genome-version <some_number>
#!genome-date 2014-10
#!genome-build-accession <some_number>
#!genebuild-last-updated 2014-10
Chromosome  European Nucleotide Archive chromosome  1   <some_number>   .   .   ID=chromosome:Chromosome;Alias=<some_number>;Is_circular=true
###
Chromosome  ena gene    16  1000    .   +   .   ID=gene:<gene_name>;Name=<name>;biotype=protein_coding;description=initiator protein<name>;gene_id=<id>;logic_name=ena
Chromosome  ena mRNA    16  1000    .   +   .   ID=transcript:<name>;Parent=gene:AJAP_00005;Name=<name>;biotype=protein_coding;transcript_id=<id>
Chromosome  ena exon    16  1000    .   +   .   Parent=transcript:<name>;Name=<name>;constitutive=1;ensembl_end_phase=0;ensembl_phase=0;exon_id=<id>;rank=1
Chromosome  ena CDS     16  1000    .   +   0   ID=CDS:<name>;Parent=transcript:<name>;protein_id=<id>
###

I have used two ways to convert gff3 to gtf: 1) gffread and 2) gff3ToGenePred and genePredToGtf . Both missed the biotype attribute in the gtf file. I want to include biotype in the gtf file.

Any guidance please.

Thanks.

r ngs shell gff3 gtf

Did you try the option -attrsOut=file with gff3ToGenePred? There you get

output attributes of mRNA record to file. These are per-genePred row, not per-GFF3 record. Thery are derived from GFF3 attributes, not the attributes themselves.

Thanks, but I got with -F option in gffread.

1 answer

Is that an actual gff that you are using or you have modified it before posting here? Did you try -F full GFF attribute preservation (all attributes are shown) in gffread command?

I have modified it before posting, but format is same. :)

No, I did not try that. I used:

gffread -E -O -T input.gff -o output.gtf

You could try -F option that preserves the attributes.

Thank you, it worked. :)

gffread -E -F -O -T input.gff -o output.gtf

Log in to answer this question.