Exemplo n.º 1
0
def test_determine_b_group_calpha_true():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1a1q.pdb"
    pdb_id = "1a1q"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["calpha_only"], True)
Exemplo n.º 2
0
def test_determine_b_group_protein_2ADP():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/3zzt.pdb"
    pdb_id = "3zzt"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "residue_2ADP")
Exemplo n.º 3
0
def test_has_sugar_phosphate_backbone_false():
    """Tests has_amino_acid_backbone with protein."""
    pdb_file_path = "pdbb/tests/pdb/files/1crn.pdb"
    pdb_id = "1crn"
    structure = get_structure(pdb_file_path, pdb_id)
    result = has_sugar_phosphate_backbone(structure.get_residues().next())
    eq_(result, False)
Exemplo n.º 4
0
def test_is_protein_chain_true():
    """Tests is_protein_chain with protein."""
    pdb_file_path = "pdbb/tests/pdb/files/1crn.pdb"
    pdb_id = "1crn"
    structure = get_structure(pdb_file_path, pdb_id)
    result = is_protein_chain(structure.get_chains().next())
    eq_(result, True)
Exemplo n.º 5
0
def test_is_protein_chain_false():
    """Tests is_protein_chain with dna/rna."""
    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    result = is_protein_chain(structure.get_chains().next())
    eq_(result, False)
Exemplo n.º 6
0
def test_determine_b_group_nucleic_None():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1av1.pdb"
    pdb_id = "1av1"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["nucleic_b"], None)
Exemplo n.º 7
0
def test_check_tls_range_false():
    """Tests that False is returned for an invalid residue range."""
    pdb_file_path = "pdbb/tests/pdb/files/3gg8.pdb"
    pdb_id = "3gg8"
    structure = get_structure(pdb_file_path, pdb_id)
    tls_selections = [
        {"chain_1": "C",
         "num_1": 463,
         "ic_1": None,
         "chain_2": "C",
         "num_2": 511,
         "ic_2": None},
        {"chain_1": "D",
         "num_1": 20,
         "ic_1": None,
         "chain_2": "D",
         "num_2": 36,
         "ic_2": None},
        {"chain_1": "D",
         "num_1": 37,
         "ic_1": None,
         "chain_2": "D",
         "num_2": 108,
         "ic_2": None}]
    result = check_tls_range(structure, tls_selections)
    eq_(result, False)
Exemplo n.º 8
0
def test_is_calpha_trace_true():
    """Tests is_calpha_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/1efg.pdb"
    pdb_id = "1efg"
    structure = get_structure(pdb_file_path, pdb_id)
    chain = structure.get_chains().next()
    result = is_calpha_trace(chain)
    eq_(result, True)
Exemplo n.º 9
0
def test_determine_b_group_calpha_true_3():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1efg.pdb"
    pdb_id = "1efg"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "overall")
    eq_(result["calpha_only"], True)
Exemplo n.º 10
0
def test_is_phos_trace_false_prot_chain():
    """Tests is_phos_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/1crn.pdb"
    pdb_id = "1crn"
    structure = get_structure(pdb_file_path, pdb_id)
    chain = structure.get_chains().next()
    result = is_phos_trace(chain)
    eq_(result, False)
Exemplo n.º 11
0
def test_is_calpha_trace_false_nuc():
    """Tests is_calpha_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    chain = structure.get_chains().next()
    result = is_calpha_trace(chain)
    eq_(result, False)
Exemplo n.º 12
0
def test_determine_b_group_protein_no_b_factors():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1mcb.pdb"
    pdb_id = "1mcb"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "no_b-factors")
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], None)
Exemplo n.º 13
0
def test_determine_b_group_nucleic_2ADP():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1hlz.pdb"
    pdb_id = "1hlz"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "residue_1ADP")
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], "residue_2ADP")
Exemplo n.º 14
0
def test_determine_b_group_protein_overall():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/1etu.pdb"
    pdb_id = "1etu"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "overall")
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], None)
Exemplo n.º 15
0
def test_determine_b_group_nucleic_individual():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], None)
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], "individual")
Exemplo n.º 16
0
def test_determine_b_group_too_short():
    """Tests that b_group is correctly determined."""
    pdb_file_path = "pdbb/tests/pdb/files/438d.pdb"
    pdb_id = "438d"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], None)
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], None)
    eq_(result["phos_only"], False)
Exemplo n.º 17
0
def test_is_calpha_trace_true_unk():
    """Tests is_calpha_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/1efg.pdb"
    pdb_id = "1efg"
    structure = get_structure(pdb_file_path, pdb_id)
    chains = list(structure.get_chains())
    result = is_calpha_trace(chains[1])
    eq_(result, True)
    result = is_calpha_trace(chains[2])
    eq_(result, True)
