Please apologies if this has been answered somewhere else, but I couldn't find an answer to this problem.

I would like to retrieve all the predicted coding sequences on the NCBI ftp for a given species. Let's say my interest species today is Stegastes partitus and that I go here. I know how to get all the predicted mRNAs (./RNA/Gnomon_mRNA.fsa) or all the predicted proteins (./protein/protein.fa) but I cannot find how to get the CDS... if ever it's possible? This can be done on the Ensembl FTP.

Thanks for any insight!

EDIT: The output would ideally be a multifasta file like this:

  • 2
    $\begingroup$ One QA site, which specializes on detailed bioinformatics questions is biostars.org $\endgroup$
    – tsttst
    Commented Aug 1, 2016 at 14:18
  • $\begingroup$ I'm downvoting because the readme file already tells you that the GNOMON folder should contain the files you want. $\endgroup$ Commented Aug 8, 2016 at 16:19
  • $\begingroup$ The GNOMON and the GFF folder. As per as the text mining goes, you can use excel and awk...awk is more of a stackoverflow question...but I don't think you are on linux. $\endgroup$ Commented Aug 8, 2016 at 16:26
  • $\begingroup$ @Koustav Pal So you're downvoting because you know the answer? You could at least provide a proper answer ;) Thanks anyway! PS: I'm on Linux, which does not mean I know everything of text mining -- hence my question. $\endgroup$
    – tlorin
    Commented Aug 11, 2016 at 7:57
  • $\begingroup$ My point is, read the readme. I didn't even read the readme, I only did a ctrl+F for CDS and found out that they were inside the GNOMON and GFF folders $\endgroup$ Commented Aug 11, 2016 at 8:01

3 Answers 3


The GNOMON and GFF folder contains the files you want, the GNOMON if you check the README relates to the GNOMON gene predictor and the GFF I think links back to the same file. I think the file you want is ref_Stegastes_partitus-1.0.2_scaffolds.gff3.gz which contains the coordinates on the scaffolds.

And as you stated you are on linux, so the best and geeky way to go is awk.

awk '!/#/{if($3=="CDS")print}' ref_Stegastes_partitus-1.0.2_scaffolds.gff3 > SomeFile.gff3


This part is from python. With reference to the previous user's answer if you fetch the GBK file, rna.gbk, this should allow you to fetch CDS using biopython

You should also check out Peter cook's tutorial on handling genbank files in python

from Bio import SeqIO
from __future__ import print_function

Genome = SeqIO.parse("Examples/rna.gbk","genbank")
handle = open("Examples/rna.faa","w")
for genes in Genome:
    for Feature in genes.features:
        if Feature.type=="CDS":
            i += 1

I would recommend that you install anaconda, it is a package management software, which when installed installs its own python version and alongside it installs some 400 different packages. Instructions are available on the link. So these packages should come with the link.

After you have installed anaconda, put all that code from up there into a Myfile.py and execute on the command line with python Myfile.py.

  • $\begingroup$ I cannot upvote (not enough rep), but +1 anyway. "I would like to retrieve all the predicted coding sequences on the NCBI ftp for a species." --> we're getting closer! :) $\endgroup$
    – tlorin
    Commented Aug 11, 2016 at 8:19
  • $\begingroup$ do you mean any species? $\endgroup$ Commented Aug 11, 2016 at 8:20
  • $\begingroup$ Yes, for instance this one (Stegastes partitus). (See my edit) $\endgroup$
    – tlorin
    Commented Aug 11, 2016 at 9:21
  • $\begingroup$ CDS are a bit different, because this particular annotation is provided with GFF files on the genomic coordinates. And the genomes themselves have many versions in different stages of assembly primarily contig, scaffold, assembled chromosome with unknown chromosomes, but the files should be inside ./GFF/ and the name will change according to version and stage of assembly of the genome the gff file relates to $\endgroup$ Commented Aug 11, 2016 at 9:25
  • $\begingroup$ Ahh so you want the sequences! $\endgroup$ Commented Aug 11, 2016 at 9:26

The RNA folder of your link provides several annotated file formats. These include reference to the CDS for every transcript.


Download and unzip the rna.gbk.gz file and open it. You will see CDS location information for every entry.

  • $\begingroup$ Yes but this does not provide an "easy" access (such as a multifasta file) to all the cds of this species. $\endgroup$
    – tlorin
    Commented Aug 2, 2016 at 9:59
  • $\begingroup$ No, true. That would require some text mining skills, but would be pretty easy for someone that has that expertise, if you had them or knew someone that did. I'm just a hack. $\endgroup$
    – akaDrHouse
    Commented Aug 2, 2016 at 12:32

A web-based way of getting this data:

  1. Go to the NCBI Assembly page: https://www.ncbi.nlm.nih.gov/assembly and search for the species of your interest. Here, the query would be something like "Stegastes partitus"[Organism] which would return only one hit that is the latest reference version of the assembly. Since there is only one hit, you are directed to the 'Full Report' page by default. Click on the link at the top left corner and change the 'Full Report' format to 'Summary'
  2. At this point, you will see a 'Download Assemblies' button. Click on that, choose the data source as RefSeq and file type as 'CDS from genomic' and you are good to go!

You must log in to answer this question.

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