Beispiel #1
0
def _sanitize(data, sanitizeOps=SANITIZE_ALL):
    mols = _parseMolData(data, sanitize=False, removeHs=False, strictParsing=False)
    try:
        _apply(mols, Chem.SanitizeMol, sanitizeOps=sanitizeOps)
    except:
        pass
    return _getSDFString(mols)
Beispiel #2
0
def _align(data, template, force=False):
    mols = _parseMolData(data)
    if template:
        pattern = _parseMolData(template)
    else:
        pattern = [mols[0]]
        mols = mols[1:]
    if not pattern or not mols or len(pattern) != 1:
        return 'Wrong arguments'
    aligned_mols = ct._align(mols, pattern[0], force)
    if aligned_mols:
        return _getSDFString(aligned_mols)
Beispiel #3
0
def _smarts2ctab(data, computeCoords=True, delimiter=' ', sanitize=True):
    mols = []
    for line in data.splitlines():
        if not line:
            continue
        for chunk in line.strip().split(delimiter):
            if not chunk:
                continue
            mols.append(_molFromSmarts(chunk))
    if computeCoords:
        _apply(mols, _computeCoords, True)
    if sanitize:
        _apply(mols, _sanitize)
    return _getSDFString(mols)
Beispiel #4
0
def _smiles2ctab(data, computeCoords=True, delimiter=' ', smilesColumn=0, nameColumn=1, titleLine=True, sanitize=True):
    return _getSDFString(_parseSMILESData(data, computeCoords=computeCoords, delimiter=delimiter,
                                          smilesColumn=smilesColumn, nameColumn=nameColumn, titleLine=titleLine,
                                          sanitize=sanitize))
Beispiel #5
0
def _standardise(data):
    mols = _parseMolData(data)
    res = _apply(mols, standardise)
    return _getSDFString(res)

#-----------------------------------------------------------------------------------------------------------------------
Beispiel #6
0
def _unsalt(data):
    mols = _parseMolData(data)
    res = _apply(mols, unsalt)
    return _getSDFString(res)
Beispiel #7
0
def _ctab23D(data, multi, mmff, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    optimisedMols = _apply(mols, _2D23D, multi, mmff)
    return _getSDFString(optimisedMols)
Beispiel #8
0
def _unsalt(data, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    res = _apply(mols, unsalt)
    return _getSDFString(res)
Beispiel #9
0
def _break_bonds(data, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    res = _apply(mols, break_bonds)
    return _getSDFString(res)
Beispiel #10
0
def _ctab23D(data, multi, mmff):
    mols = _parseMolData(data)
    optimisedMols = _apply(mols, _2D23D, multi, mmff)
    return _getSDFString(optimisedMols)
Beispiel #11
0
def _addHs(data, explicitOnly=False, addCoords=False):
    mols = _parseMolData(data, sanitize=True, removeHs=False, strictParsing=True)
    mols = _apply(mols, Chem.AddHs, explicitOnly=explicitOnly, addCoords=addCoords)
    return _getSDFString(mols)
Beispiel #12
0
def _kekulize(data, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    _apply(mols, Chem.Kekulize)
    return _getSDFString(mols)
Beispiel #13
0
def _smiles2ctab(data):
    return _getSDFString(_parseSMILESData(data, True))
Beispiel #14
0
def _smiles23D(data, multi, mmff, computeCoords=False, delimiter=' ', smilesColumn=0, nameColumn=1,
               titleLine=True, sanitize=True):
    mols = _parseSMILESData(data, computeCoords=computeCoords, delimiter=delimiter, smilesColumn=smilesColumn,
        nameColumn=nameColumn, titleLine=titleLine, sanitize=sanitize)
    optimisedMols = _apply(mols, _2D23D, multi, mmff)
    return _getSDFString(optimisedMols)
Beispiel #15
0
def _removeHs(data, implicitOnly=False):
    mols = _parseMolData(data, sanitize=False, removeHs=False, strictParsing=True)
    mols = _apply(mols, Chem.RemoveHs, implicitOnly=implicitOnly)
    return _getSDFString(mols)
Beispiel #16
0
def _inchi2ctab(inchis):
    mols = _apply(inchis.split(),Chem.MolFromInchi)
    _apply(mols, _computeCoords)
    return _getSDFString(mols)
Beispiel #17
0
def _break_bonds(data):
    mols = _parseMolData(data)
    res = _apply(mols, break_bonds)
    return _getSDFString(res)
Beispiel #18
0
def _smiles23D(data, multi, mmff):
    mols = _parseSMILESData(data)
    optimisedMols = _apply(mols, _2D23D, multi, mmff)
    return _getSDFString(optimisedMols)
Beispiel #19
0
def _neutralise(data, balance):
    mols = _parseMolData(data)
    res = _apply(mols, neutralise, balance)
    return _getSDFString(res)
Beispiel #20
0
def _neutralise(data, balance, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    res = _apply(mols, neutralise, balance)
    return _getSDFString(res)
Beispiel #21
0
def _rules(data):
    mols = _parseMolData(data)
    res = _apply(mols, rules)
    return _getSDFString(res)
Beispiel #22
0
def _standardise(data, sanitize=True, removeHs=True, strictParsing=True):
    mols = _parseMolData(data, sanitize=sanitize, removeHs=removeHs, strictParsing=strictParsing)
    res = _apply(mols, standardise)
    return _getSDFString(res)
Beispiel #23
0
def _kekulize(data):
    mols = _parseMolData(data)
    _apply(mols, Chem.Kekulize)
    return _getSDFString(mols)