UserInertialStarts

OEFastROCSOrientation.UserInertialStarts allows custom coordinates to be used as starting positions for optimization. Using the 4TMN ligand from the Introduction as an example, optimization can be done at the atom highlighted in green below:

../../../_images/Tutorial_1_Figure_5.png

4TMN Ligand with atom 34 highlighted green

Before running the program, the index of the desired atom needs to be identified. This can be accomplished by loading the molecule in VIDA and turning on atom indices. In this example, the atom’s index is identified as idx 34. With this information, the x,y,z coordinates of atom idx 34 are pulled via the code snippet below. These coordinates are then used as user-defined starting coordinates:

startsCoords = oechem.OEFloatVector()
xyz = query.GetCoords()[34]
for x in xyz:
    startsCoords.append(x)

To use the OEFastROCSOrientation.UserInertialStarts method, set OEShapeDatabaseOptions.SetInitialOrientation and then input the starts vector using OEShapeDatabaseOptions.SetUserStarts:

opts.SetInitialOrientation(oefastrocs.OEFastROCSOrientation_UserInertialStarts)
opts.SetUserStarts(oechem.OEFloatVector(startsCoords), int(len(startsCoords)/3))

The first argument of OEShapeDatabaseOptions.SetUserStarts is the startsCoords vector created previously. This must be of the type OEFloatVector. The second argument is the number of user-defined starting coordinates to optimize.

In this example, only 1 user-defined starting point has been set. There is no limit to the number of user-defined starts however, it should be noted that performance is inversely proportional to the number of starts being optimized.

To check that the starts have been set correctly, query OEShapeDatabaseOptions.GetInitialOrientation and OEShapeDatabaseOptions.GetNumUserStarts:

if opts.GetInitialOrientation() == oefastrocs.OEFastROCSOrientation_UserInertialStarts:
    numStarts = opts.GetNumUserStarts()
    oechem.OEThrow.Info("This example will use %u starts" % numStarts)

The output from the modified Python script now looks like this:

Opening database file 3tmn_lig.sdf ...
This example will use 1 starts
Searching for 4tmn_lig.sdf
Score for mol 0(conf 0) 0.289689 shape 0.358462 color
Score for mol 0(conf 0) 0.320501 shape 0.098301 color
Score for mol 0(conf 0) 0.283724 shape 0.012400 color
Score for mol 0(conf 0) 0.145704 shape 0.023627 color

Download code

The fully modified python script used in this tutorial can be found here UserInertialStartsExample.py