orthonym.rules.seniority#

Note

Internal API. Names and behaviour may change between releases.

Functional group seniority rules for principal group selection.

Based on IUPAC 2013 Blue Book to. The principal group (highest seniority) becomes the suffix; all other groups become prefixes.

orthonym.rules.seniority.get_principal_group(mol, functional_groups)#

Determine the principal characteristic group.

The principal group is the highest-seniority functional group that will be expressed as a suffix in the name.

Parameters:
  • mol – RDKit Mol object

  • functional_groups (Dict[str, List[tuple]]) – Dict from detect_functional_groups

Returns:

Tuple of (group_name, list_of_atom_index_tuples) Returns (None, ) if no suffix-capable group found

Return type:

Tuple[str | None, List[tuple]]

orthonym.rules.seniority.get_suffix(fg_name, is_ring=False)#

Get the suffix form for a functional group.

Parameters:
  • fg_name (str) – Name of functional group

  • is_ring (bool) – True if the group is attached to a ring (not terminal on chain)

Returns:

Suffix string, or None if group has no suffix form

Return type:

str | None

orthonym.rules.seniority.get_prefix(fg_name)#

Get the prefix form for a functional group.

Used when the group is not the principal group.

Parameters:

fg_name (str) – Name of functional group

Returns:

Prefix string, or None if group has no standard prefix form

Return type:

str | None

orthonym.rules.seniority.is_suffix_group(fg_name)#

Check if a functional group can be expressed as a suffix.

Parameters:

fg_name (str) – Name of functional group

Returns:

True if group can be a suffix (is in seniority order)

Return type:

bool

orthonym.rules.seniority.compare_seniority(fg1, fg2)#

Compare seniority of two functional groups.

Parameters:
  • fg1 (str) – Names of functional groups

  • fg2 (str) – Names of functional groups

Returns:

-1 if fg1 is higher seniority

0 if equal seniority (or both not in list) 1 if fg2 is higher seniority

Return type:

int

orthonym.rules.seniority.get_all_prefix_groups(functional_groups, principal_group)#

Get all functional groups that should be named as prefixes.

This includes all groups except the principal group.

Parameters:
  • functional_groups (Dict[str, List[tuple]]) – Dict from detect_functional_groups

  • principal_group (str | None) – Name of the principal group (or None)

Returns:

Dict of functional group names to their atom indices, excluding the principal group

Return type:

Dict[str, List[tuple]]