Example #1
0
def lig(config, inp: str, center: int, out: click.File):
    """Get all substructures (or ligands) that are bound to the center atom."""

    # setup reference molecular structure
    ref = ksr.constructMolecule(geometry=inp, out=out)
    nat = ref.get_number_of_atoms()

    # get all covalent bonding partner in reference complex
    covbonds = config.context.invoke(bonds, inp=inp)

    from kallisto.rmsd import recursiveGetSubstructures

    silentPrinter(config.silent,
                  "Write out substructures for {}".format(center), out)

    substructures = recursiveGetSubstructures(nat, covbonds, center)

    k = 0
    for path in substructures:
        silentPrinter(
            config.silent,
            "Substructure {}: {}".format(k, path),
            out,
        )
        k += 1
Example #2
0
def test_lig_neopentane():
    center = 0
    mol = neopentane()
    nat = mol.get_number_of_atoms()
    bonds = mol.get_bonds()
    substructures = recursiveGetSubstructures(nat, bonds,
                                              center)  # type: ignore
    assert 1 in substructures[0]
    assert 6 in substructures[0]
    assert 8 in substructures[0]
    assert 12 in substructures[0]
    center = 1
    substructures = recursiveGetSubstructures(nat, bonds,
                                              center)  # type: ignore
    assert 6 in substructures[1]
    assert 8 in substructures[2]
    assert 12 in substructures[3]