This repository has been archived by the owner on Dec 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 855
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added gitignore * Updated README * Simplified and optimized parsing DoFn * Updated versions * Added copyright * Added --region option * Updated README * Updated, cleanup and made Python 3 compatible
- Loading branch information
Showing
17 changed files
with
421 additions
and
217 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Copyright 2018 Google Inc. All Rights Reserved. Licensed under the Apache | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2019 Google Inc. All Rights Reserved. Licensed under the Apache | ||
# License, Version 2.0 (the "License"); you may not use this file except in | ||
# compliance with the License. You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
@@ -11,7 +13,8 @@ | |
|
||
# This tool downloads SDF files from an FTP source. | ||
|
||
import StringIO | ||
from __future__ import absolute_import | ||
|
||
import argparse | ||
import ftplib | ||
import multiprocessing as mp | ||
|
@@ -21,6 +24,7 @@ | |
import tempfile | ||
import tensorflow as tf | ||
import zlib | ||
from io import BytesIO | ||
|
||
|
||
# Regular expressions to parse an FTP URI. | ||
|
@@ -71,7 +75,7 @@ def extract_data_file(ftp_file, data_dir): | |
if not tf.gfile.Exists(sdf_file): | ||
# The `ftp` object cannot be pickled for multithreading, so we open a | ||
# new connection here | ||
memfile = StringIO.StringIO() | ||
memfile = BytesIO() | ||
ftp = ftplib.FTP(server, user, password) | ||
ftp.retrbinary('RETR ' + path, memfile.write) | ||
ftp.quit() | ||
|
@@ -132,15 +136,12 @@ def run(data_sources, filter_regex, max_data_files, data_dir): | |
|
||
parser.add_argument( | ||
'--work-dir', | ||
type=str, | ||
default=os.path.join( | ||
tempfile.gettempdir(), 'cloudml-samples', 'molecules'), | ||
required=True, | ||
help='Directory for staging and working files. ' | ||
'This can be a Google Cloud Storage path.') | ||
|
||
parser.add_argument( | ||
'--data-sources', | ||
type=str, | ||
nargs='+', | ||
default=['ftp://anonymous:[email protected]/' | ||
'pubchem/Compound_3D/01_conf_per_cmpd/SDF'], | ||
|
@@ -152,7 +153,6 @@ def run(data_sources, filter_regex, max_data_files, data_dir): | |
|
||
parser.add_argument( | ||
'--filter-regex', | ||
type=str, | ||
default=r'\.sdf', | ||
help='Regular expression to filter which files to use. ' | ||
'The regular expression will be searched on the full absolute path. ' | ||
|
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
Oops, something went wrong.