fragment_combination_point

This module was developed to label atom indices while considering symmetry.

Warning

The numbering begins at 1 instead of 0.

pic1

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'
Parameters

fcp – a list of Fragment Connection Points

Return type

List[str]

Returns

the simplified list

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

Parameters

edges (list) – a list of edges ([[u1, v1, d1], [u2, v2, d2]]), with u and v the nodes and d a dictionary of attributes

Return type

list

Returns

the updated edges

npfc.fragment_combination_point.count_symmetry_groups(val)[source]

Return the number of symmetry groups found in a fragment.

Parameters

val (Union[Mol, List[str]]) – either a fragment as Mol object or the fragment connection points as dict

Return type

int

Returns

the count of symmetry groups

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/

Parameters

mol (Mol) – the input molecule

Return type

Tuple[Tuple[int]]

Returns

a tuple of tuples of atom indices. Each tuple represents a symmetry group and inside are the atom indices.

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

dict

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

Parameters

n (int) – the input number

Return type

str

Returns

the corresponding string