Skip to content

Commit

Permalink
Merge branch 'main' into pinnacle_networks
Browse files Browse the repository at this point in the history
  • Loading branch information
amva13 committed Sep 5, 2024
2 parents 015399b + 93fcf89 commit 5128b7d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ We provide tutorials to get started with TDC:
| [202](https://colab.research.google.com/drive/1kYH8nt3nW7tXYBPNcfYuDbWxGTqOEnWg?usp=sharing) | TDC-2 Resource and PrimeKG |
| [203](https://colab.research.google.com/drive/13MYlg5tWpywWbKYsJQXafKAlVF2hz-sP?usp=sharing) | TDC-2 Resource and External APIs |
| [204](https://colab.research.google.com/drive/17Pd328W27mn-iBCRkHIa78L3pukKcfW1?usp=sharing) | TDC-2 Model Hub |
| [205](https://colab.research.google.com/drive/1kHdFG4gUic5nmiul7b1hUh0HLCxLQnw_?usp=sharing) | TDC-2 Molecular Property Cliff Prediction Task |


## Design of TDC
Expand Down
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

0 comments on commit 5128b7d

Please sign in to comment.