Exemplo n.º 18
0
def test_check_beq_incorrect_uij():
    """Tests check_beq.

    e.g. 2a83, 2p6e, 2qik, 3bik, 3d95, 3d96, 3g5t, etc.
    """
    pdb_file_path = "pdbb/tests/pdb/files/2a83.pdb"
    pdb_id = "2a83"
    structure = get_structure(pdb_file_path, pdb_id)
    result = check_beq(structure)
    eq_(result["beq_identical"], 0.9419321685508736)
    eq_(result["correct_uij"], False)
Exemplo n.º 19
0
def test_is_phos_trace_true():
    """Tests is_phos_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/3cw1.pdb"
    pdb_id = "3cw1"
    structure = get_structure(pdb_file_path, pdb_id)
    chains = structure.get_chains()
    for c in chains:
        cid = c.get_id()
        if cid in ("V", "v", "w", "x"):
            result = is_phos_trace(c)
            eq_(result, True)
Exemplo n.º 20
0
def test_check_beq_identical():
    """Tests check_beq.

    e.g. 3zzw, 3zit, 2yjl, etc. etc. etc.
    """
    pdb_file_path = "pdbb/tests/pdb/files/3zzw.pdb"
    pdb_id = "3zzw"
    structure = get_structure(pdb_file_path, pdb_id)
    result = check_beq(structure)
    eq_(result["beq_identical"], 1.0)
    eq_(result["correct_uij"], True)
Exemplo n.º 21
0
def test_determine_b_group_protein_overall_4():
    """Tests that b_group is correctly determined.

        1av1 has the same B-factor for large stretches
        of residues; overall is probably the best term.
    """
    pdb_file_path = "pdbb/tests/pdb/files/1av1.pdb"
    pdb_id = "1av1"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "overall")
Exemplo n.º 22
0
def test_is_heavy_backbone():
    """Tests is_heavy_backbone with protein, dna and rna."""
    pdb_file_path = "pdbb/tests/pdb/files/1crn.pdb"
    pdb_id = "1crn"
    structure = get_structure(pdb_file_path, pdb_id)
    result = is_heavy_backbone(structure.get_atoms().next())
    eq_(result, True)

    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    residues = structure.get_residues()
    residue = residues.next()
    atom = residue.get_list()[0]
    result = is_heavy_backbone(atom)
    eq_(result, True)

    residue = residues.next()
    atom = residue.get_list()[0]
    result = is_heavy_backbone(atom)
    eq_(result, True)
Exemplo n.º 23
0
def test_has_amino_acid_backbone_false():
    """Tests has_amino_acid_backbone with dna/rna."""
    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    residues = structure.get_residues()
    residue = residues.next()
    result = has_amino_acid_backbone(residue)
    eq_(result, False)

    residue = residues.next()
    result = has_amino_acid_backbone(residue)
    eq_(result, False)
Exemplo n.º 24
0
def test_is_calpha_trace_true_2():
    """Tests is_calpha_trace."""
    pdb_file_path = "pdbb/tests/pdb/files/3cw1.pdb"
    pdb_id = "3cw1"
    structure = get_structure(pdb_file_path, pdb_id)
    chains = structure.get_chains()
    for c in chains:
        cid = c.get_id()
        if cid in ("D", "S", "T", "U", "A", "H", "I", "J", "B", "M", "N", "O",
                   "C", "P", "Q", "R", "1", "2", "F", "Z", "E", "W", "X", "Y",
                   "3", "5", "G", "6", "7", "8", "K", "0", "9", "L", "I"):
            result = is_calpha_trace(c)
            eq_(result, True)
Exemplo n.º 25
0
def test_multiply_bfactors_8pipi():
    """Tests that bfactors are correctly multiplied by 8*pi^2."""
    pdb_file_path = "pdbb/tests/pdb/files/1crn.pdb"
    pdb_id = "1crn"
    structure = get_structure(pdb_file_path, pdb_id)
    expected = []
    for atom in structure.get_atoms():
        expected.append(8*np.pi**2 * atom.get_bfactor())

    s_mult = multiply_bfactors_8pipi(structure)
    bvalues = []
    for atom in s_mult.get_atoms():
        bvalues.append(atom.get_bfactor())
    eq_(bvalues, expected)
Exemplo n.º 26
0
def test_check_tls_range_true():
    """Tests that True is returned for a valid residue range."""
    pdb_file_path = "pdbb/tests/pdb/files/4aph.pdb"
    pdb_id = "4aph"
    structure = get_structure(pdb_file_path, pdb_id)
    tls_selections = [
        {"chain_1": "A",
         "num_1": 40,
         "ic_1": None,
         "chain_2": "A",
         "num_2": 625,
         "ic_2": None}]
    result = check_tls_range(structure, tls_selections)
    eq_(result, True)
Exemplo n.º 27
0
def test_determine_b_group_protein_overall_2():
    """Tests that b_group is correctly determined.

        1az2 is has 16.67 for all N CA and C atoms
        and 20.54 for O and side-chain atoms.
        overall is probably the best term.
    """
    pdb_file_path = "pdbb/tests/pdb/files/1az2.pdb"
    pdb_id = "1az2"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "overall")
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], None)
Exemplo n.º 28
0
def test_determine_b_group_protein_overall_3():
    """Tests that b_group is correctly determined.

        1c2y has the same B-factor everywhere,
        except for some THR and LEU atoms end-of-side-chain
        overall is probably the best term.
    """
    pdb_file_path = "pdbb/tests/pdb/files/1c2y.pdb"
    pdb_id = "1c2y"
    structure = get_structure(pdb_file_path, pdb_id)
    result = determine_b_group(structure)
    eq_(result["protein_b"], "overall")
    eq_(result["calpha_only"], False)
    eq_(result["nucleic_b"], None)
Exemplo n.º 29
0
def test_check_beq_not_identical():
    """Tests check_beq.

    e.g 1g8t, 1kr7, 1llr, 1mgr, 1o9g, 1pm1, 1q7l, 1qjp,
    1s2p, 1si6, 1sxu, 1sxy, 1sy0, 1sy2, 1ug6, 1x9q, 2a83, 2acp,
    2at5, 2bwi, 2ceu, 2fri, 2frj, 2hmn, 2htx, 2j73, 2p6e, 2p6f,
    2p6g, 2qfn, 2qik, 2v0a, 2xgb, 2xl6, 2xle, 2xlw, 3bwo, 3dqy,
    3fde, 3g5t, 3jql, 3nju, 3nna, 3oxp, etc.
    """
    pdb_file_path = "pdbb/tests/pdb/files/1g8t.pdb"
    pdb_id = "1g8t"
    structure = get_structure(pdb_file_path, pdb_id)
    result = check_beq(structure)
    eq_(result["beq_identical"], 0.999124343257443)
    eq_(result["correct_uij"], True)
Exemplo n.º 30
0
def test_has_sugar_phosphate_backbone_true():
    """Tests has_amino_acid_backbone with dna/rna."""
    pdb_file_path = "pdbb/tests/pdb/files/100d.pdb"
    pdb_id = "100d"
    structure = get_structure(pdb_file_path, pdb_id)
    residues = structure.get_residues()
    residue = residues.next()
    result = has_sugar_phosphate_backbone(residue)
    eq_(result, False)  # DNA, misses P

    residue = residues.next()
    result = has_sugar_phosphate_backbone(residue)
    eq_(result, True)

    residues = list(structure.get_chains().next().get_residues())
    residue = residues[9]  # Residue 10 has the phosphate..
    result = has_sugar_phosphate_backbone(residue)
    eq_(result, True)