Last active
March 4, 2017 07:50
-
-
Save Shaunwei/a62f354ac60f9f255e88eca15894638a to your computer and use it in GitHub Desktop.
Download files from https://pubmlst.org/bigsdb?db=pubmlst_saureus_seqdef&page=downloadAlleles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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