Package schrodinger :: Package utils :: Module ligfilter
[hide private]
[frames] | no frames]

Module ligfilter

Support module for Ligfilter applications, including parsing functions, filtering criteria, constants, and setting up of the default composite SMARTS patterns.

The basic idea is to provide a set of criteria for filtering structures based on properties, function evaluation, or collections of SMARTS patterns. These criteria can be easily specified in an external file.

Examples of criteria definitons:

   Mol_weight < 300        A predefined criterion type
   i_qp_#amide >= 1        A property-based criterion
   Alcohols == 0           A SMARTS definition matching criterion
   s_sd_Asinex             A check for the existence of a property

General terminology used in the documentation of this module:

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  _MySplit
  Criterion
A base class for a structure matching criterion.
  PropertyCriterion
A structure matching criterion that acts on the presence or value of a specific structure property.
  SmartsCriterion
A structure matching criterion that looks for a match to a Definition instance, which is comprised of a collection of SMARTS patterns.
  PredefinedCriterion
A structure matching criterion that acts on the value of a predefined function applied to the structure.
  AslCriterion
This criterion considers a Structure as matching if the stored ASL expresson match returns at least one atom.
  Definition
A class that defines a collection of SMARTS patterns for matching against.
  CriterionParser
A class for parsing a general property or predefined matching criterion.
  DefinitionParser
A class for parsing a (possibly multi-line) specification of a Definition.
Functions [hide private]
 
mysplit(thestr)
Special version of thestr.split()
 
Num_rings(st)
Return the number of rings in the structure 'st'.
 
Num_aromatic_rings(st)
Return the number of aromatic rings in the structure 'st'.
 
Num_aliphatic_rings(st)
Return the number of aliphatic rings in the structure 'st'.
 
Num_heteroaromatic_rings(st)
Return the number of aromatic rings containing heteroatoms (N, O, S) in the structure 'st'.
 
Num_rotatable_bonds(st)
Return the number of rotatable bonds in the structure 'st', as determined by structutils.analyze.get_num_rotatable_bonds().
 
Num_atoms(st)
Return the number of atoms in the structure 'st'.
 
Num_heavy_atoms(st)
Return the number of non-hydrogen atoms in the structure
 
Num_molecules(st)
Return number of molecules in the structure.
 
Num_residues(st)
Return number of residues in the structure.
 
Molecular_weight(st)
Return the total molecular weight of the structure 'st'.
 
Num_chiral_centers(st)
Return the number of chiral centers in the structure 'st', as determined by structutils.analyze.get_chiral_atoms().
 
Total_charge(st)
Return the total formal charge of the structure 'st'.
 
Num_positive_atoms(st)
Return the number of positive atoms in the structure 'st'.
 
Num_negative_atoms(st)
Return the number of negative atoms in the structure 'st'.
 
Molecular_formula(st)
 
_get_percent_ss_type(st, type)
 
Percent_helix(st)
 
Percent_strand(st)
 
Percent_loop(st)
 
read_keys(fh, validate=False, validdefinitions=None)
Generate lists of Definitions and Criteria from an iterator 'fh' that returns a line at a time of the Definition and Criteria specification.
 
get_default_criterion_parser()
Returns a CriterionParser with default definitions
 
generate_criterion(condition, cp=None)
Ev:55805 Returns a Criterion object for a specified condition string.
 
