Gilleain and Arvid merged their branches into a single code base, while Stefan worked on the Swing application and applet. The Bioclipse SWT-based widget is being developed for Bioclipse2.
The new design separates widget/graphics toolkit specifics from the chemical drawing and editing logic. Regarding the editing functionality, this basically comes down to have a semantically meaningful edit API. This allows us to convert both Swing and SWT mouse events into things like addAtom("C", atom), which would add a carbon to an already existing atom. However, without too much phantasy, it allows adding a scripting language. This is what I have been working on. Right now, the following API is available from the Bioclipse2 JavaScript console (via the jcp namespace, in random order):
- ICDKMolecule jcp.getModel()
- IAtom getClosestAtom(Point2d)
- setModel(ICDKMolecule) (for really fancy things)
- removeAtom(IAtom)
- IBond getClosestBond(Point2d)
- updateView() (all edit command issue this automatically)
- addAtom(String,Point2d)
- addAtom(String,IAtom) (which works out coordinates automatically)
- Point2d newPoint2d(double,double)
- updateImplicitHydrogenCounts()
- moveTo(IAtom, Point2d)
- setSymbol(IAtom,String)
- setCharge(IAtom,int)
- setMassNumber(IAtom,int)
- addBond(IAtom,IAtom)
- moveTo(IBond,Point2d)
- setOrder(IBond,IBond.Order)
- setWedgeType(IBond,int)
- IBond.Order getOrder(int)
- zap() (sort of sudo rm -Rf /*)
- cleanup() (calculate 2D coordinates from scratch)
- addRing(IAtom,int)
- addPhenyl(IAtom)
A simple script could look like:
This file contains 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
# just illustrative, and only works on a file only I have, but you get the idea | |
ui.open("/PeptideMimetics/10.cml") | |
oxygen = jcp.getModel().getAtomContainer().getAtom(11) | |
jcp.addAtom("C", oxygen) | |
newCarbon = jcp.getModel().getAtomContainer().getAtom(12) | |
jcp.addPhenyl(newCarbon) |

No comments:
Post a Comment