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?
Bioinformatics Stack Exchange is a question and answer site for researchers, developers, students, teachers, and end users interested in bioinformatics. It only takes a minute to sign up.
Sign up to join this communityWhatever 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?
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"}'
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.