def test_ca_binaries():
    traj, ref = _random_natural_trajs()
    feat = BinaryLigandContactFeaturizer(reference_frame=ref,
                                         cutoff=0.1, scheme='ca')
    binaries = feat.transform(traj)

    assert np.sum(binaries[:]) <= len(binaries)*binaries[0].shape[1]
def test_binaries_binding_pocket():
    traj, ref = _random_trajs()
    feat = LigandContactFeaturizer(reference_frame=ref)
    pocket_ref = feat.transform([ref])
    limit = (max(pocket_ref[0][0]) + min(pocket_ref[0][0]))/2.0
    cutoff = limit*0.8
    number_included = sum(pocket_ref[0][0] < limit)

    pocket_feat = BinaryLigandContactFeaturizer(reference_frame=ref,
                                                cutoff=cutoff,
                                                binding_pocket=limit)
    pocket_binaries = pocket_feat.transform(traj)

    assert len(pocket_binaries[0][0]) == number_included
    assert (np.sum(pocket_binaries[:]) <=
            len(pocket_binaries)*pocket_binaries[0].shape[1])
def test_binaries_binding_pocket():
    traj, ref = _random_trajs()
    feat = LigandContactFeaturizer(reference_frame=ref)
    pocket_ref = feat.transform([ref])
    limit = (max(pocket_ref[0][0]) + min(pocket_ref[0][0]))/2.0
    cutoff = limit*0.8
    number_included = sum(pocket_ref[0][0] < limit)

    pocket_feat = BinaryLigandContactFeaturizer(reference_frame=ref,
                                                cutoff=cutoff,
                                                binding_pocket=limit)
    pocket_binaries = pocket_feat.transform(traj)

    assert len(pocket_binaries[0][0]) == number_included
    assert (np.sum(pocket_binaries[:]) <=
            len(pocket_binaries)*pocket_binaries[0].shape[1])