Blank output When converting GFF3 file to GTF using either gffread or AGAT
1
0
Entering edit mode
3.2 years ago
VenGeno ▴ 100

Hi,

I am trying to convert gff3 file (please see below) to GTF. I used two tools suggested here gffread and agat here.

#gff-version 3
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    1   1345    .   +   .   ID=gene_1;Name=Os01g0293800 gene;coverage=0.997;sequence_ID=0.982;extra_copy_number=0;copy_num_ID=gene_1_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    1623    3128    .   -   .   ID=gene_6;Name=Os01g0293900 gene;coverage=0.999;sequence_ID=0.968;extra_copy_number=0;copy_num_ID=gene_6_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    20379   21605   .   -   .   ID=gene_7;Name=Os01g0294500 gene;coverage=0.999;sequence_ID=0.995;extra_copy_number=0;copy_num_ID=gene_7_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    48673   50214   .   -   .   ID=gene_5;Name=Os01g0294700 gene;coverage=1.0;sequence_ID=0.995;extra_copy_number=0;copy_num_ID=gene_5_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    102125  104501  .   -   .   ID=gene_4;Name=Os01g0295600 gene;coverage=1.0;sequence_ID=0.992;extra_copy_number=0;copy_num_ID=gene_4_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    105502  108051  .   -   .   ID=gene_3;Name=Os01g0295700 gene;coverage=0.996;sequence_ID=0.991;extra_copy_number=0;copy_num_ID=gene_3_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    114102  118497  .   -   .   ID=gene_2;Name=Os01g0295900 gene;coverage=1.0;sequence_ID=0.997;extra_copy_number=0;copy_num_ID=gene_2_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    119424  122381  .   -   .   ID=gene_21;Name=Os01g0296000 gene;coverage=1.0;sequence_ID=0.995;extra_copy_number=0;copy_num_ID=gene_21_0
    Bg_94-1_CX35|chr01_10700000_16500000    Liftoff gene    122555  127107  .   +   .   ID=gene_14;Name=Os01g0296100 gene;coverage=0.996;sequence_ID=0.992;extra_copy_number=0;copy_num_ID=gene_14_0

I was using following commands; AGAT-

agat_convert_sp_gff2gtf.pl --gff genes.gff -o genes.gtf

gffread-

gffread -E -F -O -T genes.gff -o genes.gtf

Both giving me an empty output (AGAT just retrive # comment). Can someone help me in this regard? Thank you!

agat gffread conversion • 2.2k views
ADD COMMENT
1
Entering edit mode

Juke's suggestion below with AGAT is better, so I post this sed fix merely because I had it ready

sed -e "s/ID/gene_id/" -e "s/=/ \"/g" -e "s/;/\";/g" -e "s/$/\"/" <genes.gff > genes.gtf
ADD REPLY
0
Entering edit mode

Thank you for the command!

ADD REPLY
0
Entering edit mode

Keep in mind that this converts an ill formed GFF to an ill formed GTF. Juke34's first solution from below can save you some downstream trouble as AGAT handles, validates and fixes so much more. Set urgency aside, I'd rather look look into that than my hackish sed command

ADD REPLY
3
Entering edit mode
3.2 years ago
Juke34 8.9k

AGAT removes gene features because they are supposed to have some other features linked to it e.g. mRNA,exon,CDS,UTR. You can check what type of feature you have in your file like that:

awk '{print $3}' myfile.gff | sort -u

First solution, better if you have only gene feature type (3rd column), you can replace the gene feature type from 3rd column by exon using sed or awk command. Then running AGAT it will create RNA and gene features.

Otherwise you can modify the features_level1.json file like that

"gene":"3",

by

"gene":"standalone",

It modifies the default behaviour to say AGAT that it is fine if the gene feature does not have any child feature. To access the features_level1.json you need to run this command: agat_convert_sp_gxf2gxf.pl --expose. It will be copied into your current directory. Then if you run a command from the current directory, AGAT will use that .json file(s) instead of the one(s) by default.

ADD COMMENT
0
Entering edit mode

Thank you, Jacques! I went with the last option. When I tried to use --expose it gave me fileparse(): need a valid pathname at /Users/venura/miniconda3/bin/agat_convert_sp_gxf2gxf.pl line 89 Given the urgency, I manually copied the file to my working directory and got my file converted. Have a great day!

ADD REPLY
1
Entering edit mode

Thank you for the feedback. I will fix that for a next release

ADD REPLY

Login before adding your answer.

Traffic: 2582 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6