def fromAugmentedInChI(mol, aug_inchi): """ Creates a Molecule object from the augmented inchi. First, the inchi is converted into a Molecule using the backend parsers. Next, the multiplicity and unpaired electron information is used to fix a number of parsing errors made by the backends. Finally, the atom types of the corrected molecule are perceived. Returns a Molecule object """ if not isinstance(aug_inchi, inchiutil.AugmentedInChI): aug_inchi = inchiutil.AugmentedInChI(aug_inchi) mol = fromInChI(mol, aug_inchi.inchi) mol.multiplicity = len(aug_inchi.u_indices) + 1 if aug_inchi.u_indices else 1 inchiutil.fix_molecule(mol, aug_inchi) mol.updateAtomTypes() return mol
def fromAugmentedInChI(mol, aug_inchi): """ Creates a Molecule object from the augmented inchi. First, the inchi is converted into a Molecule using the backend parsers. Next, the multiplicity and unpaired electron information is used to fix a number of parsing errors made by the backends. Finally, the atom types of the corrected molecule are perceived. Returns a Molecule object """ if not isinstance(aug_inchi, inchiutil.AugmentedInChI): aug_inchi = inchiutil.AugmentedInChI(aug_inchi) mol = fromInChI(mol, aug_inchi.inchi) mol.multiplicity = len(aug_inchi.u_indices) + 1 if aug_inchi.u_indices else 1 inchiutil.fix_molecule(mol, aug_inchi) mol.updateAtomTypes() return mol