5
$\begingroup$

I have following accession numbers of the 10 chromosomes of Theobroma cacao genome.

NC_030850.1
NC_030851.1
NC_030852.1
NC_030853.1
NC_030854.1
NC_030855.1
NC_030856.1
NC_030857.1
NC_030858.1
NC_030859.1

I need to download these FASTA files using the terminal because I'm working on a server. I'll be grateful if someone can help me. Thank you.

$\endgroup$
6
$\begingroup$

Alternatively, you can use the NCBI Entrez Direct UNIX E-utilities

Basically, you have to download the install file here: https://www.ncbi.nlm.nih.gov/books/NBK179288/bin/install-edirect.sh

In the terminal, install it using: source ./install-edirect.sh

Then, you can download your sequence by doing:

esearch -db nucleotide -query "NC_030850.1" | efetch -format fasta > NC_030850.1.fasta

And you should find your fasta sequence downloaded.

As you have several sequences to download, I think it will be quite easy to add this command into a little bash script to process all of them.

More readings about that: http://bioinformatics.cvr.ac.uk/blog/ncbi-entrez-direct-unix-e-utilities/ and https://www.ncbi.nlm.nih.gov/books/NBK179288/

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much for all the support. $\endgroup$ – MudithMMBc Nov 13 '19 at 18:02
  • $\begingroup$ @MudithMMBc, you're welcome ;) $\endgroup$ – dc37 Nov 13 '19 at 18:49
4
$\begingroup$

Just wget or curl each as https://www.ncbi.nlm.nih.gov/nuccore/NC_030853.1?report=fasta&log$=seqview&format=text...

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much. $\endgroup$ – MudithMMBc Nov 13 '19 at 18:02
2
$\begingroup$

Downloading entire genomes

The best way to download FASTA sequences for an entire genome is to search for the genome, for example Theobroma cacao genome in the NCBI Assembly portal and use the big blue Download button. enter image description here

Downloading individual chromosomes

For a given assembly, if you want to download the FASTA sequences for a bunch of chromosomes, you can do that by going to the Genomes FTP path highlighted in the screenshot: enter image description here Once you are in the Genomes FTP path, you can navigate to the FASTA folder as follows: Theobroma FTP directory >> Assembly Structure >> Primary Assembly >> Assembled Chromosomes >> FASTA.

Downloading a few sequences

For this, you can use Entrez Direct as mentioned by @dc37. Why not always use Entrez Direct? While it is fine for a small number of sequences, it can be slow to download a large number of sequences. Entrez Direct by default will download uncompressed data so you will end up spending more time downloading a larger file instead of downloading a smaller, compressed file from FTP more quickly.

If you were to use Entrez Direct for this purpose, I'd not bother with a bash script and use epost to first post the entire list of accessions and then pipe it to efetch as shown below:

epost -db nuccore -input <file_with_accs> -format acc \
  | efetch -format fasta > sequences.fasta
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much for all the support. $\endgroup$ – MudithMMBc Nov 13 '19 at 18:02
2
$\begingroup$
  1. Go to the main FASTA sequence page, view source, and get the "ncbi_uidlist" value. In this case, it's 1061361601
  2. Use the ID in the query string to download directly:

    https://www.ncbi.nlm.nih.gov/sviewer/viewer.fcgi?id=1061361601&db=nuccore&report=fasta&retmode=text&withmarkup=on&tool=portal&log$=seqview&maxdownloadsize=100000000

You can also get this link directly, by using Chrome's developer tools (F12), viewing the Network tab, then loading the page in (1).

| improve this answer | |
$\endgroup$
0
$\begingroup$

(Sorry, I can't post a comment with my reputation score). @vkkodali, interesting command I did not know about it ;). However, your command is downloading all sequences from the input file into a single fasta file. I believe that if you have a big bunch of sequences, it could be a little bit tricky after to manipulate that kind of file. Just by curiosity, do you have a trick to create one sequence per file using efetch ?

| improve this answer | |
$\endgroup$
  • $\begingroup$ If you have a big bunch of sequences, you will end up with a lot of files. Whether you want a large number of files or just one file is, I guess, a personal choice. A multifasta file is fairly standard though. I don't think you can create individual files for each sequence using epost and efetch; you will have to either use a bash script or postprocess the efetch output using the unix tool split. $\endgroup$ – vkkodali Nov 8 '19 at 2:28
  • $\begingroup$ Ok, I understand it. Thanks for your thoughts ;) $\endgroup$ – dc37 Nov 8 '19 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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