st_matches_criteria(st, criteria_list, match_any=False, addprops=False)
If the specified structure matches the criteria, returns None.
Variables [hide private]
  DEFAULT_PATTERNS_FILE = 'ligfilter_definitions.lff'
  FILTERFILE_EXT = 'lff'
  OPERATORS = ['==', '!=', '<=', '>=', '<', '>']
  GATES = ['AND', 'OR']
  PROPERTY = 'property'
  PREDEFINED = 'predefined'
  SMARTS = 'smarts'
  ASL = 'asl'
  predefined_function_dict = {'Num_rings': Num_rings, 'Num_aroma...
  PREDEFINED_KEYS = ['Num_rotatable_bonds', 'Molecular_formula',...
  SCHRODINGER = '/nfs/builds/objects/OB/2014-2/Linux-x86_64/buil...
  MMSHARE_EXEC = '/nfs/builds/objects/OB/2014-2/Linux-x86_64/bui...
  MMSHARE_datadir = '/nfs/builds/objects/OB/2014-2/Linux-x86_64/...
  mmshare_data_file = '/nfs/builds/objects/OB/2014-2/Linux-x86_6...
  appdata_dir = '/home/buildbot/.schrodinger'
  appdata_file = '/home/buildbot/.schrodinger/ligfilter_definiti...
  _definition_file_name = '/nfs/builds/objects/OB/2014-2/Linux-x...
  _definition_fh = open(_definition_file_name)
  __package__ = 'schrodinger.utils'
  _criteria = []
  default_definitions = [<schrodinger.utils.ligfilter.Definition...
Function Details [hide private]

mysplit(thestr)

 

Special version of thestr.split()

The following string: "criteria<value" will be split into: ["criteria", "<", "value"]

Implemented so that spaces would not longer be required in criteria.

read_keys(fh, validate=False, validdefinitions=None)

 

Generate lists of Definitions and Criteria from an iterator 'fh' that returns a line at a time of the Definition and Criteria specification. For example, this iterator can be an open file or a list of strings.

If 'validate' is True, definition names in criteria will be checked against known Definitions, including those previously read from 'fh' and passed in via 'validdefinitions'. No expansion of Definitions is done.

Return a tuple of (Definition list, Criterion list).

generate_criterion(condition, cp=None)

 

Ev:55805
Returns a Criterion object for a specified condition string.
Condition string may be something like:
"Num_atoms < 100"

The returned criterion can be then used as follows:

  if criterion.matches(st):
      <do>

Optionally a CriterionParser (cp) may be specified;
otherwise default definitions will be used.

st_matches_criteria(st, criteria_list, match_any=False, addprops=False)

 

If the specified structure matches the criteria, returns None. If does not
match, then a string is returned, explaining the reason.

match_any - if True, st is considers to match if it matches at least
            one criteria; otherwise all criteria must be matched.

addprops - if True, properties for each descriptor is added to st.


Variables Details [hide private]

predefined_function_dict

Value:
{'Num_rings': Num_rings, 'Num_aromatic_rings': Num_aromatic_rings, 'Nu\
m_aliphatic_rings': Num_aliphatic_rings, 'Num_heteroaromatic_rings': N\
um_heteroaromatic_rings, 'Num_rotatable_bonds': Num_rotatable_bonds, '\
Num_atoms': Num_atoms, 'Molecular_weight': Molecular_weight, 'Num_chir\
al_centers': Num_chiral_centers, 'Total_charge': Total_charge, 'Num_po\
sitive_atoms': Num_positive_atoms, 'Num_negative_atoms': Num_negative_\
atoms, 'Num_heavy_atoms': Num_heavy_atoms, 'Num_molecules': Num_molecu\
les, 'Num_residues': Num_residues, 'Molecular_formula': Molecular_form\
...

PREDEFINED_KEYS

Value:
['Num_rotatable_bonds',
 'Molecular_formula',
 'Num_molecules',
 'Percent_strand',
 'Percent_loop',
 'Num_rings',
 'Num_atoms',
 'Molecular_weight',
...

SCHRODINGER

Value:
'/nfs/builds/objects/OB/2014-2/Linux-x86_64/build16'

MMSHARE_EXEC

Value:
'/nfs/builds/objects/OB/2014-2/Linux-x86_64/build16/mmshare-v2.6/bin/L\
inux-x86_64'

MMSHARE_datadir

Value:
'/nfs/builds/objects/OB/2014-2/Linux-x86_64/build16/mmshare-v2.6/bin/L\
inux-x86_64/../../data'

mmshare_data_file

Value:
'/nfs/builds/objects/OB/2014-2/Linux-x86_64/build16/mmshare-v2.6/bin/L\
inux-x86_64/../../data/ligfilter_definitions.lff'

appdata_file

Value:
'/home/buildbot/.schrodinger/ligfilter_definitions.lff'

_definition_file_name

Value:
'/nfs/builds/objects/OB/2014-2/Linux-x86_64/build16/mmshare-v2.6/bin/L\
inux-x86_64/../../data/ligfilter_definitions.lff'

default_definitions

Value:
[<schrodinger.utils.ligfilter.Definition instance at 0x25564758>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564908>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564ab8>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564c20>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564cf8>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564ea8>,
 <schrodinger.utils.ligfilter.Definition instance at 0x25564f38>,
 <schrodinger.utils.ligfilter.Definition instance at 0x255647e8>,
...