2
$\begingroup$

I want to convert an hg38 GTF file to bed format using gtf2bed:

gtf2bed Homo_sapiens.GRCh38.106.gtf > Homo_sapiens.GRCh38.106.gtf.bed

It outputs a bed file but it only contains the coordinates for the whole genes and has lost the locations of the exons, UTRs, etc. While I am running gtf2bed, I get thousands of warning like this:

WARNING:root:None   21  33276625    33276753    +   three_prime_utr
WARNING:root:WARNING End is after gene end (33279918 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  33279752    33279918    +   three_prime_utr
WARNING:root:WARNING End is after gene end (33283212 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  33283094    33283212    +   three_prime_utr
WARNING:root:WARNING End is after gene end (37101343 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37100814    37101343    +   transcript
WARNING:root:WARNING End is after gene end (37101343 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37100814    37101343    +   exon
WARNING:root:WARNING End is after gene end (37237744 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37221419    37237744    +   transcript
WARNING:root:WARNING End is after gene end (37221597 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37221419    37221597    +   exon
WARNING:root:WARNING End is after gene end (37237744 > 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37237404    37237744    +   exon

How can I create a bed file that also contains the coordinates of the other genomic features?

$\endgroup$

1 Answer 1

3
$\begingroup$

I cannot reproduce this. Be sure to use the latest version of BEDOPS and to use the correct command:


wget http://ftp.ensembl.org/pub/release-106/gtf/homo_sapiens/Homo_sapiens.GRCh38.106.chr.gtf.gz

gtf2bed < <(zcat Homo_sapiens.GRCh38.106.chr.gtf.gz) > Homo_sapiens.GRCh38.106.chr.bed

$ head Homo_sapiens.GRCh38.106.chr.bed
1       1211339 1214153 ENSG00000186827 .       -       ensembl_havana  gene    .       gene_id "ENSG00000186827"; gene_version "11"; gene_name "TNFRSF4"; gene_source "ensembl_havana"; gene_biotype "protein_coding";
1       1211339 1214153 ENSG00000186827 .       -       ensembl_havana  transcript      .       gene_id "ENSG00000186827"; gene_version "11"; transcript_id "ENST00000379236"; transcript_version "4"; gene_name "TNFRSF4"; gene_source "ensembl_havana"; gene_biotype "protein_coding"; transcript_name "TNFRSF4-201"; transcript_source "ensembl_havana"; transcript_biotype "protein_coding"; tag "CCDS"; ccds_id "CCDS11"; tag "basic"; transcript_support_level "1 (assigned to previous version 3)";
1       1213982 1214153 ENSG00000186827 .       -       ensembl_havana  exon    .       gene_id "ENSG00000186827"; gene_version "11"; transcript_id "ENST00000379236"; transcript_version "4"; exon_number "1"; gene_name "TNFRSF4"; gene_source "ensembl_havana"; gene_biotype "protein_coding"; transcript_name "TNFRSF4-201"; transcript_source "ensembl_havana"; transcript_biotype "protein_coding"; tag "CCDS"; ccds_id "CCDS11"; exon_id "ENSE00001832731"; exon_version "2"; tag "basic"; transcript_support_level "1 (assigned to previous version 3)";
1       1213982 1214127 ENSG00000186827 .       -       ensembl_havana  CDS     0       gene_id "ENSG00000186827"; gene_version "11"; transcript_id "ENST00000379236"; transcript_version "4"; exon_number "1"; gene_name "TNFRSF4"; gene_source "ensembl_havana"; gene_biotype "protein_coding"; transcript_name "TNFRSF4-201"; transcript_source "ensembl_havana"; transcript_biotype "protein_coding"; tag "CCDS"; ccds_id "CCDS11"; protein_id "ENSP00000368538"; protein_version "3"; tag "basic"; transcript_support_level "1 (assigned to previous version 3)";
1       1214124 1214127 ENSG00000186827 .       -       ensembl_havana  start_codon     0       gene_id "ENSG00000186827"; gene_version "11"; transcript_id "ENST00000379236"; transcript_version "4"; exon_number "1"; gene_name "TNFRSF4"; gene_source "ensembl_havana"; gene_biotype "protein_coding"; transcript_name "TNFRSF4-201"; transcript_source "ensembl_havana"; transcript_biotype "protein_coding"; tag "CCDS"; ccds_id "CCDS11"; tag "basic"; transcript_support_level "1 (assigned to previous version 3)";

Finishes without any of the mentioned warnings.

$\endgroup$
1
  • $\begingroup$ Thanks! I did not know I should have run it as follows: gtf2bed < Homo_sapiens.GRCh38.106.gtf > Homo_sapiens.GRCh38.106.gtf.bed $\endgroup$ Jun 15, 2022 at 14:57

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .