This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Batch download assemblies based on accesion number with shell script

Hello,

is there a rather fast way to download assemblies by only having a list of accession numbers?

Could this be done with a shell script?

Basically, by having this number NC_002695 for Escherichia coli O157:H7 str. Sakai, to download all the protein sequence from for that organism.

genome

1 answer

No shell script needed if you need proteins from just this one genome.

Batch download as in I have more queries. Plural. Not one.

If you need the protein sequence then you can iterate over your list of accession numbers and create links in the format of the link above. The "all" genomes directory is large and it may timeout in a browser. You will have to map your accession numbers to GCF* numbers.

A possible loop can be as simple as

#!/bin/bash

for i in `cat your_accession_number_file.txt`;

do wget ftp://ftp.ncbi.nlm.nih.gov/genomes/all/$i/$i\_protein.faa.gz

done;

Great!

But can there be a way to differentiate between representative and reference genomes?

Okay. But how can I map accession numbers to GCF? That seems a bit tricky.

There is probably a file in there somewhere that has the info. I could not find it easily. If you have the species names then you could try file1 and file2 and get the GCF#.

Thanks! I'll another question about where I can find that file. That would be extremely useful!

Log in to answer this question.