Commit a7156e44 authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Fixing more examples

parent f4d76863
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
@@ -11,42 +11,6 @@ logger = logging.getLogger(__name__)
HPPB_URL = "http://deepchem.io.s3-website-us-west-1.amazonaws.com/datasets/hppb.csv"
DEFAULT_DATA_DIR = deepchem.utils.get_data_dir()


def remove_missing_entries(dataset):
  """Remove missing entries.

  Some of the datasets have missing entries that sneak in as zero'd out
  feature vectors. Get rid of them.
  """
  for i, (X, y, w, ids) in enumerate(dataset.itershards()):
    ###########################################
    print("X.shape")
    print(X.shape)
    print("X[:10]")
    print(X[:10])
    print("type(X)")
    print(type(X))
    ###########################################
    #available_rows = X.any(axis=1)
    available_rows = np.any(X)
    ###########################################
    print("type(available_rows)")
    print(type(available_rows))
    ###########################################
    logger.info("Shard %d has %d missing entries." %
                #(i, np.count_nonzero(~available_rows)))
                (i, len(X) - len(available_rows)))
    ##################################################
    print("type(available_rows)")
    print(type(available_rows))
    ##################################################
    X = X[available_rows]
    y = y[available_rows]
    w = w[available_rows]
    ids = ids[available_rows]
    dataset.set_shard(i, X, y, w, ids)


def load_hppb(featurizer="ECFP",
              data_dir=None,
              save_dir=None,
@@ -79,10 +43,6 @@ def load_hppb(featurizer="ECFP",
  dataset_file = os.path.join(data_dir, "hppb.csv")
  if not os.path.exists(dataset_file):
    logger.info("{} does not exist. Downloading it.".format(dataset_file))
    ################################################
    print("data_dir")
    print(data_dir)
    ################################################
    deepchem.utils.download_url(url=HPPB_URL, dest_dir=data_dir)

  if featurizer == 'ECFP':
@@ -108,7 +68,6 @@ def load_hppb(featurizer="ECFP",
  dataset = loader.featurize(input_files=[dataset_file], shard_size=2000)

  logger.info("Removing missing entries...")
  remove_missing_entries(dataset)

  if split == None:
    logger.info("About to transform the data...")
+4 −4
Original line number Diff line number Diff line
# ADME Dataset Examples

ADME (Absorption, Distribution, Metabolism, Excretion) is a core
part of the drug discovery process. In-silico models for ADME
tasks span a wide variety of pharmacokinetics endpoints across
multiple species.
ADME (Absorption, Distribution, Metabolism, Excretion) is a
core part of the drug discovery process. In-silico models for
ADME tasks span a wide variety of pharmacokinetics endpoints
across multiple species.

The ADME benchmark contains three of the larger datasets that
were released by AstraZeneca on ChEMBL: human plasma protein
+6 −44
Original line number Diff line number Diff line
@@ -10,56 +10,21 @@ from deepchem.models import GraphConvModel

MODEL = "GraphConv"
SPLIT = "scaffold"
DATASET_NAME = "hppb"
DATASET_NAME = "clearance"


BATCH_SIZE = 128
# Set to higher values to get better numbers
MAX_EPOCH = 1

#def retrieve_datasets():
#  os.system(
#      'wget -c %s' %
#      'https://s3-us-west-1.amazonaws.com/deep-crystal-california/az_logd.csv')
#  os.system(
#      'wget -c %s' %
#      'https://s3-us-west-1.amazonaws.com/deep-crystal-california/az_hppb.csv')
#  os.system(
#      'wget -c %s' %
#      'https://s3-us-west-1.amazonaws.com/deep-crystal-california/az_clearance.csv'
#  )
MAX_EPOCH = 10


def load_dataset(dataset_name, featurizer='ECFP', split='index'):
  #tasks = ['exp']

  #if featurizer == 'ECFP':
  #  featurizer = dc.feat.CircularFingerprint(size=1024)
  #elif featurizer == 'GraphConv':
  #  featurizer = dc.feat.ConvMolFeaturizer()

  #loader = dc.data.CSVLoader(
  #    tasks=tasks, smiles_field="smiles", featurizer=featurizer)
  #dataset = loader.featurize(dataset_file, shard_size=8192)
  if dataset_name.lower() == "clearance":
    dataset = dc.molnet.load_clearance(featurizer=featurizer, split=split)
    return dc.molnet.load_clearance(featurizer=featurizer, split=split)
  elif dataset_name.lower() == "hppb":
    dataset = dc.molnet.load_hppb(featurizer=featurizer, split=split)

  #transformers = [
  #    dc.trans.NormalizationTransformer(transform_y=True, dataset=dataset)
  #]
  #for transformer in transformers:
  #  dataset = transformer.transform(dataset)

  #splitters = {
  #    'index': dc.splits.IndexSplitter(),
  #    'random': dc.splits.RandomSplitter(),
  #    'scaffold': dc.splits.ScaffoldSplitter()
  #}
  #splitter = splitters[split]
  #train, valid, test = splitter.train_valid_test_split(dataset)
  #return tasks, (train, valid, test), transformers
    return dc.molnet.load_hppb(featurizer=featurizer, split=split)
  elif dataset_name.lower() == "lipo":
    return dc.molnet.load_lipo(featurizer=featurizer, split=split)


def experiment(dataset_name, method='GraphConv', split='scaffold'):
@@ -94,9 +59,6 @@ def experiment(dataset_name, method='GraphConv', split='scaffold'):
#======================================================================
# Run Benchmarks {GC-DNN, SVR, RF}
def main():
  #print("About to retrieve datasets")
  #retrieve_datasets()

  metric = dc.metrics.Metric(dc.metrics.pearson_r2_score, np.mean)

  print("About to build model")
+7 −3
Original line number Diff line number Diff line
# Dataset Description

This example is based on the DUD-E group; it contained 102 datasets that were
designed for the evaluation of methods to predict interactions between proteins
and small molecules (Mysinger et al., 2012)
This example is based on the DUD-E group; it contained 102
datasets that were designed for the evaluation of methods to
predict interactions between proteins and small molecules


Mysinger, Michael M., et al. "Directory of useful decoys, enhanced (DUD-E): better ligands and decoys for better benchmarking." Journal of medicinal chemistry 55.14 (2012): 6582-6594.
+4 −3
Original line number Diff line number Diff line
# Dataset overview

The Tox21 datasets were used in the recent (Tox21 Data Challenge)[https://tripod.nih.gov/tox21/challenge/]; they contain experimental data for targets relevant to drug toxicity prediction
The Tox21 datasets were used in the recent (Tox21 Data
Challenge)[https://tripod.nih.gov/tox21/challenge/]; they contain experimental
data for targets relevant to drug toxicity prediction

Ref: B Ramsundar, S Kearnes, P Riley, D Webster, D Konerding, V Pande
arXiv preprint arXiv:1502.02072
 No newline at end of file
This folder features a number of different models trained on the Tox21 dataset.
Loading