Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indigo JS and server version returns different response in case of error in molecule #299

Closed
ensemenova opened this issue Jan 18, 2021 · 4 comments

Comments

@ensemenova
Copy link

ensemenova commented Jan 18, 2021

Steps to reproduce

  1. use indigo JS version
  2. call indigo.calculate(struct, indigoOptions) with following parameters
    struct
  Ketcher  1182116422D 1   1.00000     0.00000     0

  4  3  0     0  0            999 V2000
    3.6000   -5.8250    0.0000 *   0  0  0  0  0  0  0  0  0  0  0  0
    4.5659   -6.0838    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.2730   -5.3767    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    6.2390   -5.6355    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0     0  0
  2  3  1  0     0  0
  3  4  1  0     0  0
M  STY  1   1 SRU
M  SLB  1   1   1
M  SCN  1   1 HT 
M  SMT   1 n
M  SAL   1  1   2
M  SBL   1  2   1   2
M  SDI   1  4    4.2771   -6.6789    3.8888   -5.2300
M  SDI   1  4    4.7254   -5.0058    5.1136   -6.4547
M  END
"

options
{smart-layout: true, ignore-stereochemistry-errors: true, mass-skip-error-on-pseudoatoms: false, gross-formula-add-rsites: true, gross-formula-add-isotopes: true}

Actual Result
Error with message "mass: Cannot calculate mass for structure with repeating units" thrown

Expected Result
To be the same as for server API. Object with correct formula and error as value of fields has been returned
{ "gross": "C2 H5(C H2)n", "mass-composition": "error: Cannot calculate mass for structure with repeating units", "molecular-weight": "error: Cannot calculate mass for structure with repeating units", "monoisotopic-mass": "error: Cannot calculate mass for structure with repeating units", "most-abundant-mass": "error: Cannot calculate mass for structure with repeating units" }

@SunFellow
Copy link
Collaborator

SunFellow commented Jan 22, 2021

It looks like the functionality providing Expected behavior is implemented in Server API v2 in Python layer (part of Indigo).
But the functionality of Actual behavior falls to Ketcher standalone layer in JS/TS (part of Ketcher).

In both cases the same Indigo library native functions are called and those functions return a string (either with the calculated mass result or with the error message). The layer above the library constructs the JSON response from individual error messages (according to requested options).

Consider to address this issue to Ketcher JS developers to reimplement the functionality from indigo-service v2 Python layer.

@mkviatkovskii
Copy link
Member

It was discussed with @AndreiMazol - he agreed that throwing the exception is a better way to work. It is impossible when working with REST API, but for indigo-wasm it should be handled on Ketcher side.

@Ksanjara
Copy link

Now when Structure is incorrect Indigo gets zero values in all fields.
We expect that Indigo can get at least Formula of structure in 'Calculate Values' window.

@mkviatkovskii
Copy link
Member

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants