-
-
Save egonw/96594 to your computer and use it in GitHub Desktop.
Build a molecule using Bioclipse script for JChemPaint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* Bioclipse-script to iteratively build a molecule in JChemPaint | |
* Author: Ola Spjuth | |
* Author: Egon Willighagen | |
******************************************************************************/ | |
//Start with a carbon and open in JCP | |
mol=cdk.fromSMILES("C") | |
mol2=cdk.generate2dCoordinates(mol) | |
ui.open(mol2) | |
//Add some atoms and bonds and wait 1 sec in between | |
atom=jcp.getModel().getAtomContainer().getAtom(0); | |
jcp.moveTo(atom,jcp.newPoint2d(5,5)); | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
jcp.addPhenyl(atom) | |
js.delay(1) | |
molecule=jcp.getModel().getAtomContainer() | |
atom=molecule.getAtom(molecule.getAtomCount()-1); | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
atom=jcp.addAtom("C", atom) | |
js.delay(1) | |
jcp.addRing(atom,5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment