find aromatic rings in a sd file

User 0a9e8be100

21-12-2006 22:11:16

Hi,


I am new to Marvin.


I would like to get the aromatic rings in a sd file.


When I used getAromaticAndAliphaticRings method from MolImporter, it is giving large number of rings and I don't know what is it?


Can you please tell me how to get the aromatic rings with an example?





Thanks,


Maria

ChemAxon 25dcd765a3

22-12-2006 11:26:30

Dear Maria,





You are using the proper method: getAromaticAndAliphaticRings.


This gives you both aromatic and aliphatic ring atom indexes.


The atom indexes of the aromatic rings are in the 0th element of the array and the aliphatic ones are in the 1st element.


(For more information please check the APIdoc http://www.chemaxon.com/marvin/doc/api/chemaxon/struc/MoleculeGraph.html#getAromaticAndAliphaticRings(int,%20boolean,%20boolean,%20int,%20int)


)


If you need only the aromatic rings I would suggest to use the following code:


Code:



int[][][] rings = m.getAromaticAndAliphaticRings(MoleculeGraph.AROM_BASIC,


                                              true, true,0,0);


int[][] aromrings = rings[0];


for (int i = 0; i < aromrings.length; i++){


    int r[] = aromrings[i]; // one aromatic ring


    for (int j = 0; j < r.length; j++){


        // r[j] is the current aromatic atom index


        // your code comes here to work on the indexes


    }


}











All the best


Andras

User 0a9e8be100

22-12-2006 16:02:58

Dear Andras,


Thank you very much for your reply and the sample code.


I used the method that you suggested. I am getting aromatic rings, but it is also containing lot of rings. The compound that I input has only 5 rings. But the output has 23 rings. Is there any method that gives only the aromatic rings in the strutcure? or Do I have to have to find it out from the output that I got? Thanks for your patience.





Thanks,


Maria

ChemAxon 25dcd765a3

22-12-2006 19:35:46

Dear Maria,





I think we have different meaning of aromatic rings.


The getAromaticAndAliphaticRings returns all the aromatic rings.





So in the attached molecule the following rings are aromatic (rings are given with the atom indexes):





2 3 4 5 6 7 8 12 13 14 11 9 10 1


2 3 4 5 6 7 8 9 10 1


8 12 13 14 11 9 10 1 6 7


8 9 10 1 6 7


9 8 12 13 14 11


2 3 4 5 6 1





You may want only the rings from the SSSR which are aromatic?





Andras

User 0a9e8be100

22-12-2006 20:34:16

Dear Andras,


Thanks again for your kind reply.


Yes, I would like to get only the rings from the SSSR which are aromatic.


Is there any way to get it?





Thank you.





Maria

ChemAxon 25dcd765a3

22-12-2006 20:56:59

Maria,





OK in this case you should aromatize the molecule and check the SSSR atoms. If all the atoms in a given SSSR are aromatic (has aromatic bond), then that ring is aromatic .


So one example code is the following:





Code:



    m.aromatize(true); // aromatize the molecule


    int[][] sssr = m.getSSSR(); // get sssr rings


    for (int i = sssr.length-1; i >= 0; --i){


        int[] r = sssr[i];


        boolean aromRing = true;


        for (int j = r.length-1; j >= 0; --j){


            MolAtom a = m.getAtom(r[j]);


            if (!a.hasAromaticBond()){ // the atom has no aromatic bond


                aromRing = false;


                break;


            }


        }


        if (!aromRing){ // remove this ring


           sssr[i] = null;


       }


    }





// as a result you get an sssr array where the non aromatic rings are null











I hope this helps





Andras

User 0a9e8be100

26-12-2006 16:04:53

Dear Andras,


Thank you so much for your great help!





I could get the rings that I want and it is working fine.





Thanks again!





Maria