Package rdkit :: Package Chem :: Package MolKey :: Module MolKey
[hide private]
[frames] | no frames]

Module MolKey

source code

Classes [hide private]
  MolIdentifierException
  BadMoleculeException
  InchiResult
InchiResult(error, inchi, fixed_ctab)
  MolKeyResult
MolKeyResult(mol_key, error, inchi, fixed_ctab, stereo_code, stereo_comment)
Functions [hide private]
 
_fix_all(pat, sbt, my_string) source code
 
_fix_line_ends(my_string) source code
 
_fix_chemdraw_header(my_string) source code
 
_ctab_has_atoms(ctab_lines)
look at atom count position (line 4, characters 0:3) Return True if the count is >0, False if 0.
source code
 
_ctab_remove_chiral_flag(ctab_lines)
read the chiral flag (line 4, characters 12:15) and set it to 0.
source code
 
initStruchk(configDir=None, logFile=None) source code
 
CheckCTAB(ctab, isSmiles=True) source code
 
GetInchiForCTAB(ctab)
>>> from rdkit.Chem.MolKey import MolKey...
source code
 
_make_racemate_inchi(inchi)
Normalize the stereo information (t-layer) to one selected isomer.
source code
 
_get_identification_string(err, ctab, inchi, stereo_category=None, extra_stereo=None) source code
 
_get_null_mol_identification_string(extra_stereo) source code
 
_get_bad_mol_identification_string(ctab, stereo_category, extra_stereo) source code
 
_identify(err, ctab, inchi, stereo_category, extra_structure_desc=None)
Compute the molecule key based on the inchi string,...
source code
 
_get_chiral_identification_string(n_def, n_udf) source code
 
ErrorBitsToText(err)
returns a list of error bit descriptions for the error code provided
source code
 
GetKeyForCTAB(ctab, stereo_info=None, stereo_comment=None, logger=None)
>>> from rdkit.Chem.MolKey import MolKey...
source code
 
_runDoctests(verbose=None) source code
Variables [hide private]
  MOL_KEY_VERSION = '1'
  ERROR_DICT = {'ALIAS_CONVERSION_FAILED': 2, 'ATOM_CHECK_FAILED...
  INCHI_COMPUTATION_ERROR = 65536
  RDKIT_CONVERSION_ERROR = 131072
  INCHI_READWRITE_ERROR = 262144
  NULL_MOL = 524288
  BAD_SET = 986019
  GET_STEREO_RE = re.compile(r'^InChI=1S(.*?)/(t.*?)/m\d/s1(.*$)')
  NULL_SMILES_RE = re.compile(r'(?i)^\s*$|\s*NO_STRUCTURE\s*$')
  PATTERN_NULL_MOL = '^([\\s0]+[1-9]+[\\s]+V[\\w]*)'
  CHIRAL_POS = 12
  T_NULL_MOL = (524288, '')
  stereo_code_dict = {'DEFAULT': 0, 'MX_DIAST': 22, 'MX_DIAST_AB...
  __initCalled = False
  __package__ = 'rdkit.Chem.MolKey'

Imports: pyAvalonTools, base64, namedtuple, hashlib, logging, os, re, tempfile, uuid, Chem, RDConfig, InchiInfo


Function Details [hide private]

_ctab_has_atoms(ctab_lines)

source code 
look at atom count position (line 4, characters 0:3)
Return True if the count is >0, False if 0.
Throw BadMoleculeException if there are no characters
at the required position or if they cannot be converted
to a positive integer

_ctab_remove_chiral_flag(ctab_lines)

source code 
read the chiral flag (line 4, characters 12:15)
and set it to 0. Return True if it was 1, False if 0.
Throw BadMoleculeException if there are no characters
at the required position or if they where not 0 or 1

GetInchiForCTAB(ctab)

source code 

>>> from rdkit.Chem.MolKey import MolKey
>>> from rdkit.Avalon import pyAvalonTools
>>> res = MolKey.GetInchiForCTAB(pyAvalonTools.Generate2DCoords('c1cn[nH]c1C(Cl)Br',True))
>>> res.inchi
'InChI=1/C4H4BrClN2/c5-4(6)3-1-2-7-8-3/h1-2,4H,(H,7,8)/t4?/f/h8H'
>>> res = MolKey.GetInchiForCTAB(pyAvalonTools.Generate2DCoords('c1c[nH]nc1C(Cl)Br',True))
>>> res.inchi
'InChI=1/C4H4BrClN2/c5-4(6)3-1-2-7-8-3/h1-2,4H,(H,7,8)/t4?/f/h7H'
>>>

_identify(err, ctab, inchi, stereo_category, extra_structure_desc=None)

source code 
Compute the molecule key based on the inchi string,
stereo category as well as extra structure
information 

GetKeyForCTAB(ctab, stereo_info=None, stereo_comment=None, logger=None)

source code 

>>> from rdkit.Chem.MolKey import MolKey
>>> from rdkit.Avalon import pyAvalonTools
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1ccccc1C(F)Cl',True))
>>> res.mol_key
'1|L7676nfGsSIU33wkx//NCg=='
>>> res.stereo_code
'R_ONE'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1ccccc1[C@H](F)Cl',True))
>>> res.mol_key
'1|Aj38EIxf13RuPDQG2A0UMw=='
>>> res.stereo_code
'S_ABS'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1ccccc1[C@@H](F)Cl',True))
>>> res.mol_key
'1|9ypfMrhxn1w0ncRooN5HXw=='
>>> res.stereo_code
'S_ABS'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1cccc(C(Br)Cl)c1[C@@H](F)Cl',True))
>>> res.mol_key
'1|c96jMSlbn7O9GW5d5uB9Mw=='
>>> res.stereo_code
'S_PART'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1cccc([C@H](Br)Cl)c1[C@@H](F)Cl',True))
>>> res.mol_key
'1|+B+GCEardrJteE8xzYdGLA=='
>>> res.stereo_code
'S_ABS'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1cccc(C(Br)Cl)c1C(F)Cl',True))
>>> res.mol_key
'1|5H9R3LvclagMXHp3Clrc/g=='
>>> res.stereo_code
'S_UNKN'
>>> res=MolKey.GetKeyForCTAB(pyAvalonTools.Generate2DCoords('c1cccc(C(Br)Cl)c1C(F)Cl',True),stereo_info='S_REL')
>>> res.mol_key
'1|cqKWVsUEY6QNpGCbDaDTYA=='
>>> res.stereo_code
'S_REL'
>>> res.inchi
'InChI=1/C8H6BrCl2F/c9-7(10)5-3-1-2-4-6(5)8(11)12/h1-4,7-8H/t7?,8?'


Variables Details [hide private]

ERROR_DICT

Value:
{'ALIAS_CONVERSION_FAILED': 2,
 'ATOM_CHECK_FAILED': 256,
 'ATOM_CLASH': 128,
 'BAD_MOLECULE': 1,
 'DUBIOUS_STEREO_REMOVED': 64,
 'EITHER_WARNING': 16,
 'FRAGMENTS_FOUND': 8,
 'INCHI_COMPUTATION_ERROR': 65536,
...

stereo_code_dict

Value:
{'DEFAULT': 0,
 'MX_DIAST': 22,
 'MX_DIAST_ABS': 32,
 'MX_DIAST_REL': 33,
 'MX_ENANT': 21,
 'MX_SP2': 31,
 'OTHER': 100,
 'R_ONE': 11,
...