<p>I cannot reproduce this. Be sure to use the latest version of <a href="https://bedops.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer">BEDOPS</a> and to use the correct command:</p>
<pre class="lang-bash prettyprint-override"><code>
wget http://ftp.ensembl.org/pub/release-106/gtf/homo_sapiens/Homo_sapiens.GRCh38.106.chr.gtf.gz

gtf2bed &lt; &lt;(zcat Homo_sapiens.GRCh38.106.chr.gtf.gz) &gt; Homo_sapiens.GRCh38.106.chr.bed

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

</code></pre>
<p>Finishes without any of the mentioned warnings.</p>

CC BY-SA 4.0
2022-06-15T14:57:54.530Z
Thanks! I did not know I should have run it as follows: `gtf2bed < Homo_sapiens.GRCh38.106.gtf > Homo_sapiens.GRCh38.106.gtf.bed`
justinian482
CC BY-SA 4.0
2022-06-15T14:07:20.397Z
2022-06-15T14:07:20.397Z
Tired Spoon
<p>I want to convert an hg38 <a href="http://ftp.ensembl.org/pub/release-106/gtf/homo_sapiens/Homo_sapiens.GRCh38.106.chr.gtf.gz" rel="nofollow noreferrer">GTF file</a> to bed format using <code>gtf2bed</code>:</p>
<pre><code>gtf2bed Homo_sapiens.GRCh38.106.gtf &gt; Homo_sapiens.GRCh38.106.gtf.bed
</code></pre>
<p>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 <code>gtf2bed</code>, I get thousands of warning like this:</p>
<pre><code>WARNING:root:None   21  33276625    33276753    +   three_prime_utr
WARNING:root:WARNING End is after gene end (33279918 &gt; 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 &gt; 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 &gt; 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 &gt; 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 &gt; 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 &gt; 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 &gt; 0)
WARNING:root:WARNING Start is after gene end
WARNING:root:None   21  37237404    37237744    +   exon

</code></pre>
<p>How can I create a bed file that also contains the coordinates of the other genomic features?</p>

<bed><gtf><gffutils>
gtf2bed only retains gene information
# gtf2bed only retains gene information

(Asked by: username_0 on 2022-06-15)

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?

**Tags:** bed, gtf, gffutils

---

## 1 answers

### Answer by username_1 on 2022-06-15. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_0**: Thanks! I did not know I should have run it as follows: `gtf2bed < Homo_sapiens.GRCh38.106.gtf > Homo_sapiens.GRCh38.106.gtf.bed`  

---

