Package CHEM :: Package Common :: Module Model :: Class ChemicalSearchModel
[hide private]
[frames] | no frames]

Class ChemicalSearchModel



Model object to build to define search criteria for chemicals.

For similarity searches, should have OEBaseMol objects in the similarMols list. Furthermore, similarity search options should be set as "FloatData" on the molecules. For example, to set the alpha / beta parameters for super vs. sub-structure searches, do the following first, or else default values will be assumed:

from Const import ALPHA, BETA, WEIGHT; mol.SetFloatData(ALPHA, 0.9); mol.SetFloatData(BETA, 0.1);

Rather than having multiple options for search by can_smiles, chemical_id, etc. just build a list of "discreteCriteria" and have the user supply the name of the column to compare against and a list of values to expect. Likewise, rather than separate options for searching by logp, num_heavy_atoms, etc., just build a list of "rangeCriteria" and have the user supply the name of the column and the boundary values to expect.

Instance Methods [hide private]
 
__init__(self)
 
addSimilarMol(self, mol, alpha=1.0, beta=1.0, weight=1.0)
Convenience function to specify similar molecule parameters
 
addSimilarMolBySmiles(self, smiles, alpha=1.0, beta=1.0, weight=1.0)
Convenience function to specify molecule by SMILES
 
setTextCriteria(self, textValue, field)
Search by text criteria.
 
getTextCriteria(self)
 
addDiscreteCriteria(self, column, valueList)
Tell search to find rows where the named column has values in the provided value list.
 
popDiscreteCriteria(self)
Remove the last discrete criteria specified, and return the respective tuple.
 
iterDiscreteCriteria(self)
Return iterator over discrete criteria tuples
 
addRangeCriteria(self, column, minValue, maxValue)
Tell search to find rows where the named column has values >= the minValue and <= the maxValue.
 
iterRangeCriteria(self)
Return iterator over range criteria tuples
Method Details [hide private]

addDiscreteCriteria(self, column, valueList)

 

Tell search to find rows where the named column has values in the provided value list.

Note, for extra safety, the column name should include the table name as well, like "chemical.can_smiles" not just "can_smiles" in case the query joins to other tables with the same column name, an ambiguous column reference will break the query.

popDiscreteCriteria(self)

 
Remove the last discrete criteria specified, and return the respective tuple. If none exist, return None.

addRangeCriteria(self, column, minValue, maxValue)

 

Tell search to find rows where the named column has values >= the minValue and <= the maxValue.

Note, for extra safety, the column name should include the table name as well, like "chemical.molecular_weight" not just "molecular_weight".