Skip to content

Commit

Permalink
Added registries for reverse lookup by SMILES+SMARTS
Browse files Browse the repository at this point in the history
  • Loading branch information
timbernat committed Apr 10, 2024
1 parent eec131d commit 6c084a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions polymerist/rdutils/smileslib/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
in_line_fmt = in_line_fmt.upper()
rd_prefix = rd_type.__name__.upper()

globals()[f'BONDTYPE_BY_BOND_{in_line_fmt}'] = type_by_bonds = {}
globals()[f'ORDER_BY_BOND_{in_line_fmt}' ] = order_by_bonds = {}
globals()[f'BOND_{in_line_fmt}_BY_BONDTYPE'] = bonds_by_type = {}
globals()[f'BOND_{in_line_fmt}_BY_ORDER' ] = bonds_by_order = {}
globals()[f'RDKIT_{rd_prefix}S_BY_BONDTYPE'] = rdbonds_by_type = {}
Expand All @@ -24,6 +26,8 @@
rd_bond = rd_initializer(prim_str)
if (rd_bond is not None) and (type(rd_bond) == rd_type):
bondtype, order = rd_bond.GetBondType(), rd_bond.GetBondTypeAsDouble()
type_by_bonds[prim_str] = bondtype
order_by_bonds[prim_str] = order
bonds_by_type[bondtype] = prim_str
bonds_by_order[order] = prim_str
rdbonds_by_type[bondtype] = rd_bond
Expand Down

0 comments on commit 6c084a1

Please sign in to comment.