Package schrodinger :: Package application :: Package combiglide :: Package packages :: Module chutils :: Class _ParseRulesFile
[hide private]
[frames] | no frames]

Class _ParseRulesFile

Utility functions (no objects) to read and parse joining-rules files and to write new such files with proper syntax.

Instance Methods [hide private]
 
_handle_def(s, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rok_d, rokm_d)
 
_handle_obl(s, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rok_d, rokm_d)
 
_handle_ok(s, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rok_d, rokm_d)
 
_handle_okm(s, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rok_d, rokm_d)
Class Methods [hide private]
 
_strip_line(cls, s)
 
_get_keyword(cls, s)
Find leading keyword and strip it from the input line.
 
read(cls, rules_file, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rok_d, rokm_d)
 
write(cls, rules_file, defs_l, defs_d, rdefs_d, oblig_s, ok_d, okm_d, rokm_d, use_def_names=False)
Dump the (expanded) rules to rules_file
Static Methods [hide private]
 
_expand_defs(s, defs_d)
Replace occurrences of any defined names in s with their definitions and return the resulting string:
 
_undef(s, rdefs_d, use_def_names)
Undo definitions: replace defined SMARTS found in s with the user-defined name, if any, and if use_def_names is True.
Class Variables [hide private]
  re_comment = re.compile(r'^#.*|\s+#.*')
  re_def = re.compile(r'(?i)^DEF\s*:\s*')
  re_obl = re.compile(r'(?i)^OBL\s*:\s*')
  re_ok = re.compile(r'(?i)^OK\s*:\s*')
  re_okm = re.compile(r'(?i)^OK-\s*:\s*')
  re_def_name = re.compile(r'%\w+')
  re_d = {re_def: _handle_def, re_obl: _handle_obl, re_ok: _hand...
Method Details [hide private]

_get_keyword(cls, s)
Class Method

 

Find leading keyword and strip it from the input line. Return the matching regex and the remainder of the line.


Class Variable Details [hide private]

re_d

Value:
{re_def: _handle_def, re_obl: _handle_obl, re_ok: _handle_ok, re_okm: \
_handle_okm}