Example #1
0
def test_parse_structure():
    """Test the structure parser."""

    pdb_path = Path(DATA_FOLDER, "complex.pdb")

    s, n_chains, n_res = parse_structure(pdb_path)

    assert isinstance(s, Structure)
    assert n_chains == 2
    assert n_res == 252

    with pytest.raises(Exception):
        parse_structure("nothing.pdb")

    pdb_w_gaps_path = Path(DATA_FOLDER, "ens_w_gaps.pdb")
    s_gaps, n_chains_gaps, n_res_gaps = parse_structure(pdb_w_gaps_path)

    assert isinstance(s_gaps, Structure)
    assert n_chains_gaps == 2
    assert n_res_gaps == 247
Example #2
0
def contact_list():
    pdb_path = Path(DATA_FOLDER, "complex.pdb")
    s, _, _ = parse_structure(pdb_path)
    return [(s[0]["I"][1], s[0]["E"][20])]
Example #3
0
def parsed_structure_w_gaps():
    pdb_path = Path(DATA_FOLDER, "ens_w_gaps.pdb")
    s, _, _ = parse_structure(pdb_path)
    return s
Example #4
0
def parsed_structure():
    pdb_path = Path(DATA_FOLDER, "complex.pdb")
    s, _, _ = parse_structure(pdb_path)
    return s
Example #5
0
    be considered for the calculation. Separate by a space the chains that
    are to be considered _different_ molecules. Use commas to include multiple
    chains as part of a single group:

    --selection A B => Contacts calculated (only) between chains A and B.
    --selection A,B C => Contacts calculated (only) between chains A and C; and B and C.
    --selection A B C => Contacts calculated (only) between chains A and B; B and C; and A and C.
    """
    sel_opt = ap.add_argument_group("Selection Options", description=_co_help)
    sel_opt.add_argument("--selection", nargs="+", metavar=("A B", "A,B C"))

    cmd = ap.parse_args()

    # setup logging
    log_level = logging.ERROR if cmd.quiet else logging.INFO
    logging.basicConfig(level=log_level, format="%(message)s")
    logger = logging.getLogger("Prodigy")

    struct_path = _check_path(cmd.structf)

    # Parse structure
    structure, n_chains, n_res = parse_structure(struct_path)
    prodigy = ProdigyCrystal(structure, cmd.selection)
    prodigy.predict()
    prodigy.print_prediction(quiet=cmd.quiet)

    # Print out interaction network
    if cmd.contact_list:
        fname = struct_path[:-4] + ".ic"
        prodigy.print_contacts(fname)