Last active
February 24, 2023 17:39
-
-
Save MartinEls/70751345ec55893cf6cffffa8591ca35 to your computer and use it in GitHub Desktop.
ZINC20 download
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 os | |
import requests | |
from tqdm import tqdm | |
def download(zinc20_url): | |
tranch = (zinc20_url.split('/')[-1]).split('.')[0] | |
r = requests.get(zinc20_url.strip()) | |
with open('all_tranches/' + tranch + '.tsv', 'wb') as f: | |
f.write(r.content) | |
if __name__ == '__main__': | |
with open('ZINC-downloader-2D-txt.uri', 'r') as f: | |
urls = f.readlines() | |
for url in tqdm(urls): | |
try: | |
download(url) | |
except: | |
print(f'Downloading from {url} failed') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment