Code Monkey home page Code Monkey logo

jchempaint's Introduction

JChemPaint (or JCP for short here) is the editor and viewer for 2D chemical structures developed using CDK. It is implemented in several forms: a Java application and two varieties of Java applet.

Please see the documentation at https://github.com/JChemPaint/jchempaint/wiki for more information.

The issue tracker here (on top of this page) is for specific JCP-related bugs. For problems in CDK proper, please use http://sourceforge.net/tracker/?group_id=20024&atid=120024

Build requirements (need installation)

 - gettext : http://www.gnu.org/software/gettext/
 - app-bundler: https://github.com/federkasten/appbundler-plugin (optional)

Build with the following commands

 `mvn install -DskipTests`
 `mvn install -DskipTests -Posx-app` to build an OS X application bundle (.app)
 `mvn install -DskipTests -Pwindows-app` to build a windows executable (.exe)

jchempaint's People

Contributors

dependabot[bot] avatar gilleain avatar johnmay avatar rwst avatar vedina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jchempaint's Issues

making hydrogens implicit/explicit fails

From aherraez
https://sourceforge.net/apps/trac/jchempaint/ticket/44

Testing the JCP Editor Applet 2.5.9 at
http://www.ebi.ac.uk/steinbeck-srv/jchempaint-nightly/EditorApplet.html

when I draw a structure, then click on the "Make hydrogens explicit" link, nothing happens.

From the menu, View > Implicit Hydrogens shows no hydrogens, but displays/hides the nonterminal carbons.

(Firefox 3.5 WinXP, Java 1.6.0_15)

Changed 2 years ago by shk3

status changed from new to closed
resolution set to fixed

This was a problem with the build process
Changed 2 years ago by aherraez

status changed from closed to reopened
resolution fixed deleted

Now the "Make hydrogens explicit" link is working, but the action seems to affect only the last part of structure drawn. I need to click several times in order to display explicit H on all atoms.
Maybe it's only acting on the currently selected part of the structure? (but I didn't select anything on purpose)
Changed 2 years ago by shk3

Can you try the nightly at http://www.ebi.ac.uk/steinbeck-srv/jchempaint30-nightly/EditorApplet.html ? It works for me there. I observed the phenomenon your saw as well at some point, but it seems to work now. Not sure what happens there.
Changed 2 years ago by aherraez

You're right, the menu now works fine, However, the "Make hydrogens explicit" link in the page still misbehaves.
And combinations of the link and the menu do funny things too: hydrogens explicited by the link are not hidden by the menu.

BTW, why do we have duplicate entries for "implicit H" under View and Atoms (the latter is greyed out)?
Changed 2 years ago by shk3

The link (=JavaScript? action) worked for me right now.
The two entries are identical. The greying-out is because the atom menu is only active if the selection contains one or more atoms. The double entry was a request by ChEBI people. I am not going to change this, if we want to we need to make a poll or so.
Changed 2 years ago by aherraez

The link works sometimes, but often only a part of the molecule gets its H explicited.
I can't find a reproducible pattern.
Changed 2 years ago by aherraez

Trying this again. Results are variable.
This procedure seems to be reproducible and should demonstrate the problem:
Using (it reports as v.3.2):
http://www.ebi.ac.uk/steinbeck-srv/jchempaint-nightly/EditorApplet.html

Empty canvas, go to menu Template > Alkaloids > Caffeine.
Then click on the "Make hydrogens explicit" link.
Not all hydrogens are displayed. Several clicks on the link end up showing all H's.

I observe this too with hand-drawn structures in several occasions, though not always; cannot find the pattern. Same in 3.0.1 and 3.1 from the download site. This makes the Javascript API unusable.Changed 2 years ago by shk3

status changed from new to closed
resolution set to fixed

This was a problem with the build process
Changed 2 years ago by aherraez

status changed from closed to reopened
resolution fixed deleted

Now the "Make hydrogens explicit" link is working, but the action seems to affect only the last part of structure drawn. I need to click several times in order to display explicit H on all atoms.
Maybe it's only acting on the currently selected part of the structure? (but I didn't select anything on purpose)
Changed 2 years ago by shk3

