2.1.1.4.1.1. wc_utils.util.chem package¶
2.1.1.4.1.1.1. Submodules¶
2.1.1.4.1.1.2. wc_utils.util.chem.core module¶
Chemistry utilities
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2018-02-07
- Copyright
2018, Karr Lab
- License
MIT
-
class
wc_utils.util.chem.core.
EmpiricalFormula
(value='')[source]¶ Bases:
attrdict.default.AttrDefault
An empirical formula
-
__add__
(other)[source]¶ Add two empirical formulae
- Parameters
other (
EmpiricalFormula
orstr
) – another empirical formula- Returns
sum of the empirical formulae
- Return type
-
__contains__
(element)[source]¶ - Parameters
element (
str
) – element symbol- Returns
True
if the empirical formula contains the element- Return type
bool
-
__div__
(quantity)[source]¶ Subtract two empirical formulae (for Python 2)
- Parameters
quantity (
float
) –- Returns
division of the empirical formula by
quantity
- Return type
-
__mul__
(quantity)[source]¶ Subtract two empirical formulae
- Parameters
quantity (
float
) –- Returns
multiplication of the empirical formula by
quantity
- Return type
-
__setitem__
(element, coefficient)[source]¶ Set the count of an element
- Parameters
element (
str
) – element symbolcoefficient (
float
) – element coefficient
- Raises
ValueError – if the coefficient is not a float
-
__sub__
(other)[source]¶ Subtract two empirical formulae
- Parameters
other (
EmpiricalFormula
orstr
) – another empirical formula- Returns
difference of the empirical formulae
- Return type
-
-
class
wc_utils.util.chem.core.
OpenBabelUtils
[source]¶ Bases:
object
-
classmethod
export
(mol, format, options=())[source]¶ Export an OpenBabel molecule to format
- Parameters
mol (
openbabel.OBMol
) – moleculeformat (
str
) – formatoptions (
list
ofstr
, optional) – export options
- Returns
format representation of molecule
- Return type
str
-
static
get_formula
(mol)[source]¶ Get the formula of an OpenBabel molecule
- Parameters
mol (
openbabel.OBMol
) – molecule- Returns
formula
- Return type
-
classmethod
2.1.1.4.1.1.3. wc_utils.util.chem.marvin module¶
Chemistry utilities from ChemAxon Marvin
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2020-01-07
- Copyright
2018-2020, Karr Lab
- License
MIT
-
wc_utils.util.chem.marvin.
draw_molecule
(structure, format, image_format='svg', atom_labels=None, atom_label_font_size=0.4, atom_sets=None, bond_sets=None, show_atom_nums=False, width=200, height=200, include_xml_header=True)[source]¶ Draw an image of a molecule
- Parameters
structure (
str
) – chemical structureformat (
str
) – format ofstructure
(e.g. ‘inchi’ or ‘smiles’)image_format (
str
, optional) – format of generated image {emf, eps, jpeg, msbmp, pdf, png, or svg}atom_labels (
list
ofdict
, optional) – list of atom labels (dictionaries with keys {position, element, label, color})atom_label_font_size (
float
, optional) – font size of atom labelsatom_sets (
list
ofdict
, optional) – list of atom sets (dictionaries with keys {positions, elements, color})bond_sets (
list
ofdict
, optional) – list of bond sets (dictionaries with keys {positions, elements, color})show_atom_nums (
bool
, optional) – ifTrue
, show the numbers of the atomswidth (
int
, optional) – width in pixelsheight (
int
, optional) – height in pixelsinclude_xml_header (
bool
, optional) – ifTrue
, include XML header
- Returns
image of chemical structure
- Return type
str
-
wc_utils.util.chem.marvin.
get_major_micro_species
(structure_or_structures, in_format, out_format, ph=7.4, major_tautomer=False, keep_hydrogens=False, dearomatize=False)[source]¶ Get the major protonation state of one or more compounds at a specific pH.
- Parameters
structure_or_structures (
str
orlist
ofstr
) – chemical structure or list of chemical structuresin_format (
str
) – format ofstructure_or_structures
(e.g. ‘inchi’ or ‘smiles’)out_format (
str
) – format of output (e.g. ‘inchi’ or ‘smiles’)ph (
float
, optional) – pH at which to calculate major protonation microspeciesmajor_tautomer (
bool
, optional) – ifTrue
, use the major tautomeric in the calculationkeep_hydrogens (
bool
, optional) – ifTrue
, keep explicity defined hydrogensdearomatize (
bool
, optional) – ifTrue
, dearomatize molecule
- Returns
- protonated chemical structure or
list of protonated chemical structures
- Return type
str
orlist
ofstr