Skip to content

Instantly share code, notes, and snippets.

@Shaunwei
Last active March 4, 2017 07:50
Show Gist options
  • Save Shaunwei/a62f354ac60f9f255e88eca15894638a to your computer and use it in GitHub Desktop.
Save Shaunwei/a62f354ac60f9f255e88eca15894638a to your computer and use it in GitHub Desktop.
import urllib
def main():
base_url = "https://pubmlst.org/bigsdb?db=pubmlst_saureus_seqdef&page=downloadAlleles&locus="
for number in xrange(1, 2940):
# i.e. SAUR0001
file = "SAUR" + '{:0>4}'.format(number)
filename = file + '.fas'
url = base_url + file
print('Downloading....' + filename)
urllib.urlretrieve(url, filename)
print(filename + ' Downloaded')
print('-----------------')
if __name__ == '__main__':
main()
print('Done!!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment