예제 #1
0
def rulesView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _rules(data, **kwargs)
예제 #2
0
def standardiseView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _standardise(data, **kwargs)
예제 #3
0
def ctab2smartsView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    return _ctab2smarts(data, **kwargs)
예제 #4
0
def ctab2smartsView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    return _ctab2smarts(data, **kwargs)
예제 #5
0
def standardiseView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _standardise(data, **kwargs)
예제 #6
0
def addHsView(data, params):

    kwargs = dict()
    kwargs['explicitOnly'] = _parseFlag(params.get('explicitOnly', False))
    kwargs['addCoords'] = _parseFlag(params.get('addCoords', False))

    return _addHs(data, **kwargs)
예제 #7
0
def addHsView(data, params):

    kwargs = dict()
    kwargs['explicitOnly'] = _parseFlag(params.get('explicitOnly', False))
    kwargs['addCoords'] = _parseFlag(params.get('addCoords', False))

    return _addHs(data, **kwargs)
예제 #8
0
def smarts2ctabView(data, params):
    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))

    return _smarts2ctab(data, **kwargs)
예제 #9
0
def rulesView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _rules(data, **kwargs)
예제 #10
0
def bondRingsView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return json.dumps(_bondRings(data, **kwargs))
예제 #11
0
def sssrView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return json.dumps(_sssr(data, **kwargs))
예제 #12
0
def symmSSSRView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return json.dumps(_symmsssr(data, **kwargs))
예제 #13
0
def ctab23DView(data, params):
    kwargs = dict()
    kwargs['multi'] = int(params.get('multi', False))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['mmff'] = _parseFlag(params.get('mmff', False))

    return _ctab23D(data, **kwargs)
예제 #14
0
def neutraliseView(data, params):

    kwargs = dict()
    kwargs['balance'] = int(params.get('balance', False))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return _neutralise(data, **kwargs)
예제 #15
0
def neutraliseView(data, params):

    kwargs = dict()
    kwargs['balance'] = int(params.get('balance', False))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return _neutralise(data, **kwargs)
예제 #16
0
def atomIsInRingView(data, params):

    kwargs = dict()
    kwargs['index'] = int(params.get('index'))
    kwargs['size'] = int(params.get('size'))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    return json.dumps(_isAtomInRing(data, **kwargs))
예제 #17
0
def image2smilesView(img, params):

    kwargs = dict()
    kwargs['jaggy'] = _parseFlag(params.get('jaggy', False))
    kwargs['adaptive'] = _parseFlag(params.get('adaptive', False))
    kwargs['unpaper'] = int(params.get('unpaper', 0))

    known_location = '/usr/local/bin/osra'
    if not os.path.exists(known_location):
        known_location = '/usr/bin/osra'
    return _image2smiles(img, config.get('osra_binaries_location', known_location), **kwargs)
예제 #18
0
def sdf2fpsView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['type'] = params.get('type', 'morgan')
    kwargs['radius'] = int(params.get('radius', 2))
    kwargs['n_bits'] = int(params.get('n_bits', 2048))

    return _sdf2fps(data, **kwargs)
예제 #19
0
def ctab2jsonView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend','')
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    response.content_type = 'application/json'

    return _ctab2json(data, **kwargs)
예제 #20
0
def ctab2jsonView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend','')
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))

    response.content_type = 'application/json'

    return _ctab2json(data, **kwargs)
예제 #21
0
def inchi2svgView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend', '')
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))

    response.content_type = 'image/svg+xml'
    return _inchi2svg(data, **kwargs)
예제 #22
0
def inchi2svgView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend','')
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))

    response.content_type = 'image/svg+xml'
    return _inchi2svg(data, **kwargs)
