R-groups in SMILES

User 8d3767b032

13-10-2004 15:43:55

In Marvin 3.3.0 the SMILES c1ccccc1[R1] is displayed as


as "R1" directly attached to a phenyl ring (see attached


picture).





in Marvin 3.4.3 the same SMILES is now displayed as


"A (R1)" (see attached picture).











I realize that the SMILES in question doesn't conform


to the "official" SMILES specification. I'm guessing that


newer versions of Marvin are interpreting this as a SMARTS.





I also tried this:





Code:
       


String smiles = "c1ccccc1[R]";


MolInputStream mis = new MolInputStream(new ByteArrayInputStream(smiles.getBytes()));


MolImporter mi = new MolImporter(mis);


mi.setQueryMode(false);  // I thought setting this would cause the string to be interpreted as SMILES


Molecule mol = mi.read();






but I got the same behavior.





How can I get the old behavior ? It's very useful to be able


to display scaffolds, etc. in this way.





Is there a way to programattically build up a molecule with


R-group labels ?

ChemAxon 43e6884a7a

13-10-2004 16:52:56

Pat,





We are considering a new cxsmiles/cxsmarts solution that contains the extra information after the smiles/smarts string (after a separating space)


http://www.chemaxon.com/marvin/doc/user/cxsmiles-doc.html





How does that sound?





We prefer a solution that keeps the smiles/smarts compatible with Daylight.





Ferenc

ChemAxon 25dcd765a3

13-10-2004 16:54:44

Hi Pat,





R1 has no meaning in official SMILES, however it has in SMARTS.


This was confusing in the earlier version.





Even if you specify that the file is in SMILES, the importer will realise that you want to spoof it. So it imports as SMARTS.





However we can make cxmiles format to accept this type of molecules.


Do you need only the case when the R group is not defined?


Like in the example you mentioned?





To add Rgroups to molecules you can use the following code:





Code:



   RgMolecule m = new RgMolecule();    // create new RgMolecule


   MolAtom a = new MolAtom(0,0);       // create a C at the origin


   MolAtom b = new MolAtom(MolAtom.RGROUP,1,0,0);  // create an Rgroup


   b.setRgroup(1);                                 // set Rgroup number to 1


   MolAtom c = new MolAtom(MolAtom.RGROUP,-1,0,0);  // create an Rgroup on the other side


   c.setRgroup(2);                                // set Rgroup number to 2


// add atoms and edges to the molecule


   m.add(a);


   m.add(b);


   m.add(c);


   m.add(new MolBond(a,b));


   m.add(new MolBond(a,c));








All the best


Andras

User 8d3767b032

13-10-2004 18:15:20

Andras and Ferenc,





Thanks for the replys. A SMILES extension would be great. Andras' solution


with the RgMolecule is good, but is there a way to construct an


RgMolecule from a Molecule ? Since both Molecule and RgMolecule


inherit from CGraph it seems like I should be able to do





mol.cloneCopy(rgMol);





I tried the approach below and I don't see the RgMolecule in


the MView pane. Is there some trick that I'm missing ?





Also, the approach outlined by Andras of adding a MolAtom


with atomic number MolAtom.RGROUP, then using MolAtom.setRgroup(int)


appears to work with Molecules and RgMolecules. Is it ok to


do this with Molecules ?





Thanks,





Pat





Code:
import chemaxon.formats.MolImporter;


import chemaxon.marvin.beans.MViewPane;


import chemaxon.struc.Molecule;


import chemaxon.struc.RgMolecule;





import javax.swing.*;


import java.awt.*;


import java.io.IOException;








public class MViewPaneTest extends JFrame {


    MViewPane mvp = new MViewPane();





    MViewPaneTest() throws IOException {


        this.getContentPane().add(mvp,BorderLayout.CENTER);


        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


        this.setSize(500,500);


        mvp.setParams("rows=1\ncols=2\nborder=2\n");


        String smiles = "c1ccccc1";


        Molecule mol = MolImporter.importMol(smiles);


        Molecule newMol = new Molecule();


        mol.clonecopy(newMol);


        RgMolecule rgMol = new RgMolecule();


        mol.clonecopy(rgMol);


        mvp.setM(0,newMol);


        mvp.setM(1,rgMol);


    }





    public static void main(String[] args) {


        MViewPaneTest mViewPaneTest = null;


        try {


            mViewPaneTest = new MViewPaneTest();


            mViewPaneTest.show();


        } catch (IOException e) {


            e.printStackTrace();


        }


       


    }


}

ChemAxon 25dcd765a3

13-10-2004 21:31:32

Hi Pat,





A structure with RGroups is consists of a root structure with attachement points (R1, R2 etc..) and the R1, R2 definitions (molecules).


You can use atomic number MolAtom.RGROUP and MolAtom.setRgroup(int) also in case of Molecules, but in the Molecule Object you have no possibility to store any RGroup definitions, so you can only store the root structure.


And this is the solution to your code also.


You want to add your mol Molecule to your rgMol root.


So instead of:


Code:



mol.clonecopy(rgMol);





You add the mol to your rgMol root:


Code:



//        mol.clonecopy(rgMol);


   rgMol.setRoot(mol);      // add to the root of the RgMolecule


// clean the structure in 2D to have the coordinates otherwise every atom would stay


// at the origin, which is not very nice


   rgMol.clean(2,null,null);





(See RgMolecule apidoc for details: marvin_dir/doc/api/chemaxon/struc/RgMolecule.html )





All the best


Andras