Easiest way to download multiple sequences from NCBI

NCBI and me have shared several tricks to download large set of sequence from database HERE and HERE, respectively. In this post. I am going to share another easy way to download multiple sequences from NCBI. This script will take the file accession list ( one accession number in each line) and download sequence in individual files. Finally, concatenate those files in a single multiline fasta file and delete them.
How to BLAST multiple sequences against NCBI database using PERL script HERE
#!/bin/bash
 
while read i; do curl -s  "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=${i}&rettype=fasta&retmode=txt">$i.fasta; done < id.list

#find . -name '*.fasta' -exec cat {} \; >protein.fas
cat *.fasta >protein.fas
rm *.fasta

No comments:

Post a Comment

Have Problem ?? Drop a comments here!