예제 #23
0
def highlightSmilesFragmentSvgView(data, params):

    kwargs = dict()
    smarts = params.get('smarts', '')
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['size'] = int(params.get('size', 200))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['force'] = _parseFlag(params.get('force', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/svg+xml'
    return _highlightSmilesFragmentSVG(data, smarts, **kwargs)
예제 #24
0
def highlightSmilesFragmentSvgView(data, params):

    kwargs = dict()
    smarts = params.get('smarts', '')
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['size'] = int(params.get('size', 200))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['force'] = _parseFlag(params.get('force', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/svg+xml'
    return _highlightSmilesFragmentSVG(data, smarts, **kwargs)
예제 #25
0
def smiles2inchiKeyView(data, params):
    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    return _smiles2inchiKey(data, **kwargs)
예제 #26
0
def smiles2inchiKeyView(data, params):
    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    return _smiles2inchiKey(data, **kwargs)
예제 #27
0
def alignView(data, template, params):
    force = _parseFlag(params.get('force', False))
    ret = _align(data, template, force)
    if ret:
        return ret
    response.status = 404
    response.body = 'No template found in any of structures given.'
예제 #28
0
def sdf2SimilarityMapView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['width'] = int(params.get('width', 100))
    kwargs['height'] = int(params.get('height', 100))
    kwargs['radius'] = int(params.get('radius', 2))
    kwargs['fingerprint'] = params.get('fingerprint', 'morgan')

    response.content_type = 'image/png'
    ret = _sdf2SimilarityMap(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #29
0
def sdf2SimilarityMapView(data, params):

    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['width'] = int(params.get('width', 100))
    kwargs['height'] = int(params.get('height', 100))
    kwargs['radius'] = int(params.get('radius', 2))
    kwargs['fingerprint'] = params.get('fingerprint', 'morgan')

    response.content_type = 'image/png'
    ret = _sdf2SimilarityMap(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #30
0
def ctab2imageView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))

    response.content_type = 'image/png'
    ret = _ctab2image(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #31
0
def ctab2imageView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))

    response.content_type = 'image/png'
    ret = _ctab2image(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #32
0
def smiles2jsonView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend','')
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'application/json'
    return _smiles2json(data, **kwargs)
예제 #33
0
def smiles2jsonView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    kwargs['legend'] = params.get('legend','')
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'application/json'
    return _smiles2json(data, **kwargs)
예제 #34
0
def mcsView(data, params):

    kwargs = dict()
    kwargs['asSmiles'] = _parseFlag(params.get('asSmiles', '0'))
    kwargs['atomCompare'] = params.get('atomCompare', 'elements')
    kwargs['bondCompare'] = params.get('bondCompare', 'bondtypes')
    kwargs['ringMatchesRingOnly'] = _parseFlag(params.get('ringMatchesRingOnly', False))
    kwargs['completeRingsOnly'] = _parseFlag(params.get('completeRingsOnly', False))
    kwargs['threshold'] = params.get('threshold', None)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['canonical'] = _parseFlag(params.get('canonical', True))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))

    return _mcs(data, **kwargs)
예제 #35
0
def highlightSmilesFragmentView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    smarts = params.get('smarts', '')
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['force'] = _parseFlag(params.get('force', True))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/png'
    ret = _highlightSmilesFragment(data, smarts, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #36
0
def highlightCtabFragmentSvgView(data, params):

    kwargs = dict()
    smarts = params.get('smarts', '')
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['force'] = _parseFlag(params.get('force', True))

    response.content_type = 'image/svg+xml'
    return _highlightCtabFragmentSVG(data, smarts, **kwargs)
예제 #37
0
def highlightCtabFragmentSvgView(data, params):

    kwargs = dict()
    smarts = params.get('smarts', '')
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['kekulize'] = _parseFlag(params.get('kekulize', True))
    kwargs['wedgeBonds'] = _parseFlag(params.get('wedgeBonds', True))
    kwargs['fitImage'] = _parseFlag(params.get('fitImage', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['force'] = _parseFlag(params.get('force', True))

    response.content_type = 'image/svg+xml'
    return _highlightCtabFragmentSVG(data, smarts, **kwargs)
예제 #38
0
def mcsView(data, params):

    kwargs = dict()
    kwargs['asSmiles'] = _parseFlag(params.get('asSmiles', '0'))
    kwargs['atomCompare'] = params.get('atomCompare', 'elements')
    kwargs['bondCompare'] = params.get('bondCompare', 'bondtypes')
    kwargs['ringMatchesRingOnly'] = _parseFlag(
        params.get('ringMatchesRingOnly', False))
    kwargs['completeRingsOnly'] = _parseFlag(
        params.get('completeRingsOnly', False))
    kwargs['threshold'] = params.get('threshold', None)
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['canonical'] = _parseFlag(params.get('canonical', True))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))

    return _mcs(data, **kwargs)
예제 #39
0
def smiles2imageView(data, params):

    kwargs = dict()
    kwargs['size'] = int(params.get('size', 200))
    separator = params.get('separator', '|')
    kwargs['legend'] = params.get('legend', '').split(separator)
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['atomMapNumber'] = _parseFlag(params.get('atomMapNumber', False))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/png'
    ret = _smiles2image(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #40
0
def smiles2SimilarityMapView(data, params):

    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['width'] = int(params.get('width', 100))
    kwargs['height'] = int(params.get('height', 100))
    kwargs['radius'] = int(params.get('radius', 2))
    kwargs['fingerprint'] = params.get('fingerprint', 'morgan')

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/png'
    ret = _smiles2SimilarityMap(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #41
0
def smiles2SimilarityMapView(data, params):

    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['width'] = int(params.get('width', 100))
    kwargs['height'] = int(params.get('height', 100))
    kwargs['radius'] = int(params.get('radius', 2))
    kwargs['fingerprint'] = params.get('fingerprint', 'morgan')

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    response.content_type = 'image/png'
    ret = _smiles2SimilarityMap(data, **kwargs)
    if request.is_ajax:
        ret = base64.b64encode(ret)
    return ret
예제 #42
0
def ctab2smilesView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['nameHeader'] = params.get('nameHeader', 'Name')
    kwargs['includeHeader'] = _parseFlag(params.get('includeHeader', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))
    return _ctab2smiles(data, **kwargs)
예제 #43
0
def ctab2smilesView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    kwargs['delimiter'] = params.get('delimiter', ' ')
    kwargs['nameHeader'] = params.get('nameHeader', 'Name')
    kwargs['includeHeader'] = _parseFlag(params.get('includeHeader', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))
    return _ctab2smiles(data, **kwargs)
예제 #44
0
def canonicalizeSmilesView(data, params):
    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['in_delimiter'] = params.get('in_delimiter', ' ')
    kwargs['out_delimiter'] = params.get('out_delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['nameHeader'] = params.get('nameHeader', 'Name')
    kwargs['includeHeader'] = _parseFlag(params.get('includeHeader', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    return _canonicalize_smiles(data, **kwargs)
예제 #45
0
def canonicalizeSmilesView(data, params):
    kwargs = dict()
    kwargs['computeCoords'] = _parseFlag(params.get('computeCoords', False))
    kwargs['in_delimiter'] = params.get('in_delimiter', ' ')
    kwargs['out_delimiter'] = params.get('out_delimiter', ' ')
    kwargs['smilesColumn'] = int(params.get('smilesColumn', 0))
    kwargs['nameColumn'] = int(params.get('nameColumn', 1))
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['nameHeader'] = params.get('nameHeader', 'Name')
    kwargs['includeHeader'] = _parseFlag(params.get('includeHeader', True))
    kwargs['isomericSmiles'] = _parseFlag(params.get('isomericSmiles', False))
    kwargs['kekuleSmiles'] = _parseFlag(params.get('kekuleSmiles', False))

    if params.get('titleLine') is None and not data.startswith('SMILES Name'):
        kwargs['titleLine'] = False
    else:
        kwargs['titleLine'] = _parseFlag(params.get('titleLine', True))

    return _canonicalize_smiles(data, **kwargs)
예제 #46
0
def removeHsView(data, params):

    kwargs = dict()
    kwargs['implicitOnly'] = _parseFlag(params.get('implicitOnly', False))
    return _removeHs(data, **kwargs)
예제 #47
0
def removeHsView(data, params):

    kwargs = dict()
    kwargs['implicitOnly'] = _parseFlag(params.get('implicitOnly', False))
    return _removeHs(data, **kwargs)
예제 #48
0
def ctab2inchiKeyView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _ctab2inchiKey(data, **kwargs)
예제 #49
0
def ctab2inchiKeyView(data, params):
    kwargs = dict()
    kwargs['sanitize'] = _parseFlag(params.get('sanitize', True))
    kwargs['removeHs'] = _parseFlag(params.get('removeHs', True))
    kwargs['strictParsing'] = _parseFlag(params.get('strictParsing', True))
    return _ctab2inchiKey(data, **kwargs)
예제 #50
0
def ctab2xyzView(data, params):
    computeCoords = _parseFlag(params.get('computeCoords', True))
    return _ctab2xyz(data, computeCoords)