This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Automatic download for large quantity of genes for Metagenome database creation

I need to create a database of 400 different genes for my simulated metagenome, but it takes too much time to download one by one. So, is there any form to download then all at once or any tool to download them for me?

sequence genes

You are referring to genomes in the title of this post but then genes in the body. Which of the two is it since the answer would change based on that critical information.

1 answer

Using NCBI eUtils. Change the gene name as needed.

esearch -db gene -query "dnaK" | efilter -organism bacteria | efetch -format docsum | xtract -pattern GenomicInfoType -element ChrAccVer ChrStart ChrStop | xargs -n 3 sh -c 'efetch -db nuccore -format fasta  -id "$0" -chr_start "$1" -chr_stop "$2"' > dnaK_seq.fa

Sequences truncated for brevity.

>NC_017448.1:c213043-211142 Fibrobacter succinogenes subsp. succinogenes S85, complete genome
ATGGGTAAGATTATTGGTATTGACTTGGGTACGACAAACAGCTGCGTTGCCGTGATGGAAGGTGGCAAGC
CGGTCGTCATCGCCAATGCAGAAGGTTTCCGCACCACGCCGTCTATTGTCGCTTTCGGCAAGAACGGTGA
>NC_016610.1:c2966116-2965736 Tannerella forsythia 92A2, complete genome
ATGGCTGAGAAGACAAGATACTCGGATGCGGAGCTGGAAGAATTTCGCGCCATTATCATGGAGAAGCTCG
ATAAGGCAAAGAAAGATTACGACTTGTTGAGATCGGGGATTACGAATGCCGACGGCAACGACGTTTCCGA

Log in to answer this question.