Пример #1
0

if __name__ == '__main__':
    # tf.config.list_physical_devices('GPU')
    # exit()
    print("loading molecules")

    # name1 = "1K74_l_b"
    # name2 = "1K74_r_b"
    # name1 = "1KTZ_l_b"
    # name2 = "1KTZ_r_b"
    name1 = "1MAH_l_b"
    name2 = "1MAH_r_b"

    mol1 = Protein()
    mol1.fromFile("structures/" + name1 + ".pdb")
    mol2 = Protein()
    mol2.fromFile("structures/" + name2 + ".pdb")
    mol1.prepare()
    mol2.prepare()
    Chem.makeHydrogenDeplete(mol1)
    Chem.makeHydrogenDeplete(mol2)
    Biomol.FilePDBMolecularGraphWriter("compute/" + name1 + ".pdb").write(mol1)
    Biomol.FilePDBMolecularGraphWriter("compute/" + name2 + ".pdb").write(mol2)
    # ProteinTools.writePDB("compute/" + name1 + ".pdb", mol1)
    # ProteinTools.writePDB("compute/" + name2 + ".pdb", mol2)

    print("computing molecule surface")

    os.system("~/EDTSurf/EDTSurf -i " + "compute/" + name1 + ".pdb" +
              " -h 2 -s 3")
    for e in shape:
        e.setRadius(e.getRadius() * scaleFactor)
    shapeFunc.setMaxOrder(6)
    shapeFunc.setShape(shape)
    return shape, shapeFunc


def getShapeWithIncreasedRadius(mol, increase=0.5):
    shape = Shape.GaussianShape()
    shapeFunc = Shape.GaussianShapeFunction()
    Shape.generateGaussianShape(mol, shape, inc_h=True)
    for e in shape:
        e.setRadius(e.getRadius() + increase)
    shapeFunc.setMaxOrder(6)
    shapeFunc.setShape(shape)
    return shape, shapeFunc


path = '../Data/benchmark5.5/structures/'
p = Protein()
p.fromFile('{}1A2K_l_b.pdb'.format(path))
# remove ligands and other crystalization artifacts
p.removeLigands()
sanitized = sanitize_mol(p, makeHydrogenComplete=True)
Pharm.prepareForPharmacophoreGeneration(p)
Chem.generateHydrogen3DCoordinates(p, True)

for i in range(10):
    scale = 1 + i / 10
    shape, shapeFunc = getShape(p, scaleFactor=scale)
    print(scale, shapeFunc.surfaceArea)