OMEGA Examples

The following table lists the currently available Omega TK examples:

Program Description
SimpleOmega generating conformers
SimpleOmicron generating a single conformer
DensOmega generating densely sampled conformers
StereoAndTorsion generating stereoisomers

Classic OEOmega Examples

Generating Conformers

The following code example is a simple example of how to generate conformers using the OEOmega object.

See also

Listing 1: Generating Conformers

/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.

TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.  OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oeomega;

import openeye.oechem.*;
import openeye.oeomega.*;

public class SimpleOmega {
    public static void main(String[] args) {
        if (args.length!=2) {
            System.out.println("SimpleOmega <infile> <outfile>");
            System.exit(0);
        }

        oemolistream ifs = new oemolistream(args[0]);
        oemolostream ofs = new oemolostream(args[1]);

        OEOmegaOptions opts = new OEOmegaOptions();
        OEOmega omega = new OEOmega(opts);

        OEMol mol = new OEMol();
        while (oechem.OEReadMolecule(ifs, mol)) {
            String title = mol.GetTitle();
            if (title.length() != 0) System.out.println(title);
            boolean res = omega.call(mol);
            if (res && mol.IsValid()) {
                oechem.OEWriteMolecule(ofs, mol);        
            }
        }
        ifs.close();
        ofs.close();
    }
}

Generating a Single Conformer

The following code example is a simple example of how to generate a single conformer.

See also

Listing 2: Generating a Single Conformer

/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.

TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.  OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oeomega;

import openeye.oechem.*;
import openeye.oeomega.*;

public class SimpleOmicron {

    public static void main(String[] args) {
        if (args.length!=2) {
            oechem.OEThrow.Usage("SimpleOmicron <infile> <outfile>");
        }

        oechem.OEThrow.SetLevel(OEErrorLevel.Info); 

        oemolistream ifs = new oemolistream(args[0]);
        oemolostream ofs = new oemolostream(args[1]);

        OEOmegaOptions omegaOpts = new OEOmegaOptions();
        omegaOpts.SetMaxConfs(1);
        OEOmega omega = new OEOmega(omegaOpts);

        OEMol mol = new OEMol();
        while (oechem.OEReadMolecule(ifs, mol)) {
            System.out.println(mol.GetTitle());
            omega.call(mol);
            oechem.OEWriteMolecule(ofs, mol);
        }
        ifs.close();
        ofs.close();
    }
}

Generating Densely Sampled Conformers

The following code example is a simple example of how to generate densely sampled conformers, as used in OEFreeFormConf calculations, using the OEOmega object.

See also

Listing 3: Generating Densely Sampled Conformers

/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.

TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.  OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oeomega;

import openeye.oechem.*;
import openeye.oeomega.*;

public class DensOmega {
    public static void main(String[] args) {
        if (args.length!=2) {
            System.out.println("DensOmega <infile> <outfile>");
            System.exit(0);
        }

        oemolistream ifs = new oemolistream(args[0]);
        oemolostream ofs = new oemolostream(args[1]);

        OEOmegaOptions omegaOpts = new OEOmegaOptions(OEOmegaSampling.Dense);
        OEOmega omega = new OEOmega(omegaOpts);

        OEMol mol = new OEMol();
        while (oechem.OEReadMolecule(ifs, mol)) {
            String title = mol.GetTitle();
            if (title.length() != 0) System.out.println(title);
            boolean res = omega.call(mol);
            if (res && mol.IsValid()) {
                oechem.OEWriteMolecule(ofs, mol);        
            }
        }
        ifs.close();
        ofs.close();
    }
}

Flipper Examples

Generating Stereoisomers

The following code example is a simple example of how to use the OEFlipper function to generate stereoisomers. The code example also demonstrates that stereoisomers should be generated before generating conformers.

See also

Listing 4: Generating Stereoisomers

/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.

TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.  OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oeomega;

import openeye.oechem.*;
import openeye.oeomega.*;

public class StereoAndTorsion { 

    public static void main(String[] args) {
        if (args.length != 2)
            oechem.OEThrow.Usage("StereoAndTorsion <infile> <outfile>");

        oemolistream ifs = new oemolistream();
        if (!ifs.open(args[0]))
            oechem.OEThrow.Fatal("Unable to open " + args[1] + " for reading");

        oemolostream ofs = new oemolostream();
        if (!ofs.open(args[1])) { 
            ifs.close();
            oechem.OEThrow.Fatal("Unable to open " +  args[2] + " for writing");
        }

        OEOmegaOptions omegaOpts = new OEOmegaOptions();
        OEOmega omega = new OEOmega(omegaOpts);
        OEMol mol = new OEMol();
        while (oechem.OEReadMolecule(ifs, mol)) {
            oechem.OEThrow.Info("Title: " + mol.GetTitle());

            OEMolBaseIter stereo = oeomegalib.OEFlipper(mol.GetActive(), 12, true);
            while(stereo.hasNext()) {
                mol = new OEMol(stereo.next());
                if (omega.call(mol))
                    oechem.OEWriteMolecule(ofs, mol);
            }
        }
        ifs.close();
        ofs.close();
    }
}

Generating Torsion Driven Conformation Examples

Torsion Driving to Generating Conformer Ensemble

The following code example is a simple example of how to torsion drive from given 3D structure, to generate a conformer ensemble.

See also

Note

This example uses Preliminary API that currently only available in C++ and Python.

Fragment Library generation Examples

Making Fragment Library

The following code example is a simple example of how to generate a fragment library.

See also

Note

This example uses Preliminary API that currently only available in C++ and Python.

Macrocycle Examples

Generating Macrocycle Conformers

The following code example is a simple example of how to generate conformers using the OEMacrocycleOmega object.

Note

This example uses Preliminary API that currently only available in C++ and Python.

Generating a Single Macrocycle Conformer

The following code example is a simple example of how to generate a single macrocycle conformer using the OEMacrocycleBuilder object.

Note

This example uses Preliminary API that currently only available in C++ and Python.