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)
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)
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)
def addHsView(data, params): kwargs = dict() kwargs['explicitOnly'] = _parseFlag(params.get('explicitOnly', False)) kwargs['addCoords'] = _parseFlag(params.get('addCoords', False)) return _addHs(data, **kwargs)
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)
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))
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))
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))
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)
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)
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))
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)
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)
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)
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)
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)
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)
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)
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.'
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
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
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)
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)
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
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)
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)
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
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
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)
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)
def removeHsView(data, params): kwargs = dict() kwargs['implicitOnly'] = _parseFlag(params.get('implicitOnly', False)) return _removeHs(data, **kwargs)
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)
def ctab2xyzView(data, params): computeCoords = _parseFlag(params.get('computeCoords', True)) return _ctab2xyz(data, computeCoords)