<p>While I haven't found a way to limit the results to the canonical transcript only, you can get a list of genes, transcripts and their CDS lengths using Ensemble's BioMart. I have already set it up for you, you can see the results, and modify them, <a href="http://www.ensembl.org/biomart/martview/7bd5b4f80f2c922856260b66fd9587fa?VIRTUALSCHEMANAME=default&amp;ATTRIBUTES=hsapiens_gene_ensembl.default.structure.ensembl_gene_id|hsapiens_gene_ensembl.default.structure.ensembl_transcript_id|hsapiens_gene_ensembl.default.structure.cds_length&amp;FILTERS=hsapiens_gene_ensembl.default.filters.transcript_biotype.&quot;protein_coding&quot;|hsapiens_gene_ensembl.default.filters.biotype.&quot;protein_coding&quot;&amp;VISIBLEPANEL=resultspanel" rel="nofollow noreferrer">here</a> (click on the "Results" link if you don't see them). </p>

<p>Essentially, you just need to go to <a href="http://www.ensembl.org/biomart/martview" rel="nofollow noreferrer">BioMart</a>, and </p>

<ol>
<li><p>select "Ensembl Genes 96" (the number will change if the version changes) as the database and "uman Genes" as the dataset.</p></li>
<li><p>Click on "Filters", and set <code>Gene type</code> to <code>coding</code> and <code>Transcript type</code> to <code>protein_coding</code>.</p></li>
<li><p>From "Attributes", select whatever you want to see. The "CDS Length" is under "Structures".</p></li>
</ol>

CC BY-SA 4.0
2019-04-30T15:48:34.807Z
2019-04-30T22:23:43.663Z
2019-04-30T22:23:43.663Z
terdon
<p>Go to the <a href="https://www.ncbi.nlm.nih.gov" rel="nofollow noreferrer">NCBI homepage</a> and search for 'human genome' (the dropdown menu on the left-hand side of the search box should be 'All Databases'). In the <a href="https://www.ncbi.nlm.nih.gov/search/all/?term=human%20genome" rel="nofollow noreferrer">result page</a>, click on the 'Download' button; choose 'RefSeq' as the 'Source database' and 'Feature table' as the 'File type' as shown in the screenshot below:</p>

<p><img src="https://i.sstatic.net/f4nwL.png" width="400"></p>

<p>This will download a <code>genome_assemblies.tar</code> file which contains the feature table file, <code>GCF_000001405.39_GRCh38.p13_feature_table.txt.gz</code>. This file has all of the annotated features in a tab-delimited format with the following fields: </p>

<pre><code>              # feature [  1]: gene
                  class [  2]: transcribed_pseudogene
               assembly [  3]: GCF_000001405.39
          assembly_unit [  4]: Primary Assembly
               seq_type [  5]: chromosome
             chromosome [  6]: 1
      genomic_accession [  7]: NC_000001.11
                  start [  8]: 11874
                    end [  9]: 14409
                 strand [ 10]: +
      product_accession [ 11]: 
   non-redundant_refseq [ 12]: 
      related_accession [ 13]: 
                   name [ 14]: DEAD/H-box helicase 11 like 1
                 symbol [ 15]: DDX11L1
                 GeneID [ 16]: 100287102
              locus_tag [ 17]: 
feature_interval_length [ 18]: 2536
         product_length [ 19]: 
             attributes [ 20]: pseudo
</code></pre>

<p>You can parse this file to obtain the CDS lengths of all annotated proteins. As an example, you can get a list of all annotated RefSeq proteins and their lengths as follows: </p>

<pre><code>zcat GCF_000001405.39_GRCh38.p13_feature_table.txt.gz \
    | awk 'BEGIN{FS="\t";OFS="\t"}(<span class="math-container">$1~/^#/ || $</span>1=="CDS")' \
    | cut -f6-11,13,15,16,18,19
</code></pre>

<p>The output of the above command will have the following fields: </p>

<pre><code>             chromosome [  1]: 1
      genomic_accession [  2]: NC_000001.11
                  start [  3]: 69091
                    end [  4]: 70008
                 strand [  5]: +
      product_accession [  6]: NP_001005484.1
      related_accession [  7]: NM_001005484.1
                 symbol [  8]: OR4F5
                 GeneID [  9]: 79501
feature_interval_length [ 10]: 918
         product_length [ 11]: 305
</code></pre>

CC BY-SA 4.0
2019-11-02T00:48:39.777Z
2019-11-02T00:48:39.777Z
vkkodali
<p>Ensembl has an FTP site that allows you to select and download only the coding sequences from many different genomes.
<a href="https://useast.ensembl.org/info/data/ftp/index.html" rel="nofollow noreferrer">https://useast.ensembl.org/info/data/ftp/index.html</a></p>

<p>To determine the length of those sequences, download the associated gtf or gff3 annotation file. The annotation file is tab delim. The fourth and fifth column represent genomic loci of the annotated region. Subtract the amount in the fourth column from the amount in the fifth column to yield the length of all the annotated features.
You can easily do this in R after loading the file in the environment using the Magrittr library. The following code will create a new column called gene_length with the associated gene lengths.</p>

<pre><code>install.packages("magrittr")
# this only needs to be done once
library(magrittr)
# must be run each time the library is neaded
annotation.gtf &lt;- read.table("path/to/annotation.gtf")
annotation.gtf$start &lt;- annotation.gtf[,4]
annotation.gtf$end &lt;- annotation.gtf[,5]
annotation.new-column.gtf &lt;- annotation.gtf %&gt;%
          mutate(gene_length=end-start)
</code></pre>

CC BY-SA 4.0
2019-05-01T11:33:31.283Z
2019-05-01T13:03:03.197Z
2019-05-01T13:03:03.197Z
Andrew Judell
<p>Does anyone know where and how could I download a list of all human genes and the length of the coding sequence for each gene? Is it possible to do this on the NCBI site, ensembl?</p>

CC BY-SA 4.0
2019-04-30T14:54:39.530Z
Which coding sequence? I mean, do you just want whichever has been designated the 'canonical' transcript or do you want all possible isoforms?
terdon
CC BY-SA 4.0
2019-04-30T14:56:57.993Z
Hi terdon, thanks for the quick reply! Yes exactly, the canonical transcript is good enough!
solimanelefant
CC BY-SA 4.0
2019-05-01T07:53:01.173Z
Michael G. suggests to take a look at relevant front-end, NCBI's eFetch. Which is supposedly perfect for what you need.
Kamil S Jaron
<gene><sequence-analysis><phylogenetics><ensembl>
CDS length for each human gene
# CDS length for each human gene

(Asked by: username_0 on 2019-04-30)

Does anyone know where and how could I download a list of all human genes and the length of the coding sequence for each gene? Is it possible to do this on the NCBI site, ensembl?

**Tags:** gene, sequence-analysis, phylogenetics, ensembl
> **Comments:**
> **username_1**: Which coding sequence? I mean, do you just want whichever has been designated the 'canonical' transcript or do you want all possible isoforms?  
> **username_0**: Hi terdon, thanks for the quick reply! Yes exactly, the canonical transcript is good enough!  
> **username_2**: Michael G. suggests to take a look at relevant front-end, NCBI's eFetch. Which is supposedly perfect for what you need.  

---

## 3 answers

### Answer by username_1 on 2019-04-30. Score: 4 | Accepted answer

While I haven't found a way to limit the results to the canonical transcript only, you can get a list of genes, transcripts and their CDS lengths using Ensemble's BioMart. I have already set it up for you, you can see the results, and modify them, [here](http://www.ensembl.org/biomart/martview/7bd5b4f80f2c922856260b66fd9587fa?VIRTUALSCHEMANAME=default&ATTRIBUTES=hsapiens_gene_ensembl.default.structure.ensembl_gene_id|hsapiens_gene_ensembl.default.structure.ensembl_transcript_id|hsapiens_gene_ensembl.default.structure.cds_length&FILTERS=hsapiens_gene_ensembl.default.filters.transcript_biotype.) (click on the "Results" link if you don't see them).

Essentially, you just need to go to [BioMart](http://www.ensembl.org/biomart/martview), and

1. select "Ensembl Genes 96" (the number will change if the version changes) as the database and "uman Genes" as the dataset.
2. Click on "Filters", and set `Gene type` to `coding` and `Transcript type` to `protein_coding`.
3. From "Attributes", select whatever you want to see. The "CDS Length" is under "Structures".


---

### Answer by username_3 on 2019-11-02. Score: 0

Go to the NCBI homepage and search for 'human genome' (the dropdown menu on the left-hand side of the search box should be 'All Databases'). In the result page, click on the 'Download' button; choose 'RefSeq' as the 'Source database' and 'Feature table' as the 'File type' as shown in the screenshot below:

This will download a genome_assemblies.tar file which contains the feature table file, GCF_000001405.39_GRCh38.p13_feature_table.txt.gz. This file has all of the annotated features in a tab-delimited format with the following fields: 
              # feature [  1]: gene
                  class [  2]: transcribed_pseudogene
               assembly [  3]: GCF_000001405.39
          assembly_unit [  4]: Primary Assembly
               seq_type [  5]: chromosome
             chromosome [  6]: 1
      genomic_accession [  7]: NC_000001.11
                  start [  8]: 11874
                    end [  9]: 14409
                 strand [ 10]: +
      product_accession [ 11]: 
   non-redundant_refseq [ 12]: 
      related_accession [ 13]: 
                   name [ 14]: DEAD/H-box helicase 11 like 1
                 symbol [ 15]: DDX11L1
                 GeneID [ 16]: 100287102
              locus_tag [ 17]: 
feature_interval_length [ 18]: 2536
         product_length [ 19]: 
             attributes [ 20]: pseudo

You can parse this file to obtain the CDS lengths of all annotated proteins. As an example, you can get a list of all annotated RefSeq proteins and their lengths as follows: 
zcat GCF_000001405.39_GRCh38.p13_feature_table.txt.gz \
    | awk 'BEGIN{FS="\t";OFS="\t"}($1~/^#/ || $1=="CDS")' \
    | cut -f6-11,13,15,16,18,19

The output of the above command will have the following fields: 
             chromosome [  1]: 1
      genomic_accession [  2]: NC_000001.11
                  start [  3]: 69091
                    end [  4]: 70008
                 strand [  5]: +
      product_accession [  6]: NP_001005484.1
      related_accession [  7]: NM_001005484.1
                 symbol [  8]: OR4F5
                 GeneID [  9]: 79501
feature_interval_length [ 10]: 918
         product_length [ 11]: 305


---

### Answer by username_4 on 2019-05-01. Score: 0

Ensembl has an FTP site that allows you to select and download only the coding sequences from many different genomes.
https://useast.ensembl.org/info/data/ftp/index.html
To determine the length of those sequences, download the associated gtf or gff3 annotation file. The annotation file is tab delim. The fourth and fifth column represent genomic loci of the annotated region. Subtract the amount in the fourth column from the amount in the fifth column to yield the length of all the annotated features.
You can easily do this in R after loading the file in the environment using the Magrittr library. The following code will create a new column called gene_length with the associated gene lengths.
install.packages("magrittr")
# this only needs to be done once
library(magrittr)
# must be run each time the library is neaded
annotation.gtf <- read.table("path/to/annotation.gtf")
annotation.gtf$start <- annotation.gtf[,4]
annotation.gtf$end <- annotation.gtf[,5]
annotation.new-column.gtf <- annotation.gtf %>%
          mutate(gene_length=end-start)


---

