Skip to content

Commit

Permalink
Merge pull request #31 from EBjerrum/dragevent
Browse files Browse the repository at this point in the history
Drag event
  • Loading branch information
EBjerrum authored Sep 16, 2024
2 parents ee5586b + 1b3093e commit 8918ace
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 113 deletions.
55 changes: 43 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# rdeditor

Simple RDKit molecule editor GUI using PySide6
![rdeditor, the RDKit molecule editor](./Screenshots/Main_window.png)

![rdeditor, the RDKit molecule editor](https://github.com/EBjerrum/rdeditor/blob/master/Screenshots/Main_window.png?raw=true)

## Installation

- requirements

RDKit, NumPy, PySide6 and pyqtdarktheme should be automatically pip installed by the setup.py script.
RDKit, NumPy, PySide6 and pyqtdarktheme should be automatically installed when installed via pip.

- installation

Expand All @@ -20,12 +21,39 @@ A launch script will also be added so that it can be started from the command li

## Usage

Can be started with `rdEditor` or `rdEditor your_molecule.mol` to start edit an existing molecule.
Interactions with the molecule are done via clicking on the canvas, atoms or bonds. A choice of tools is available.
Can be started from the command line with `rdEditor` or `rdEditor your_molecule.mol` to start edit an existing molecule.
Interactions with the molecule are done via clicking and dragging on the canvas, atoms or bonds. A choice of tools is available.

To edit a molecule, select the pen tool, and an atom, bond or template type and click on the canvas to add it.

Clicking:

- When clicking existing atoms or bonds, the clicked atom or bond will be modified, depending on the atom or bond type selected.
- If a bondtype is selected, the bond will be added to the clicked atom with a carbon atom at the other end.
- If a bondtype is selected and a bond is clicked, the bond will be changed to that type if different.
- If you click multiple times on a bond with an atomtype selected, the bondtype will cycle between single, double and triple bond.

Dragging:

- If you click and drag from an atom, the selected atomtype will be added at the end of a single bond.
- Dragging between two atoms will add a bond between them. If a bondtype is selected, the bondorder will correspond to the bondtype selected.
- Dragging on the canvas with an atomtype will add two atoms of that type with a single bond between them.
- Dragging on the canvas with a bondtype will simply add that bond with carbon atoms at both ends.

Templates:

- Templates work kind of like atoms, so if you click on an atom, the template will be added directly to that atom.
- If a template is selected and dragged from an atom, the template will be added with a single bond to the clicked atom.
- Some templates can also be added to bonds by clicking on the middle of the bond.
- Dragging on a canvas with a template will add a carbon atom and a single bond to the template.

Other actions:

- most other actions (R/S, E/Z, Increase/Decrease charge, Adjust atom number) works by clikcing on existing atoms.

#### Top Menu:

![top menu of rdeditor, the RDKit molecule editor](./Screenshots/Top_Menu.png)
![top menu of rdeditor, the RDKit molecule editor](https://github.com/EBjerrum/rdeditor/blob/master/Screenshots/Top_Menu.png?raw=true)

From left to right

Expand All @@ -35,31 +63,34 @@ From left to right

- Arrow: Select tool. Click on an atom to select it, click on the canvas to deselect. Clicking on multiple atoms one after another will select them, but only the lastly clicked one will be highlighted in red and used for operations, such as bond creation to another existing atom.
- Pen: Add tool. Clicking on an existing atom will add the current selected atom type to that atom with a single bond. Clicking on the canvas will add a disconnected atom. Clicking on a bond will cycle through single, double and triple bonds.
- Add bond / Join atoms: Will add a single bond between a clicked atom (or a previously selected atom) and the next atom clicked.
- Change Atom: Will substitute the atom clicked, with the currently selected atom type
- R/S: Change the stereo chemistry of the selected atom (see issues below)
- E/Z: Change E/Z stereo of double bonds (see issues below)
- R/S: Change the stereo chemistry of the selected atom
- E/Z: Change E/Z stereo of double bonds
- Increase/Decrease charge: Will increase or decrease the charge of the atom clicked
- Set atommap or R-group number: Will set the atommap or R-group number of the atom clicked
- clean up coordinates: recalculate coordinates disregarding existing coordinates.
- clean up chemistry. Sanitize and/or Kekulize the molecule.
- Delete atom/bond:
- Clear Canvas
- Undo.

#### Side Bar:

![top menu of rdeditor, the RDKit molecule editor](./Screenshots/Side_bar.png)
![top menu of rdeditor, the RDKit molecule editor](https://github.com/EBjerrum/rdeditor/blob/master/Screenshots/Side_bar.png?raw=true)

Most commonly used bond types, and atom types can be selected. A Periodic table is accessible for exotic atom types.
Most commonly used bond types, and atom types can be selected. Templates and R-group (dummy atoms) are also accessible. A Periodic table is accessible for exotic atom types.

#### Dropdown menus

Access to all standard operations as well as less used atom types and bond-types.

#### Settings

Themes can be selected from the ones available on your platform (Mac/Linux/Windows)
Themes can be selected from the ones available on your platform (Mac/Linux/Windows).

The debug level can be selected

Cleanup settings can be selected if the molecule should be sanitized or kekulized during cleanup.

## Development

Instructions to set it up in editable modes and instructions for eventual contributions can be found in the [DEVELOPER.md](./DEVELOPER.md) file.
Expand Down
Binary file modified Screenshots/Main_window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Screenshots/Side_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Screenshots/Top_Menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8918ace

Please sign in to comment.