Exemplo n.º 1
0
 def test_parsimonious_scissors_tanimotos(self):
     """
     Test default Tanimoto approximation using parsimonious overlap
     values.
     """
     basis = np.random.randint(self.n_mols, size=200)
     bb_ip = self.data['tanimotos'][basis][:, basis]
     bb_ip = SCISSORS.get_inner_products_from_tanimotos(bb_ip)
     lb_ip = self.data['tanimotos'][:, basis]
     lb_ip = SCISSORS.get_inner_products_from_tanimotos(lb_ip)
     s = SCISSORS(bb_ip)
     tanimotos = s.get_tanimotos(lb_ip, max_dim=100)
     assert_scissors(tanimotos, self.data['tanimotos'])
Exemplo n.º 2
0
 def test_parsimonious_scissors_tanimotos_with_overlaps(self):
     """
     Test Tanimoto approximation using parsimonious overlap values and
     precalculated self-overlap values.
     """
     basis = np.random.randint(self.n_mols, size=200)
     bb_ip = self.data['tanimotos'][basis][:, basis]
     bb_ip = SCISSORS.get_inner_products_from_tanimotos(bb_ip)
     lb_ip = self.data['tanimotos'][:, basis]
     lb_ip = SCISSORS.get_inner_products_from_tanimotos(lb_ip)
     s = SCISSORS(bb_ip)
     tanimotos = s.get_tanimotos(lb_ip, self_overlap=np.ones(lb_ip.shape[0],
                                                             dtype=float),
                                 max_dim=100)
     assert_scissors(tanimotos, self.data['tanimotos'])
Exemplo n.º 3
0
def load(filename, overlap):
    """
    Load ROCS data from HDF5.

    Parameters
    ----------
    filename : str
        File containing ROCS overlay results.
    overlap : bool
        Whether to use actual pairwise overlaps as inner products. If
        False, use overlaps calculated under the parsimonious assumption
        of unity molecular self-overlap values.
    """
    with h5py.File(filename) as f:
        if overlap:
            shape_ip = f['shape_overlap'][:]
            color_ip = f['color_overlap'][:]
        else:
            shape_ip = SCISSORS.get_inner_products_from_tanimotos(
                f['shape_tanimoto'][:])
            color_ip = SCISSORS.get_inner_products_from_tanimotos(
                f['color_tanimoto'][:])
    return shape_ip, color_ip