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

MPC complete #307

Merged
merged 2 commits into from
Sep 3, 2024
Merged
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
26 changes: 24 additions & 2 deletions tdc/single_pred/mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,30 @@ def __init__(self, name, path="./data"):
self.name = name
self.data = None

def get_data(self):
from MoleculeACE import Data, Descriptors #TODO: support non-MoleculeACE
def get_from_gh(self, link):
import pandas as pd
import requests
import io

data = requests.get(link)
try:
data.raise_for_status()
except:
raise Exception(
"invalid link provided. choose a link for datasets in https://github.com/bidd-group/MPCD"
)
self.data = pd.read_csv(io.StringIO(data.text))
return self.data

def get_data(self, link=None, get_from_gh=True):
if (not get_from_gh) and link is None:
raise Exception(
"provide dataset github link from https://github.com/bidd-group/MPCD"
)
elif get_from_gh:
return self.get_from_gh(link)
# support direct interfface with MoleculeACE API as well
from MoleculeACE import Data, Descriptors
try:
self.data = Data(self.name)
self.data(Descriptors.SMILES)
Expand Down
Loading