polymerist.rdutils.rdgraphs

Utilities for interfacing between RDKit Mols and their graph representations

Attributes

DEFAULT_ATOM_PROPS

DEFAULT_BOND_PROPS

Functions

chemical_graph(→ networkx.Graph)

Converts an RDKit molecule to its network form, with nodes numbered by atom indices

rdmol_to_networkx(→ networkx.Graph)

Convert an RDKit Mol into a NetworkX Graph with nodes numbered according to atom IDs and bonds between corresponding atoms

Module Contents

polymerist.rdutils.rdgraphs.DEFAULT_ATOM_PROPS = ('AtomMapNum', 'AtomicNum', 'Degree', 'ExplicitValence', 'FormalCharge', 'ImplicitValence',...
polymerist.rdutils.rdgraphs.DEFAULT_BOND_PROPS = ('BondDir', 'BondType', 'BondTypeAsDouble', 'Idx', 'IsAromatic', 'IsConjugated', 'Stereo')
polymerist.rdutils.rdgraphs.chemical_graph(mol: rdkit.Chem.Mol) networkx.Graph[source]

Converts an RDKit molecule to its network form, with nodes numbered by atom indices Returned Graph does NOT contain any chemical information or properties of any bonds or atoms, only topological (i.e. connectivty) information

polymerist.rdutils.rdgraphs.rdmol_to_networkx(rdmol: rdkit.Chem.Mol, atom_attrs: Iterable[str] = DEFAULT_ATOM_PROPS, bond_attrs: Iterable[str] = DEFAULT_BOND_PROPS) networkx.Graph[source]

Convert an RDKit Mol into a NetworkX Graph with nodes numbered according to atom IDs and bonds between corresponding atoms Copies over all Atom and Bond Props that have been set. Can also port other atom and bond properties over to the resulting graph by specifying attributes to copy over