Ejemplo n.º 1
0
 def test_distance_under_threshold(multi_molecules,
                                   assymetric_pair_selected):
     distances = []
     found_distances = []
     for ((mol_a, key_a), (mol_b, key_b), dist) in assymetric_pair_selected:
         node_a = multi_molecules[mol_a].nodes[key_a]
         node_b = multi_molecules[mol_b].nodes[key_b]
         distances.append(distance(node_a['coords'], node_b['coords']))
         found_distances.append(dist)
     assert all(d <= 2.0 for d in distances)
     assert np.allclose(found_distances, distances)
def test_add_cystein_bridges_threshold(cys_protein):
    """
    Test that :class:`vermouth.AddCysteinBridgesThreshold` detects a cystein
    bridge in a PDB file.
    """
    processor = vermouth.AddCysteinBridgesThreshold(threshold=0.22)
    system = processor.run_system(cys_protein)
    for edge in system.molecules[0].edges:
        node_a = system.molecules[0].nodes[edge[0]]
        node_b = system.molecules[0].nodes[edge[1]]
        print('*', node_a, '--', node_b) 
        print(distance(node_a['position'], node_b['position']))
    assert len(system.molecules[0].edges) == 1
    assert (1285, 3508) in system.molecules[0].edges
def test_add_cystein_bridges_threshold(cys_protein):
    """
    Test that :class:`vermouth.AddCysteinBridgesThreshold` detects a cystein
    bridge in a PDB file.
    """
    processor = vermouth.AddCysteinBridgesThreshold(threshold=0.22)
    system = processor.run_system(cys_protein)
    for edge in system.molecules[0].edges:
        node_a = system.molecules[0].nodes[edge[0]]
        node_b = system.molecules[0].nodes[edge[1]]
        print('*', node_a, '--', node_b)
        print(distance(node_a['position'], node_b['position']))
    assert len(system.molecules[0].edges) == 1
    # According to SSBOND record, cysbond should be between resid 171 and 876.
    # Let's find the associated atoms.
    atoms = tuple(system.molecules[0].find_atoms(resname='CYS',
                                                 atomname='SG',
                                                 resid=Choice([171, 876])))
    assert atoms in system.molecules[0].edges
Ejemplo n.º 4
0
def test_distance(vec_and_dist):
    """
    Test the results of :func:`utils.distance`.
    """
    point1, point2, distance = vec_and_dist
    assert_allclose(utils.distance(point1, point2), distance)