ChemicalTerms: how to plug results into other functions?

User 74d30c678b

25-08-2009 10:12:32

Dear support,


I would like to "parse" molecules in greater detail. For example, extract the number and types of heteroatoms per ring, not only per molecule. The result might look like this:


(mol1) 5Ring 2N 5Ring 1O 6Ring 2N
(mol2) 6Ring 1N 1O
(mol3)
(mol4) 4Ring 1O


can this be done with ChemicalTerms and "evaluate"? For performance reasons, it would be phantastic to have a "one-liner". I see that "rings()" returns the atom indices of atoms in rings from which I then could count the atom types, but I don't know how I can plug this result into other functions.


Thanks and best regards,


Daniel. 

ChemAxon d76e6e95eb

25-08-2009 15:32:24

I do not think, that Chemical Terms can provide you such special output. Standardizer, however, can return the ring systems of molecules.



standardize in.smiles -c '[*R0:1]>>..[*:1]!@[*:2]>>[*:2].[*:1]' 

Then you can probably use a script to analyse the output SMILES. Alternatively, if you like to write some lines of code, with the help of our Java or .NET API, you can probably write a small program producing the output you prefer.


User 74d30c678b

25-08-2009 15:57:36

Hi Gyuri,


thanks for the quick reply. I was looking for a simple solution that can be easily incorporated in a skript, e.g. Python. Until now, I was using OEChem for such tasks. I just wrote a skript with OEChem that outputs for each ring the number of N,O,S atoms. It's limitation, however, is that fused rings (e.g. indole) are not separated into a 6- and a 5-membered ring.


If you have something along these lines in Java which also works with fused rings, please let me know.


Thanks and best regards,


Daniel

ChemAxon e08c317633

26-08-2009 19:12:52

Hi Daniel,


I attached a code example that will do the job.


Compile:


javac RingStats.java


Note: MarvinBeans.jar has to be in the CLASSPATH.


Usage:


java RingStats <molfile> 


Example output:


java RingStats nci10.smiles


(mol1) 6Ring 
(mol2) 5Ring N1 S1 5Ring N1 S1 6Ring 6Ring 
(mol3) 6Ring 
(mol4) 5Ring N1 S1 
(mol5) 6Ring 6Ring 6Ring 
(mol6) 6Ring 6Ring O1 6Ring 6Ring 
(mol7) 6Ring 6Ring 
(mol8) 6Ring 6Ring 6Ring 
(mol9) 
(mol10) 6Ring 6Ring 6Ring 


Modify the code as you wish.


Regards,


Zsolt