Can you try the nightly at http://www.ebi.ac.uk/steinbeck-srv/jchempaint30-nightly/EditorApplet.html ? It works for me there. I observed the phenomenon your saw as well at some point, but it seems to work now. Not sure what happens there.
Changed 2 years ago by aherraez

You're right, the menu now works fine, However, the "Make hydrogens explicit" link in the page still misbehaves.
And combinations of the link and the menu do funny things too: hydrogens explicited by the link are not hidden by the menu.

BTW, why do we have duplicate entries for "implicit H" under View and Atoms (the latter is greyed out)?
Changed 2 years ago by shk3

The link (=JavaScript? action) worked for me right now.
The two entries are identical. The greying-out is because the atom menu is only active if the selection contains one or more atoms. The double entry was a request by ChEBI people. I am not going to change this, if we want to we need to make a poll or so.
Changed 2 years ago by aherraez

The link works sometimes, but often only a part of the molecule gets its H explicited.
I can't find a reproducible pattern.
Changed 2 years ago by aherraez

Trying this again. Results are variable.
This procedure seems to be reproducible and should demonstrate the problem:
Using (it reports as v.3.2):
http://www.ebi.ac.uk/steinbeck-srv/jchempaint-nightly/EditorApplet.html

Empty canvas, go to menu Template > Alkaloids > Caffeine.
Then click on the "Make hydrogens explicit" link.
Not all hydrogens are displayed. Several clicks on the link end up showing all H's.

I observe this too with hand-drawn structures in several occasions, though not always; cannot find the pattern. Same in 3.0.1 and 3.1 from the download site. This makes the Javascript API unusable.
Changed 2 years ago by aherraez

This bug is still present in 3.1.1
Changed 2 years ago by shk3

I can confirm this. Unfortunately, this is hard to debug.
Changed 2 years ago by aherraez

This bug is still present in 3.1.1
Changed 2 years ago by shk3

I can confirm this. Unfortunately, this is hard to debug.

From rwst: Confirmed in 3.3. Place caffeine via template or SMILES OCn1cnc2c1c(=O)n(C)c(=O)n2C on canvas. Removing double bonds and ketones doesn't make implicit Hs appear. See #129 for the simplest test case similar to caffeine.

implement molecule "snapshots" and support output of such sets to CML

Transferred from old tracker, submitted by pmr

Frequently the author wishes to create a number of
molecules in a single session. An obvious benefit is that
a series of molecules may be very similar and require
minimal editing. In the session

  • molecules may be written to a single file or multiple
    files
  • the dialog boxes for CML output (namespace, etc.)
    need only be filled once (it is tedious and error prone to
    fill them 100 times)

This would allow users to create a single CML file of
molecules in similar orientation, numbering etc.

INVALID as long as CML is unsupported, depends on #136

more abbreviated functional groups (keyboard templates)

From annulen

