def second_hash(ick): """ the second hash block, indicating connectivity """ assert is_valid(ick) cap_dct = _first_named_capture(PARSE.PATTERN, ick) hash2 = cap_dct[PARSE.HASH2_KEY] return hash2
def formula_layer(ich): """ InChI formula """ cap_dct = _first_named_capture(PARSE.FORMULA.PATTERN, ich) assert cap_dct fml = cap_dct[PARSE.FORMULA.LAYER_KEY] return fml
def is_standard_neutral(ick): """ is this a standard, netural InChIKey? """ assert is_valid(ick) cap_dct = _first_named_capture(PARSE.PATTERN, ick) svp = cap_dct[PARSE.SVP_KEY] return svp == 'SA-N'
def version(ich): """ InChI version """ cap_dct = _first_named_capture(PARSE.PREFIX.PATTERN, ich) assert cap_dct ver = cap_dct[PARSE.PREFIX.CONTENT_KEY] return ver
def prefix(ich): """ InChI prefix """ cap_dct = _first_named_capture(PARSE.PREFIX.PATTERN, ich) assert cap_dct pfx = cap_dct[PARSE.PREFIX.LAYER_KEY] return pfx
def sorted_atom_keys(ich_aux): """ zero-indexed numbering """ cap_dct = _first_named_capture(PARSE.NUMBERING.PATTERN, ich_aux) lyr = cap_dct[PARSE.NUMBERING.CONTENT_KEY] atm_keys = tuple( map(int, _all_captures(PARSE.NUMBERING.NUMBER.PATTERN, lyr))) return atm_keys
def bond_stereo_elements(ich): """ bond stereo keys and values """ cap_dct = _first_named_capture(PARSE.BONDxSTEREO.PATTERN, ich) ret = () if cap_dct: lyr = cap_dct[PARSE.BONDxSTEREO.LAYER_KEY] ret = _all_captures(PARSE.BONDxSTEREO.TERM.PATTERN, lyr) return ret
def key_layer_content(ich, key): """ a sublayer from the InChI string, by key """ key_layer_parser = PARSE.key_layer_(key) cap_dct = _first_named_capture(key_layer_parser.PATTERN, ich) return cap_dct[key_layer_parser.CONTENT_KEY] if cap_dct else None