OESubSearchScreenType

Attention

This is a preliminary API and may be improved based on user feedback. It is currently available in C++ and Python.

The OESubSearchScreen objects are typed bit-vectors. The type of a screen determines what kind of queries in mind the screen was designed.

In OEChem TK, a query molecule (OEQMolBase) can be constructed in three different ways.

Screen Type

Description

Initialize

See Also

OESubSearchScreenType_MDL

query read from MDL query file

OEReadMDLQueryFile

Substructure Search with MDL Queries

OESubSearchScreenType_Molecule

query built from molecule

BuildExpressions

OESubSearchScreenType_SMARTS

query built from SMARTS pattern

OEParseSmarts

SMARTS Pattern Matching

The expression trees of the queries that are initialized from different sources can be significantly different. For example, the “language” of SMARTS is the most expressive one allowing complex logical operations and recursive patterns. A SMARTS such as [NX3;H2,H1;!$(NC=O)] (primary or secondary amine that is not in amide) defines a substructure that can not be expressed using MDL query features. This also makes queries built from SMARTS the most complex ones. The other major difference between SMARTS and MDL queries is the way how they are expected to match aromaticity. For these reasons, OEChem TK provides three different screen types especially designed for the three different ways that are available to built query molecules using OEChem TK.

Note

For performance reason, OEChem TK does not support screening-based fast substructure search with explicit hydrogens. The OEMakeSubSearchTargetScreen function automatically suppresses explicit hydrogens of the molecule prior to the screen generation. The OEMakeSubSearchQueryScreen function will return false if the query molecule has any explicit hydrogen expression.

Default

The default screen type is OESubSearchScreenType_MDL.

MDL

The following code snippet shows how to create OESubSearchScreenType_MDL screens.

qmol = oechem.OEQMol()
queryopts = oechem.OEMDLQueryOpts_Default | oechem.OEMDLQueryOpts_SuppressExplicitH
oechem.OEReadMDLQueryFile(ifs, qmol, queryopts)

qscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchQueryScreen(qscreen, qmol, oechem.OESubSearchScreenType_MDL):
    print("query MDL screen cannot be generated")

tmol = oechem.OEGraphMol()
oechem.OESmilesToMol(tmol, "c1c[nH]cc1")

tscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchTargetScreen(tscreen, tmol, oechem.OESubSearchScreenType_MDL):
    print("target MDL screen cannot be generated")

Molecule

The following code snippet shows how to create OESubSearchScreenType_Molecule screens. The query molecule is created from a “real” molecule using the BuildExpressions method.

qmol = oechem.OEQMol()
oechem.OESmilesToMol(qmol, "c1cnccc1")
qmol.BuildExpressions(oechem.OEExprOpts_DefaultAtoms, oechem.OEExprOpts_DefaultBonds)

qscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchQueryScreen(qscreen, qmol, oechem.OESubSearchScreenType_Molecule):
    print("query Molecule screen cannot be generated")

tmol = oechem.OEGraphMol()
oechem.OESmilesToMol(tmol, "c1ccc2c(c1)cccn2")

tscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchTargetScreen(tscreen, tmol, oechem.OESubSearchScreenType_Molecule):
    print("target Molecule screen cannot be generated")

Note

SMARTS

The following code snippet shows how to create OESubSearchScreenType_SMARTS screens.

qmol = oechem.OEQMol()
oechem.OEParseSmarts(qmol, "C1CC[O,N]CC1")

# generate screens
qscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchQueryScreen(qscreen, qmol, oechem.OESubSearchScreenType_SMARTS):
    print("query SMARTS screen cannot be generated")

tmol = oechem.OEGraphMol()
oechem.OESmilesToMol(tmol, "C1CCOCC1")

tscreen = oechem.OESubSearchScreen()
if not oechem.OEMakeSubSearchTargetScreen(tscreen, tmol, oechem.OESubSearchScreenType_SMARTS):
    print("target SMARTS screen cannot be generated")

Hint

In case of a query molecule of unknown source, the OEIsComplementaryScreenType function can be used to check whether the query molecule is suited for a specific screen type.