⚙️ Methods
check_functional_group(file, functional_groups=[], res_format='original')
Check a functional group exists in a compound
Parameters
file : Path | str molecule file format (sdf) or string (sdf) functional_groups : list[str] or CustomChemGraph object functional group (default ['hydroxyl']) or CustomChemGraph object res_format : str result format (default 'original')
Returns
res : dict a list of all count compound : Compound compound object (sdf file)
Source code in pyMolinfo/app.py
compound(f)
Create a compound by parsing sdf file
Parameters
f : str molecule file format (sdf) or string (sdf)
Returns
compound : object compound object
Source code in pyMolinfo/app.py
compound_by_cid(cid)
Create a compound by cid
Parameters
cid : str | int compound id
Returns
compound : object compound object
Source code in pyMolinfo/app.py
compound_by_inchi(inchi)
Create a compound by inchi
Parameters
inchi : str compound inchi
Returns
compound : object compound object
Source code in pyMolinfo/app.py
count_functional_group(file, functional_groups=[], res_format='original')
Counts the occurrences of functional groups within the structure of a compound.
Parameters
file : Path | str molecule file format (sdf) or string (sdf) functional_groups : list[str] or CustomChemGraph object functional group (default ['hydroxyl']) or CustomChemGraph object res_format : str result format (default 'original')
Returns
res : dict a list of all count compound : Compound compound object (sdf file)
Source code in pyMolinfo/app.py
create_custom_functional_groups(functional_groups)
Creates custom functional groups based on the following example.
Parameters
functional_groups : list[dict] or dict functional group
Returns
custom_functional_groups : list[dict] a list of all custom functional group
Examples
# fg1: CH2-O
# fg2: CH2CHO
# List of custom functional groups
custom_functional_group = [
{'fg1': ["C1-H1","C1-H2","C1-O1"]},
{'fg2': ["C1-H1","C1-H2","C1-C2","C2-H3","C2-O2"]}
]
# Dict of custom functional groups
custom_functional_group = {
'fg1': ["C1-H1","C1-H2","C1-O1"],
'fg2': ["C1-H1","C1-H2","C1-C2","C2-H3","C2-O2"]
}
Source code in pyMolinfo/app.py
create_graph(file, graph_name='Graph')
Converts a sdf compound file to a graph
Parameters
file : str molecule file format (sdf)
Returns
graph : object compound graph
Source code in pyMolinfo/app.py
g3d(f, fig_size=[], bg_color='#ffffff', display_legend=True, display_atom_id=True, display_bond_length=False)
3d graph of a compound
Parameters
f : str molecule file format (sdf) or a sdf string variable fig_size : list figure size (default []) bg_color : str background color (default '#ffffff') display_legend : bool display legend (default True) display_atom_id : bool display atom id (default True) display_bond_length : bool display bond length (default True)
Returns
None display 3d graph
Source code in pyMolinfo/app.py
g3d_by_inchi(inchi, fig_size=[], bg_color='#ffffff', display_legend=True, display_atom_id=True, display_bond_length=False)
3d graph of a compound using its InChI identifier
Parameters
inchi : str inchi code fig_size : list figure size (default []) bg_color : str background color (default '#ffffff') display_legend : bool display legend (default True) display_atom_id : bool display atom id (default True) display_bond_length : bool display bond length (default True)
Returns
None display 3d graph
Source code in pyMolinfo/app.py
generate_molecule(molecule_src, molecule_name='MainChain')
Generates a molecule object from custom functional groups.
Parameters
molecule_src : Dict[str, List[str]] | str molecule source molecule_name : str molecule name (default 'MainChain')
Returns
molecule : Molecule molecule object
Examples
# molecule source
molecule_src = {
'MainChain': ["C1-C2","C2-C3","C3*{Chain1}","C3-C4","C4*{Chain2}","C4-C5","C5-C6"],
'Chain1': ["C1=C2","C2-C3","C3=*"],
'Chain2' : ["*-C1","C1=C2","C2-XX3"]
}
Notes
*is a connection point{}is a reference to another chain- C3{Chain1} means C3 is connected to Chain1 from C3=
- Bond index starts from 1 in all chains
- Bond type: single bond (-), double bond (=), triple bond (#)
Source code in pyMolinfo/app.py
view_graph(graph, plot_mode='plotly', **kwargs)
View a graph
Parameters
graph : object compound graph **kwargs : dict - Additional parameters for visualization - figSize: tuple - figure size - bg_color: str - background color - display_legend: bool - display legend - theme: str - theme for visualization ('light' or 'dark') - display_atom_id: bool - display atom IDs - display_bond_length: bool - display bond lengths - bond_type_color: list - colors for different bond types
Returns
None display graph