Whatever I am googling I am not able to find fasta file of each chromosome for hs37d5.fa. hs37d5.fa whole fasta file however is here


Do you know where I can get fasta file for each chromosome for this genome?

  • 2
    $\begingroup$ Is there something stopping you from downloading the entire FASTA and then splitting it? Also, there are quite a few typos in your post making it a little difficult to understand - can you fix those please? Thank you! $\endgroup$
    – Ram RS
    Mar 26, 2019 at 13:53
  • $\begingroup$ @oka I rolled back your edit because it seemed to be introducing almost as many gramatical issues as it was fixing. $\endgroup$
    – terdon
    Mar 26, 2019 at 14:02
  • $\begingroup$ @FereshTeh Sorry, but does your comment have anything to do with the question at hand? $\endgroup$
    – Ram RS
    Mar 26, 2019 at 14:32
  • $\begingroup$ Sorry you right, I deleted my comment $\endgroup$
    – Angel
    Mar 26, 2019 at 14:37

2 Answers 2


Personally, I would download the entire file and split it using something like fastaexplode from the exonerate package. On an Ubuntu machine, you can do that with:

wget ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/technical/reference/phase2_reference_assembly_sequence/hs37d5.fa.gz
gunzip hs37d5.fa.gz
sudo apt install exonerate
fastaexplode hs37d5.fa

Alternatively, you could do this on the fly while downloading:

wget -O - ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/technical/reference/phase2_reference_assembly_sequence/hs37d5.fa.gz | 
  gunzip | awk '/>/{name=$1; sub(/>/,"",name)} {print >> name".fa"}'
  • $\begingroup$ Thank you very much, [fi1d18@cyan01 ~]$ sudo apt install exonerate [sudo] password for fi1d18: So I am not able to install from root, your alternative suggestion gave me all chr fasta, but why you are saying on fly? $\endgroup$
    – Angel
    Mar 26, 2019 at 14:19
  • 1
    $\begingroup$ @FereshTeh yes, you need root access to install software. If you are not running this on your machine, then next time remember to mention that in your question. As for "on the fly", that's because that command downloads the file to standard output, decompresses it as it is coming in and then writes the output to each .fa file, so it is creating the files on the fly. $\endgroup$
    – terdon
    Mar 26, 2019 at 14:21

It is common that reference genomes will be published only as a complete genome, without separate files for each chromosome. Fortunately, a google search for "split fasta by chromosome" will give you many options for downloading a complete genome Fasta file and splitting it by chromosome. The top answer on this biostar thread looks promising.

pip install pyfaidx
pyfaidx -x sequences.fa

Alternatively, I typically use a homebrew Python script. If there are unlocalized/unplaced scaffolds in the file, this will create a bunch of files with ugly unexpected names. These are easy to ignore or delete.

# usage: ./split.py < genome.fasta
from Bio import SeqIO
import sys
reader = SeqIO.parse(sys.stdin, 'fasta')
for record in reader:
    outfile = 'chr{chrid}.fasta'.format(chrid=record.id)
    with open(outfile, 'w') as outstream:
        count = SeqIO.write(record, outstream, 'fasta')

With a little bit of searching, you will find a wealth of helpful information on blogs, forums, and library documentation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.