def test_chain_guessing():
    traj, ref = _random_trajs()
    feat = LigandContactFeaturizer(reference_frame=ref)
    contacts = feat.transform(traj)

    assert feat.protein_chain == 0
    assert feat.ligand_chain == 1
    assert len(contacts) == 100
    assert contacts[0].shape[1] == 3
def test_chain_guessing():
    traj, ref = _random_trajs()
    feat = LigandContactFeaturizer(reference_frame=ref)
    contacts = feat.transform(traj)

    assert feat.protein_chain == 0
    assert feat.ligand_chain == 1
    assert len(contacts) == 100
    assert contacts[0].shape[1] == 3
def test_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
    number_included = sum(pocket_ref[0][0] < limit)


    pocket_feat = LigandContactFeaturizer(reference_frame=ref,
                                          binding_pocket=limit)
    pocket_contacts = pocket_feat.transform(traj)

    assert len(pocket_contacts[0][0]) == number_included
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])
def test_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
    number_included = sum(pocket_ref[0][0] < limit)

    pocket_feat = LigandContactFeaturizer(reference_frame=ref,
                                          binding_pocket=limit)
    pocket_contacts = pocket_feat.transform(traj)

    assert len(pocket_contacts[0][0]) == number_included