Like existing atom typing schemes, both SMARTY and SMIRKY take a hierarchical approach to defining atom and fragment types. That is, the SMARTS and SMIRKS strings specifying types are listed in a specific order, and the last string that matches an atom or fragment is the one assigned ("last one wins"). For example, in Figure , HC ("[#1$(*-#6)]") would match all hydrogens bound to carbons, but then the string H1 ("[#1$(*-[#6]∼[#8])]") overrides HC on the hydrogens with one oxygen in the beta position. In the SMARTS language the "$" is used to specify neighboring atoms, in "[#1$(*-[#6]∼[#8])]" the hydrogen is connected to a carbon bonded to an oxygen. This hierarchy allows a general pattern to catch all hydrogens that are not described by more specific patterns later in the list. We call a complete, hierarchical type specification of this sort a chemical perception tree. The same approach can be used on a hierarchical list of SMIRKS patterns for fragment types. The PATTY algorithm was developed to automatically assign traditional atom types from a hierarchy, where each atom was assigned the last type matched to it. We adapted PATTY for use in SMARTY and SMIRKY. Specifically, the set of SMARTS or SMIRKS is matched to a molecule using OpenEye's OEChem Toolkit ' and then only the last pattern to match a given atom or fragment is stored.