Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove download delaney #369

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions atomsci/ddm/test/integrative/delaney_NN/download_dataset.sh

This file was deleted.

13 changes: 2 additions & 11 deletions atomsci/ddm/test/integrative/delaney_NN/test_delaney_NN.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ def curate():
assert(os.path.isfile('delaney-processed_curated_external.csv'))


def download():
"""Separate download function so that download can be run separately if there is no internet."""
if (not os.path.isfile('delaney-processed.csv')):
integrative_utilities.download_save(
'https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/delaney-processed.csv', 'delaney-processed.csv')

assert(os.path.isfile('delaney-processed.csv'))


def test():
"""Test full model pipeline: Curate data, fit model, and predict property for new compounds"""

Expand All @@ -82,9 +73,9 @@ def test():
integrative_utilities.clean_fit_predict()
clean()

# Download
# Copy Data
# --------
download()
integrative_utilities.copy_delaney()

# Curate
# ------
Expand Down

This file was deleted.

14 changes: 2 additions & 12 deletions atomsci/ddm/test/integrative/delaney_Panel/test_delaney_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ def H1_double_curate():
assert (os.path.isfile('H1_double_curated_external.csv'))
assert (os.path.isfile('H1_double_curated_fit_train_valid_test_scaffold_002251a2-83f8-4511-acf5-e8bbc5f86677.csv'))


def download():
"""Separate download function so that download can be run separately if there is no internet."""
if (not os.path.isfile('delaney-processed.csv')):
integrative_utilities.download_save(
'https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/delaney-processed.csv',
'delaney-processed.csv')

assert (os.path.isfile('delaney-processed.csv'))

def train_and_predict(train_json_f, prefix='delaney-processed'):
# Train model
# -----------
Expand Down Expand Up @@ -245,9 +235,9 @@ def init():
integrative_utilities.clean_fit_predict()
clean()

# Download
# Copy Data
# --------
download()
integrative_utilities.copy_delaney()

# Curate
# ------
Expand Down
3 changes: 0 additions & 3 deletions atomsci/ddm/test/integrative/delaney_RF/download_dataset.sh

This file was deleted.

14 changes: 2 additions & 12 deletions atomsci/ddm/test/integrative/delaney_RF/test_delaney_RF.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ def curate():
assert (os.path.isfile('delaney-processed_curated_external.csv'))


def download():
"""Separate download function so that download can be run separately if there is no internet."""
if (not os.path.isfile('delaney-processed.csv')):
integrative_utilities.download_save(
'https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/delaney-processed.csv',
'delaney-processed.csv')

assert (os.path.isfile('delaney-processed.csv'))


def test():
"""Test full model pipeline: Curate data, fit model, and predict property for new compounds"""

Expand All @@ -81,9 +71,9 @@ def test():
integrative_utilities.clean_fit_predict()
clean()

# Download
# Copy Data
# --------
download()
integrative_utilities.copy_delaney()

# Curate
# ------
Expand Down
3 changes: 0 additions & 3 deletions atomsci/ddm/test/integrative/delaney_XGB/download_dataset.sh

This file was deleted.

14 changes: 2 additions & 12 deletions atomsci/ddm/test/integrative/delaney_XGB/test_delaney_XGB.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ def curate():
assert (os.path.isfile('delaney-processed_curated_external.csv'))


def download():
"""Separate download function so that download can be run separately if there is no internet."""
if (not os.path.isfile('delaney-processed.csv')):
integrative_utilities.download_save(
'https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/delaney-processed.csv',
'delaney-processed.csv')

assert (os.path.isfile('delaney-processed.csv'))


def test():
"""Test full model pipeline: Curate data, fit model, and predict property for new compounds"""

Expand All @@ -82,9 +72,9 @@ def test():
integrative_utilities.clean_fit_predict()
clean()

# Download
# Copy Data
# --------
download()
integrative_utilities.copy_delaney()

# Curate
# ------
Expand Down
35 changes: 12 additions & 23 deletions atomsci/ddm/test/integrative/integrative_utilities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import glob
import json
import os
import requests
import shutil


Expand All @@ -19,28 +18,6 @@ def clean_fit_predict():
shutil.rmtree('predict')


def download_save(url, file_name, verify=True):
"""Download dataset

Arguments:
url: URL
file_name: File name
verify: Verify SSL certificate
"""

# Skip if file already exists
if (not (os.path.isfile(file_name) and os.path.getsize(file_name) > 0)):
assert(url)
r = requests.get(url, verify=verify)

assert (r.status_code == 200), 'Error: Could not download dataset'

with open(file_name, 'wb') as f:
f.write(r.content)

assert (os.path.isfile(file_name) and os.path.getsize(file_name) > 0), 'Error: dataset file not created'


def get_subdirectory(model_dir_root):
"""Get model uuid from model directory with uuid subdirectory. Assumes that there is only one subdirectory.
model_dir_root: Model directory with uuid subdirectory
Expand Down Expand Up @@ -96,3 +73,15 @@ def read_training_statistics_file(model_dir, subset, metric_col):
test_metric = m['prediction_results'][metric_col]
return test_metric

def copy_delaney(dest='.'):
"""Copies the delaney-processed.csv file to destination

Copies the delaney-processed.csv file to the given destination.
"""

delaney_source = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'../test_datasets/delaney-processed.csv'))

shutil.copy(delaney_source, dest)
4 changes: 2 additions & 2 deletions atomsci/ddm/test/integrative/random_seed/test_random_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def init():
# -----
clean()

# Download
# Copy Data
# --------
tdp.download()
integrative_utilities.copy_delaney()

# Curate
# ------
Expand Down
2 changes: 1 addition & 1 deletion atomsci/ddm/test/integrative/wenzel_NN/test_wenzel_NN.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test():
integrative_utilities.clean_fit_predict()
clean()

# Download
# Check for data
# --------
check_for_data_zip()

Expand Down
Loading
Loading