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
import tensorflow as tf | |
# 1. Create and save two graphs | |
# c = a*b | |
g1 = tf.Graph() | |
with g1.as_default(): | |
a = tf.placeholder(tf.float32, name='a') | |
b = tf.Variable(initial_value=tf.truncated_normal((1,)), name='b') |
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
from random import shuffle | |
def example_generator(*lists, random_order=True): | |
"""Create infinite generator of examples. | |
example_generator([3, 6, 8], [0, 0, 1]) -> (6,0), (3,0), (8,1), (3,0)... | |
""" | |
assert len(lists) > 0, 'no lists provided' |
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
import tensorflow as tf | |
# 1. Create and save a network | |
# c = a*b | |
g = tf.Graph() | |
with g.as_default(): | |
a = tf.placeholder(tf.float32, name='a') | |
b = tf.Variable(initial_value=tf.truncated_normal((1,)), name='b') | |
c = tf.multiply(a, b, name='c') |
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
from rdkit.Chem import MolFromSmiles | |
from decaf.toolkits.rd import phar_from_mol | |
from decaf.utils import similarity, combine_pharmacophores, draw, filter_nodes | |
from scipy.cluster.hierarchy import average as avg_clustering | |
from scipy.spatial.distance import squareform | |
smiles = [ | |
'c1cc(cc(c1)N)c2cc(cc(c2O)c3[nH]c4ccc(cc4n3)C(=N)N)Cl', | |
'c1cc(cc(c1)N(=O)=O)c2cc(cc(c2O)c3cc4cc(ccc4[nH]3)C(=N)N)C(CC(=O)O)C(=O)O', |
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
import numpy as np | |
import pandas as pd | |
import h5py | |
import pybel | |
from tfbio.data import Featurizer | |
import os | |
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
# before running this script clone Pafnucy's repository and create the environment: | |
# $ git clone https://gitlab.com/cheminfIBB/pafnucy | |
# $ cd pafnucy | |
# $ conda env create -f environment_gpu.yml | |
import numpy as np | |
import h5py | |
import tensorflow as tf |
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
import torch | |
from torch import nn | |
class Net(nn.Module): | |
def __init__(self): | |
super().__init__() | |
self.l1 = nn.Sequential(nn.Linear(8, 64), nn.ReLU(), nn.Linear(64, 2)) | |
self.l2 = nn.Sequential(nn.Linear(64, 64), nn.ReLU(), nn.Linear(64, 2)) | |
self.relu = nn.ReLU() | |
def forward(self, x, y): |