It would be great to enlarge list of groups which could be inserted with "Enter via keyboard" tool. Such list with functional groups and their SMILES is included into source package of OSRA (Optical Structure Recognition Applilcation, http://cactus.nci.nih.gov/osra/#7, file superatom.txt). Another list is on ChemAxon? (http://www.chemaxon.com/marvin/examples/applets/sketch/rightName.abbrevgroup)

It is understood the groups would be expanded immediately.

draw anything --> Edit|Delete --> NullPtr

This is in line with the missing Select Mode...

CopyPasteAction.actionPerformed(ActionEvent) line: 198
JMenuItem(AbstractButton).fireActionPerformed(ActionEvent) line: 2018
AbstractButton$Handler.actionPerformed(ActionEvent) line: 2341
DefaultButtonModel.fireActionPerformed(ActionEvent) line: 402
DefaultButtonModel.setPressed(boolean) line: 259
JMenuItem(AbstractButton).doClick(int) line: 376

Functional group mode

From sk3
https://sourceforge.net/apps/trac/jchempaint/ticket/49

Draw a hexane ring. Choose keyboard enter mode (keyboard symbol in toolbar). Click on one of the atoms. Enter cooh. Then choose "single bond mode" (- button). Click on any of the other atoms in the ring. A bond is added with an atom "cooh" at the end.
Either the group must be properly added or in case of groups the drawing symbol not set in EnterElementSwingModule?. This is currently done in EnterElementSwingModule? l. 184.

confirmed by rwst

user pref controlling placement of phantoms resulting in over-valencies

placing a second benzol onto one, to yield naphalene, gives different results depending on which bond is used. There appears to hold some logic which prevents a double bond to be placed, morphing it to a single, but the other case is not handled, resulting in five-bonded C-atoms.

This behaviour, though unexpected to casual users, may not be a bug. There should be a user preference to set the behaviour when placement of phantoms would result in over-valencies (don't place, keep overval, always aromatic, etc)

add support for polymers (PDBPolymer in CDK)

From stevet7, shk3:
http://sourceforge.net/apps/trac/jchempaint/ticket/4

From ACD, the structure is pasted without brackets. From Marvin, even pasting the structure is prevented.

JCP does not handle polymers right now. For my understanding, we left these out deliberately, which also means you cannot paste them properly.

Polymers are a target for an upcoming release. As long as polymers cannot be handled, you cannot expect them to be pasted

delete all but one atom, then del last --> NullPtr in ControllerHub

From egonw
https://sourceforge.net/apps/trac/jchempaint/ticket/87

When I "Select all" its quite slow in selecting all. Furthermore when I
think click the delete menu item it also takes quite a while to delete.
Even though I repeat this procedure over and over its quite slow?

Original CDK bug tracker ticket #2864167:
https://sourceforge.net/tracker/?func=detail&aid=2864167&group_id=20024&atid=1293036

cc jkerssem added
keywords delete hang nullpointer added

Seconded, though select all works perfectly for me, via any route (Ctrl+a, edit-menu item, rectangle select).

Also, the 'hang' seems to occur only once you delete the last atom on the drawing canvas. Iteratively deleting all-but-the-last atom works as expected.
Only once you delete the last atom does the hang occur. In the terminal a series of nullpointer exceptions appear (attached).
Opening new windows still responds instantly (tested by insert-from-template, save, save-as, create-new, etc.
Rendering within the original window is severely damaged, with repaints only happening after a mouse-over. (E.G. clicking a drop-down menu in the menu bar does not show the menu until you move the mouse over where the items should be, then the items appear and respond to clicks normally)

Version:
jchempaint-3.1.2.jar from nightly builds on steinbeck server. build date: July 1st 13:46h

From rwst:
confirmed with JCP HEAD
scenario: draw chain with 6atoms, remove 5 resulting in CH3(!), click, delete

allow unexpandable functional groups, reimplement R button(s)

At the moment, replacing an atom with "RX" (from the R button) causes a NullPtrException (tracked at cdk #3534288). However, instead of using an atom it would be better to use an unexpandable functional group for it. Also, implement R1-R5 by clicking again on R.

inconsistent handling of undo/exit

Consider the following scenarii, each starting from scratch:

  1. load MOL file, undo, exit --> no saving question
  2. manual SMILES input, exit --> no saving question
  3. draw chain, undo, exit --> saving question

Clearly both 2) and 3) are wrong.

set atom in midst of aliphatic chain to H, clean mol --> CDKException

org.openscience.cdk.exception.CDKException: Molecule not connected. Use ConnectivityChecker.partitionIntoMolecules() and do the layout for every single component.
at org.openscience.cdk.layout.StructureDiagramGenerator.generateCoordinates(StructureDiagramGenerator.java:308)
at org.openscience.cdk.layout.StructureDiagramGenerator.generateExperimentalCoordinates(StructureDiagramGenerator.java:274)
at org.openscience.cdk.layout.StructureDiagramGenerator.generateExperimentalCoordinates(StructureDiagramGenerator.java:248)
at org.openscience.jchempaint.controller.ControllerHub.generateNewCoordinates(ControllerHub.java:1253)
at org.openscience.jchempaint.controller.ControllerHub.cleanup(ControllerHub.java:1214)
at org.openscience.jchempaint.action.CleanupAction.actionPerformed(CleanupAction.java:61)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

draw chain, click chain atom --> NullPtr

the logic in ChainModule:mouseClickedUp did not account for ChemModelManipulator.getRelevantAtomContainer() returning Null. This is fixed in cdk to an exception. Nevertheless we must guard against null.

trouble at saving in SVG format

From goritskiy
http://sourceforge.net/apps/trac/jchempaint/ticket/125

Hello.

I use Jchempaint for getting chemical elements and formulas in SVG format. I need it to include in PDF documenent using XSL transformations.
I try to save chemical elements in SVG format but unfortunately symbols of elements dont display. Whereas there are symbols in gotten jpeg, gif, png formats, but not in SVG. What kind of fonts are used in Jchempaint(May be I havent these? or what trouble may it be in SVG saving?

Thank you very much for helping.

deleting all but one in C-chain --> CH3

same with -NH2, -OH, -SH, but not halogens.
this cannot even be corrected by cleanup(), so it is also a cdk problem.

Actually, it only showed with square select (which uses deleteFragment()). Reason was deleteFragment() not updating neighbor atoms.

click C,H,C while bond button active changes result from C2H6 to CH4

another chapter in the missing select mode saga: after startup, both "single bond" and "C" are active, and will give C2H6 when clicked on the canvas. Now select "H" then "C" again: click on canvas will now give CH4. Click on the still active "single bond" reverts to C2H6.

I think the feature of placing two-atom molecules with arbitrary elements using a single-click is way not useful enough to abandon a good application logic which is expected by most users: have a selection mode which can be easily switched to, but when an element is clicked, any active mode is cleared, and only atoms are placed. So you need more clicks for that N2 or O2 molecule but gain UI consistency. (one could offer the current behaviour with the draw chain mode which includes the two-atom case)

This however disregards that when in atom placing mode, a click on Select should enter select mode. This means there should be both a bona fide atom placing mode (visible by e.g. a frame around the atom buttons) and a select mode (visible by the select button). Placing a N-N bond would then involve clicking N and bond, any atom place mode deselected by bond.

That means remove the two charge buttons (-1,+1) and place a frame around all remaining buttons to be highlighted if in atom place mode. Also, do some reshuffling of upper buttons, and an arrow inside the Select icon.

IN THE END, we were satisfied to change the button logic to deselect any bond button when clicking on the lower bar. This still allows selecting a bond after it but also provides for a mode where a click on white produces an atom while a drag makes a (single) bond.

better error handling in IsotopeFactory.java

This is with the 3.3 application from ebi and the icedtea7 vm every time an atom is selected when inputting "cooh"

java.lang.NullPointerException
at org.openscience.cdk.config.IsotopeFactory.configure(IsotopeFactory.java:347)
at org.openscience.cdk.config.IsotopeFactory.configure(IsotopeFactory.java:332)
at org.openscience.jchempaint.controller.ControllerHub.setSymbol(ControllerHub.java:980)
at org.openscience.jchempaint.JChemPaintPanel.keyReleased(JChemPaintPanel.java:352)
at java.awt.Component.processKeyEvent(Component.java:6466)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2820)
at java.awt.Component.processEvent(Component.java:6282)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1890)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:752)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1017)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:889)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:717)
at java.awt.Component.dispatchEventImpl(Component.java:4731)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

error message and clean state after SMILES C1C1 instead of NullPtr

Both input of C1C1 from text field and file gives (different) exceptions. It should give an error message box, rejecting the input.

The cause is primarily a CDK issue, see
https://sourceforge.net/tracker/?func=detail&aid=3531612&group_id=20024&atid=120024
but we could add safeguards to give diagnostics and do full recovery.

It would appear that the difference between both cases is that there is a cleanup() after File Read but not after text input.

remove cursor functions in Renderer class

The ControllerHub member function mouseClickedDown() and ...Up() need access to the mouse cursor state (get/set). This is realized by accessing the renderPanel through Renderer member functions (declared in IRenderer). BUT ControllerHub gets the renderPanel also when it's constructed, with an IViewEventRelay handle. It is therefore not necessary to abuse the Renderer class for accessing the RenderPane

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.