Modify Molecule Structure Programatically via API call

User c4e58ee8b2

29-05-2008 17:35:36

Hi,





Can you point me to a code example where molecule is modifed programatically? Say I have a smiles string like CC(C)OC, and I would like break it into CCC and OC.





Thanks





Tianhong

ChemAxon e08c317633

30-05-2008 09:51:21

Hi,





Do you want to remove a bond from a Molecule object by using the API, or you want to use an application like Fragmenter via API?





Zsolt

User c4e58ee8b2

30-05-2008 11:10:03

Hi, Zsolt,





I would like to work with Molecule object.





Thanks





Tianhong

ChemAxon efa1591b5a

30-05-2008 11:16:25

Hi,


can you define some kind of rules how to cut the molecule into pieces? You showed an example but can you generalise it? If yes, then our Fragmenter tool might be relevant for you, you may wish to check the corresponding documentation at http://www.chemaxon.com/jchem/doc/user/Fragmenter.html





Do you have any kind of constraints like minimal fragment size, maximum fragment count etc? - these are also handled by Fragmenter.





Or you need a more flexible approach and you don't mind writing some java code using our API?





HTH





Regards,


Miklos

ChemAxon efa1591b5a

30-05-2008 11:18:11

Sorry, cross posting...


So, you stick to the API. Then I'm off this discussion, Zsolt and others will manage your enquiry.





Regards


Miklos

User 870ab5b546

30-05-2008 15:41:20

Assume you have already imported the SMILES into a Molecule mol. bondIndex is an int representing the bond that you want to break. It corresponds to the bond number in the MRV or MOL definition, minus 1.





Code:
 mol.removeEdge(bondIndex);


Molecule[] fragments = mol.convertToFrags();






Note that when you fragment mol, the original object is rendered inconsistent. Clone it before fragmenting if you need to preserve it.

ChemAxon 7c2d26e5cf

30-05-2008 17:07:15

Dear Tianhong,


If you are not familiar with the Molecule API, I suggest to browse among methods of the Molecule API.


The atoms and bonds are represented by MolAtom and MolBond classes. You can access atoms and bond of a structure via the Molecule API.


So, taking a look at to MolAtom and MolBond class is also recommended if you would like work with Molecule.





See the SimpleConverter example.


You can find its runable version in the Marvin Beans package.


In this example, you can see how to clean a molecule. It can be a starting point for working with Molecule class.


If you have exact questions what you would like to do we can give more advice.

User c4e58ee8b2

03-06-2008 11:28:41

Thanks, Bobgr. Your post puts me at the right direction.





Tianhong