OBrink / DECIMER.ai

This repository contains the code for https://decimer.ai
MIT License
35 stars 8 forks source link

Some molecules are not loaded into the Ketcher editor #9

Closed OBrink closed 2 years ago

OBrink commented 2 years ago

Seems to be related to backslashes in the smiles

OBrink commented 2 years ago

COC1=C(C=C(C=C1)/C=C\2/C(=O)N([C@]34C5=CC=CC=C5S[C@@]3(S2)C6=CC=CC=C6N4)OC7=C(C=C(C=C7)OC)O)OC

--> `serverFormatter.ts:113 Uncaught (in promise) Error: Convert error! Given string could not be loaded as (query or plain) molecule or reaction, see the error messages: 'scanner: BufferScanner::read() error', 'scanner: BufferScanner::read() error', 'molecule auto loader: SMILES loader: invalid character within atom description: ''', 'molecule auto loader: SMILES loader: invalid character within atom description: ''' at U. (serverFormatter.ts:113:15) at l (runtime.js:63:40) at Generator._invoke (runtime.js:294:22) at Generator.throw (runtime.js:119:21) at n (asyncToGenerator.js:3:20) at u (asyncToGenerator.js:29:9)

Kohulan commented 2 years ago

Hi @OBrink , Maybe a solution?

from rdkit import Chem

Wont parse

smiles= 'COC1=C(C=C(C=C1)/C=C\2/C(=O)N([C@]34C5=CC=CC=C5S[C@@]3(S2)C6=CC=CC=C6N4)OC7=C(C=C(C=C7)OC)O)OC' Chem.MolFromSmiles(smiles)

Will parse

smiles= r'COC1=C(C=C(C=C1)/C=C\2/C(=O)N([C@]34C5=CC=CC=C5S[C@@]3(S2)C6=CC=CC=C6N4)OC7=C(C=C(C=C7)OC)O)OC' Chem.MolFromSmiles(smiles)