fragment_combination_point¶
This module was developed to label atom indices while considering symmetry.
Warning
The numbering begins at 1 instead of 0.
Usage¶
>>> from rdkit import Chem
>>> from npfc import fragment_combination_point
Module fragment_combination_point¶
This modules contains the functions for annotating and parsing fragment combination point labels in fragments.
- npfc.fragment_combination_point.clear_fcp_suffixes(fcp_str)[source]¶
Remove suffixes from each fcp within provided string.
>>> For instance: >>> '1a,1b,2' becomes: '1,1,2'
- npfc.fragment_combination_point.clear_fcp_suffixes_in_edges(edges)[source]¶
Remove suffixes from each fcp within the attributes found in a list of edges
- npfc.fragment_combination_point.count_symmetry_groups(val)[source]¶
Return the number of symmetry groups found in a fragment.
- npfc.fragment_combination_point.find_symmetry_groups(mol)[source]¶
Search for symmetry groups within a molecule. Symmetry groups are defined as atoms that can have equivalent positions in substructure matches.
This function has been copied from https://sourceforge.net/p/rdkit/mailman/message/27897393/
- npfc.fragment_combination_point.get_fcp_labels(mol)[source]¶
Search for symmetry groups within the input molecule and defines accordingly a label each atom. This label is composed of 2 parts:
a prefix: sequential number that gets incremented for each group
a suffix: sequential letter or string that gets incremented for each element in group
This means that equivalent atoms (within the same group) are given the same prefix but different suffixes.
>>> For instance: >>> '1a', '1b', '2' # 2 equivalent atoms in position 1 >>> '1', '2', '3', '4', '5', '6' # a 6-atoms fragment with no symmetry group >>> '1a', '1b', '1c', '1d', '1e', '1f' # a benzene or cyclohexane
Note
labels prefixes begin at 1, not 0 like atom indices.
- Parameters
mol (
Mol) – the input molecule- Return type
- Returns
a dictionary with the correspondance between atom indices (keys) and atom labels (values)
- npfc.fragment_combination_point.idx_to_label(n)[source]¶
Convert a number to a corresponding letter in the alphabet. In case the number is higher than the number of letters in the english alphabet, then a second character is appended.
>>> For instance: >>>idx_to_label(0) >>> 'a' >>> idx_to_label(25) >>> 'z' >>> idx_to_label(26) >>> 'aa'
This function was inspired after: https://stackoverflow.com/questions/2267362/how-to-convert-an-integer-to-a-string-in-any-base
