def smiles2ctab(): """ Converts SMILES to CTAB. This method accepts single or multiple SMILES or *.smi file. """ data = request.body.read() if not data.startswith('SMILES Name'): data = "SMILES Name\n" + data return _smiles2ctab(data)
def smiles2ctab(smiles): """ Converts SMILES to CTAB. This method accepts urlsafe_base64 encoded string containing single or multiple SMILES optionally containing header line, specific to *.smi format. """ data = base64.urlsafe_b64decode(smiles) if not data.startswith('SMILES Name'): data = "SMILES Name\n" + data return _smiles2ctab(data)
def smiles2ctabView(data, params): kwargs = dict() 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)) if params.get('titleLine') is None and not data.startswith('SMILES Name'): kwargs['titleLine'] = False else: kwargs['titleLine'] = _parseFlag(params.get('titleLine', True)) return _smiles2ctab(data, **kwargs)