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

V2000 Mol file loader skips essential SGroup line in certain cases #2732

Open
smz-bayer opened this issue Jan 22, 2025 · 0 comments · May be fixed by #2736
Open

V2000 Mol file loader skips essential SGroup line in certain cases #2732

smz-bayer opened this issue Jan 22, 2025 · 0 comments · May be fixed by #2736
Labels
Export to MOL Bucket: Export to MOL related issues User`s Feedback

Comments

@smz-bayer
Copy link

Summary
Reading a V2000 molfile that contains a line M SCN .... HT without the trailing space will skip the following molfile line if the M SCN line is not in an SGroup of type "SRU"

Steps to Reproduce

  1. Use Indigo library with .NET wrapper in a .NET C# console application project.
  2. Load attached molfile into string "mol":
    string mol = File.ReadAllText(@"C:\Temp\mul_with_scn_no_space_before_eol.txt");
  3. Load that string into an Indigo molecule and write it back as another molfile string:
    using (var indigo = new com.epam.indigo.Indigo()) { string loadAndBack = indigo.loadMolecule(mol).molfile(); }

Actual behavior
The new molfile string now contains a molfile where an essential line is missing from the SGroup information:
That missing line is M SAL 1 3 2 4 5, and it was immediately following the line M SCN 1 1 HT

Expected behavior
The new molfile string should contain a complete molfile with correctly written SGroup information.
It might be slightly rearranged and have unneccessary information removed, but it must still contain the line M SAL 1 3 2 4 5

Environment details:

  • Windows 11
  • Indigo.NET nuget package 1.26.0 or 1.28.0-rc.2

Attachments
mul_with_scn_no_space_before_eol.txt

Additional context
According to V2000 MOL file spec, a line M SCN .... ends with a left justified 3-digit string.
However, all of the alternatives for that string only have 2 digits ("HH", "HT", or "EU").
Thus, the trailing space may be present or absent, still yielding a valid mol file.

The Indigo code has an extra check to deal with that, but the check only works if the M SCN ... line belongs to an SGroup of type "SRU".

In older molfiles you often find M SCN ... lines in other SGroup types, like "MUL". They may be removed without harm in such cases, but the rest of the SGroup information needs to stay consistent.

smz-bayer added a commit to smz-bayer/Indigo that referenced this issue Jan 23, 2025
@AlexeyGirin AlexeyGirin reopened this Jan 24, 2025
@AlexeyGirin AlexeyGirin added the Export to MOL Bucket: Export to MOL related issues label Jan 28, 2025
@AlexeyGirin AlexeyGirin removed this from the Indigo-1.29.0-rc.1 (Current) milestone Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Export to MOL Bucket: Export to MOL related issues User`s Feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants