Querying Functional Groups¶
Query a Specific Pattern in Fragments¶
- group_decomposition.fg_query.query_pattern(frag_frame: DataFrame, patt: str) int[source]¶
Determine number of functional groups matching pattern in fragment table
- Parameters:
frag_frame – fragment frame from output of
group_decomposition.fragfunctions.identify_connected_fragmentsgroup_decomposition.fragfunctions.count_uniques, orgroup_decomposition.fragfunctions.count_groups_in_setpatt – SMARTs string to match functional group. See
group_decomposition.fg_query.fg_dictfor SMARTS of common groups
- Returns:
Number of matches of the functional group queried in the table
- Example Usage:
>>> frag_frame Smiles Molecule count *C=CC=C <mol object> 3 *C=C <mol object> 1 >>> query_pattern(frag_frame,'[$([CX3]=[CX3])]') 7
Note
If the column has a count of the number of times a fragment occurs (count column), multiply the number of matches in a group by the count of times it occurs
Query Many Functional Groups in Fragments¶
- group_decomposition.fg_query.count_fgs(frag_frame: DataFrame, patt_dict: dict) DataFrame[source]¶
Given functional group dictionary with patterns to match, return counts of each in fragment_frame
- Parameters:
frag_frame – fragment frame from output of
group_decomposition.fragfunctions.identify_connected_fragmentsgroup_decomposition.fragfunctions.count_uniques, orgroup_decomposition.fragfunctions.count_groups_in_setpatt_dict – has keys of functional group names and values being a SMARTs string to match
- Returns:
Frame with one column containing names of functional group and another with count
- Example Usage:
>>> frag_frame Smiles Molecule count *C=CC=C <mol object> 3 *C=O <mol object> 1 >>> patt_dict { 'aldehyde': '[CX3H1](=O)[#6]', 'vinylic carbon': '[$([CX3]=[CX3])]' } >>> count_fgs(frag_frame,patt_dict) group count aldehye 1 vinylic carbon 6
Note
If the column has a count of the number of times a fragment occurs (count column), multiply the number of matches in a group by the count of times it occurs