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

Absolute SMILES Generation fails for reactions #959

Open
mrwns opened this issue Feb 12, 2023 · 3 comments
Open

Absolute SMILES Generation fails for reactions #959

mrwns opened this issue Feb 12, 2023 · 3 comments

Comments

@mrwns
Copy link

mrwns commented Feb 12, 2023

I noticed an issue when generating Absolute SMILES for reactions (which fails).

For the reactants and products individually, this works.

See example below, fails with 2.8 and 2.9 Snapshot.

        String reaction ="[CH3:9][O:8][C:7](=[O:10])[CH:6]([NH:11][C:12](=[O:13])[NH:14][C:15]1=[CH:16][C:17]([O:18][CH3:19])=[CH:20][C:21](=[C:26]1[OH:27])[C:22]([CH3:23])([CH3:24])[CH3:25])[C@@H:5]([F:38])[CH2:4][CH2:3][CH2:2][NH:1][C:29](=[O:28])[O:30][CH2:31][C:32]1=[CH:33][CH:34]=[CH:35][CH:36]=[CH:37]1>>[CH3:9][O:8][C:7](=[O:10])[CH:6]([NH:11][C:12](=[O:13])[NH:14][C:15]1=[CH:16][C:17]([O:18][CH3:19])=[CH:20][C:21](=[C:26]1[OH:27])[C:22]([CH3:23])([CH3:24])[CH3:25])[C@@H:5]([F:38])[CH2:4][CH2:3][CH2:2][NH2:1]";

        SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());

        SmilesGenerator gen1 = new SmilesGenerator(
                SmiFlavor.Absolute
        );

        // processing the individual reagents/products works
        for (String smiles : reaction.split(">>")){
            IAtomContainer mol = parser.parseSmiles(smiles);
            System.out.println(gen1.create(mol));

        }

        IReaction rxn = parser.parseReactionSmiles(reaction);

        //this fails for the whole reaction
        System.out.println(gen1.create(rxn));
@johnmay
Copy link
Member

johnmay commented Feb 16, 2023

Doh! Easy fix, it's the empty agents. Perhaps something changed in the JNI/JNA inchi, should add a test case anyways.

@mrwns
Copy link
Author

mrwns commented Feb 16, 2023

Thanks!

for note, I have the suspicion that SmiFlavor.AtomAtomMapRenumber does not work properly for reactions, as it re-numbers reactants and products independently (after a brief look into how the renumbering is called)

O=C(OCc1ccccc1)[NH:1][CH2:2][CH2:3][CH2:4][CH2:5][C@@H:6]([C:7]([O:8][CH3:9])=[O:10])[NH:11][C:12](=[O:13])[NH:14][c:15]1[cH:16][c:17]([O:18][CH3:19])[cH:20][c:21]([C:22]([CH3:23])([CH3:24])[CH3:25])[c:26]1[OH:27]>>[NH2:1][CH2:2][CH2:3][CH2:4][CH2:5][C@@H:6]([C:7]([O:8][CH3:9])=[O:10])[NH:11][C:12](=[O:13])[NH:14][c:15]1[cH:16][c:17]([O:18][CH3:19])[cH:20][c:21]([C:22]([CH3:23])([CH3:24])[CH3:25])[c:26]1[OH:27]

gets reassigned to

[O:1]=[C:2]([O:3][CH2:4][C:5]=1[CH:6]=[CH:7][CH:8]=[CH:9][CH:10]1)[NH:11][CH2:12][CH2:13][CH2:14][CH2:15][CH:16]([NH:17][C:18](=[O:19])[NH:20][C:21]2=[CH:22][C:23]([O:24][CH3:25])=[CH:26][C:27](=[C:28]2[OH:29])[C:30]([CH3:31])([CH3:32])[CH3:33])[C:34](=[O:35])[O:36][CH3:37]>>[O:1]=[C:2]([NH:3][C:4]1=[CH:5][C:6]([O:7][CH3:8])=[CH:9][C:10](=[C:11]1[OH:12])[C:13]([CH3:14])([CH3:15])[CH3:16])[NH:17][CH:18]([C:19](=[O:20])[O:21][CH3:22])[CH2:23][CH2:24][CH2:25][CH2:26][NH2:27]

@johnmay
Copy link
Member

johnmay commented Feb 17, 2023

Will take a look

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

No branches or pull requests

2 participants