you can try:
seq 569913 601959| while read A ; do curl -s "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=DQ${A}&rettype=fasta" ; done
• 71 views
•
link
I have found some reads that I want to download.
They begin at http://www.ncbi.nlm.nih.gov/nuccore/DQ569913 and end at http://www.ncbi.nlm.nih.gov/nuccore/DQ601958
I could get them one by one, but as there are 32000 of them it seems a tad time consuming. Does anyone know how to download the sequences DQ569913 to 601958 automatically?
Thanks
This sloppy Biopython code does the trick:
# -*- coding: utf-8 -*- from Bio import Entrez
Entrez.email = "use@your.real.email.addy.yo"
with open("human_pirna.fa", "w+") as output_file:
for i in range(569913,601959):
handle = Entrez.efetch(db="nuccore", id="DQ{0}".format(i), rettype="gb", retmode="text")
entry = handle.read()
pirna_string = entry.split("ORIGIN")[1].split("1")[1].split("//")[0].replace(" ", "")
output_file.write(">DQ{0}\n".format(i))
print pirna_string
output_file.write(pirna_string)
you can try:
seq 569913 601959| while read A ; do curl -s "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=DQ${A}&rettype=fasta" ; done
Log in to answer this question.
search biostars.org for EUtilities / EFetch .
You can use http://www.ncbi.nlm.nih.gov/Class/PowerTools/eutils/ebot/ebot.cgi to create a perl script.