PubChem » PubChem Help » Sketcher Help

PubChem Sketcher Help

  1. Example
  2. Editor Window Layout
  3. Button Area
  4. Mouse Use
  5. Error Reporting
  6. Bandwidth Control
  7. Element Buttons
  8. Bond Drawing
  9. Special Bond Types
  10. Atomic Charges
  11. Fragments
  12. Templates
  13. Graphical Manipulations
  14. Deleting Objects
  15. Undoing, Redoing, and Starting Fresh
  16. Cleaning up Structures
  17. Setting Query Attributes on Atoms
  18. Display of Atom Query Attributes
  19. Setting Bond Query Attributes
  20. Display of Bond Query Attributes
  21. The Structure Data Line
  22. Structure Input via the Structure Data Line
  23. Structure Import via Keyboard Paste
  24. Structure Import via File Upload
  25. Structure Export
  26. Hydrogen Manipulation
  27. Keyboard Shortcuts
  28. Data Transfer to Caller Forms
  29. Quitting the Sketcher

In order to allow input structures for queries, the PubChem Assay and Structure database uses its own unique Web-based sketcher tool. This document describes its features and operation.

System Requirements

The sketcher was designed to be as Browser- and platform-independent as possible and should work on any recent Web browser on MS Windows, OS X, or Unix/Linux. It does not require the presence of a Java execution environment, nor does it use a plug-in requiring installation and installation privileges. It does not store any data on your computer, or changes the browser configuration, either.

The program works by streaming images to your browser, and capturing mouse events on these images. In order to be able to do that, it requires:

  1. A JavaScript interpreter, which does not even need to support the latest Web 2.0 features. Please allow JavaScript interpretation for this tool - without JavaScript support this application will not work at all.
  2. A browser capable of displaying PNG and/or GIF images. Some error status is reported via animated GIFs. In order to be able to see error flashes, do not disable image annotation.
  3. A reasonably speedy Internet connection. The tool will work via dial-up, but we recommend a faster connection. The total bandwidth consumed by this application is on the order of an Internet radio station and significantly less than any video streaming site.

First Steps

The sketcher is usually started from within a larger form, such as PubChem's Structure Search ( tool. To access Sketcher, open the "Identity/Similarity" or "Substructure/Superstructure" tab and select the option to "Draw a structure: Launch the PubChem editor to make a structure." When the "Launch" button is clicked, a new window is opened. Depending on the contents of the source field, the sketcher window may be pre-loaded with a structure, for example by decoding a SMILES or InChI string, retrieving a structure via its CID from the PubChem database, or by getting a structure from some other source


Open PubChem's Structure Search ( tool in your browser. Select the "Identity/Similarity" option, and within that folder tab select "CID, SMILES, InChI." Then enter "999" (without the quotes) into the text box to specify a CID and press the Edit button. A separate sketcher window will open that will look similar to the image below.

In case the window does not open, verify that you have JavaScript enabled in your browser. If a popup blocker should interfere, use its override mechanism (such as using ctrl-click) to temporarily allow the opening of additional windows or, preferably, selectively disable the blocker for the domain. The exact methods to achieve this are dependent on the type of blocker you may be using.

Sketcher Operation

Editor Window Layout

A newly opened sketcher window is divided into three distinct zones. To the right the actual sketching area is located. To the left, a number of buttons and other user interface elements control the editor mode of operation. Above the drawing area, there is a text field which displays the current structure in various encodings useful for cutting and pasting. It can also be used to input structure information into the sketcher from structure encodings on the clipboard, or even by typing in structure codes by advanced users.

Button Area

The buttons on the left are used to select the various operations of the sketcher. There are two types of blue buttons. Those without a raised border (element symbols, various bond types, etc.) are mode selectors. When you click them, they are highlighted, and remain highlighted until a different mode is selected, or they are reset during by the program as a result of a user action. Only one of these mode buttons is active at any time.

The other type of button has a raised profile. These buttons perform an operation immediately when they are clicked. They do not change the overall operating mode of the sketcher. Some of these operational buttons are associated with auxiliary control elements, such as option menus or file upload buttins.

Mouse Use

All operations can be performed with a single-button mouse. If you have more than one button, the left mouse button is used for standard drawing and selection operations. The right mouse button can be used for quick deletions. More about this can be found in the paragraph about deleting objects.

Error Reporting

In case some error condition was encountered while drawing which prevented an operation from performing at least part of its intended work, the drawing area or a part of it will briefly flash orange. If the location of the problem, such as an atom with a valence violation, could be identified, the offending object is flashed as an orange, localized box. If the problem was global in nature, the full background of the drawing area briefly turns orange.

The error flash is generated by sending a specially crafted animated GIF image to your browser. In order to see the flashes, you need to allow image animations in your browser. If you disallow them, no harm is done except that you miss the visual feedback. The software intentionally does not use audio cues.

Bandwidth Control

The choice menu in the upper left corner can be used to lower the bandwidth requirements of the sketcher. This can be useful in case it needs to be accessed via dial-up, or congested connections.

If the choice menu is set to Dialup, a few changes in the processing of user input will reduce the amount of data transmitted and make the application more responsive over channels with limited capacity:

Element Buttons

The middle section of the button area is filled by element buttons that are roughly arranged like the periodic table of elements. Clicking one of these buttons will switch the editor to the element mode. When one of these buttons is active, the following operations are supported in the canvas area to the right:

The button set only displays a single column of buttons for minor group elements. The element any one of these button represents can be changed by means of the option menu to the right of each of these buttons.

In a similar fashion, lanthanides and actinides, as well as deuterium, tritium, and a query `any' atom can be obtained from the button above the minor group element buttons.

Bond Drawing

The second row of buttons provides a selection of different bond types. When one of these buttons are active, the sketcher is in bond drawing mode.

Special Bond Types

Besides single, double and triple bonds a couple of special bond types are accessible via the bond button set.

Atomic Charges

Charges on existing atoms can be specified by selecting the plus or minus charge buttons. If one of these modes are active, a click on an existing atom will increase or decrease the charge by one.

Note that there is currently no support for specifying explicit radicals.


Below the bond drawing buttons, two rows of buttons allow the convenient input of larger structural fragments.

The first row of buttons display important basic ring systems. When a button has been activated, its associated drawing mode is used as follows:

In case valence restrictions prevent the full execution of a ring addition, bonds to the source atoms may be omitted.

The second row of buttons displays a couple of important chain fragments and functional groups. These are used in a very similar fashion to the ring fragments, but the spiro or bond addition modes are not supported for them. They can only be added as stand-alone fragments or sprouted from an existing atom.

The structure to the right can be built with five mouse clicks into the drawing area, plus five button selections: select the phenyl ring fragment, click anywhere into empty drawing area, select the nitro functional group fragment, click onto the ring atom in the drawing to be substituted, select sulphonic acid group button, again click into drawing area, and repeat twice more for the carboxyl group and the n-propyl group. If desired, a complete set of hydrogen atoms can be added as a final step (see below).


The fragment button row on the main editor window only shows a small collection of frequently used fragments. A larger template library can be opened by clicking on the grid button in the upper right of the button section. An auxiliary window with tabs for various types of fragments of biological importance opens.

You can switch between template collections by clicking on the tabs. Individual templates are selected by first clicking onto them, and then into the drawing area where they should be placed. The click position is the center of the fragment placement position. After transferring a fragment into the drawing area, the template window is closed, and the sketcher automatically activates the move mode in order to allow more precise placement of the transferred fragment.

It is currently not possible to automatically link a transferred fragment to existing drawing components at the instant of transfer.

Graphical Manipulations

To the left of the template grid button, the top button row contains four buttons for graphical modifications of the current structure.

Deleting Objects

The button marked Del is used to enter the object deletion mode. When this mode is active, the following operations are supported:

If you are using a mouse with more than one button, the right mouse button is a shortcut to deletion opeations. It will always work, without the need to switch into the deletion mode. It supports the quick deletion of atoms, bonds and full fragments. The selection rectangle can only be used in the proper deletion mode.

The quick deletion mode is especially useful when you needed to click into the drawing area, for example in order to assign it the keyboard focus, and by this click inadvertently added a single atom. A quick right click, and the spurious addition is gone.

Undoing, Redoing, and Starting Fresh

The button marked Udo implements a simple undo/redo facility. Only a single operation can be undone. If the button is then clicked again, the undo operation is itself undone, i.e. you end up with the old structure again.

The New button deletes the current drawing completely and gives you a blank slate. This operation can also be undone in case the command was executed in error.

Both buttons perform their operations immediately (as indicated by their raised shape) and are not modes. Undo does not change the current sketcher mode, New resets it to the single bond drawing tool.

Cleaning up Structures

The button labelled Cln (clean) recomputes the structure layout without changing other aspects of the structure. The image to the right shows a sample molecule before and after cleanup. In case a cleanup should not yield an improved structure layout, it can be undone.

Setting Query Attributes on Atoms

The sketcher supports the setting and deletion of a limited set of query attributes on atoms and bonds. In order to activate the query attribute mode, click the Qry button. In this mode, the left mouse button can be used to click onto atoms or bonds. Depending on the type of object clicked, different query attribute windows will open.

The image above shows the atom attribute window. The following attributes can be set or reset:

Display of Atom Query Attributes

Any atom query attributes which are set in the atom query panel, or which are already present when a structure is pre-loaded or imported, are reflected in the drawing on the canvas.

Atoms with query attributes are drawn with extended atom symbols and/or read attribute annotations. These special element symbols are used for extended symbols:

For query attributes with alternative possible counts, an attempt will be make to contract the displayed set as much as possible using closed ("1-2") and open ("-1" or "4-") ranges and lists of alternative single values ("3,5").

The structure handling library used to implement this applications supports many more query attributes than those accessible via the atom attribute panel. In case these were imported by reading a file with a query specification, other attributes may be displayed in addition to those described in this section. As long as they are not overwritten by explicit setting of new attributes on affected atoms, they will, if possible in the structure data transfer format, be preserved in structures submitted via the editor.

Setting Bond Query Attributes

If the editor is in query attribute mode, and you click onto a bond, this query attribute window opens:

Its mode of operation is very similar to the corresponding atom panel, but there are different and fewer attributes which can be set and changed.

Display of Bond Query Attributes

As for atoms, query attributes of bonds are displayed on the drawing area. The annotation color for bond attributes is dark blue, and attribute annotations are drawn over the center of the bond.

These characters are used to display bond query attributes:

For query attributes with alternative possible counts, an attempt will be make to contract the displayed set as much as possible using closed ("1-2") and open ("-1" or "4-") ranges and lists of alternative single values ("3,5").

The structure handling library used to implement this applications supports many more query attributes than those accessible via the bond attribute panel. In case these were imported by reading a file with a query specification, other attributes may be displayed in addition to those described in this section. As long as they are not overwritten by explicit setting of new attributes on affected bonds, they will, if possible in the structure data transfer format, be preserved in structures submitted via the editor.

The Structure Data Line

Above the drawing area, a text field displays continuously updated information about the currently edited structure. The type of data displayed can be changed by the choice menu to the left of the text field.

The following choices are available:

The text in the data field can be conveniently be copied and pasted with normal text highlight and clipboard operations. Thus, the sketcher can be a convenient input tool even for sites which do not possess a direct data update link to the main query form but do allow their structure input data to be encoded in SMILES, SMARTS or SLN.

In the SMILES, SMARTS and SLN representations, atom and bond query attributes are encoded as far as technically possible. Not all supported query attributes can be expressed in all of these line notation formats. The sketcher SMILES encoding uses the following custom extensions:

Structure Input via the Structure Data Line

The structure data line serves not only as an information display. It is possible to enter structure codes in this field and import structure data into the drawing area.

Structure import is performed by clearing the line, and then editing or pasting a structure code into this field and finally pressing the return key. The setting of the display choice menu to the left of the field has no influence on the operation.

If the decoding of the structure data succeeds, the encoded content will be merged into the existing drawing as a new additional fragment. If it is intended to replace the current contents, you need to clear the drawing area first by pressing the New button. Fragments are imported without implicit hydrogens and are placed automatically.

The images above display the drawing area before and after the SMILES string c1cnnnc1 was imported. Note that the implicit aromatic system in the input string was automatically resolved to a proper Kekulé form.

The complete set of supported structure data string formats:

Structure Import via Keyboard Paste

The supported strings that can be imported via the data line may also be directly pasted from the clipboard into the drawing area by means of the standard ctrl-V keyboard shortcut, provided that the drawing area has keyboard focus. This method has the additional advantage that the location of the mouse at the moment of the keypress determines the location of the center of the newly added fragment. Depending on the browser and client operating system, the drawing area may not automatically have keyboard focus when you move the mouse into it. To make sure that it has, click the mouse once. In case this leads to the addition of an unwanted atom or a fragment, use the right mouse button to delete these.

Structure Import via File Upload

The final method for loading existing structure data into the sketcher is by means of file upload.

In order to do this, select an existing structure file via the Browse.. button and then press the Import button. The file is then read and added to the existing content. In case you want to guarantee that the imported file is the only sketcher content, press the New button before the import.

Supported file formats: SDF/MOL, SMILES/SMARTS, and InChI. While other file formats may work, they are not supported.

The import function only reads the first record of multi-record files. So in case you attempt to upload an SD-file, only the first record will show.

The hydrogen status of the imported structure will be adjusted at upload time depending on the setting of the Hydrogen option menu. These are its possible values:

Structure Export

The sketcher can export the currently edited structure in various formats. This capability makes it a convenient tool for the input of data sets of limited to be used locally, or even file format conversion.

The current structure is exported by clicking on the button labelled Export. A file selector box will open and let you specify the name and location of the file downloaded from the sketcher server.

The default name of the download file is, where xxx is a suitable default suffix for the selected file format.

The desired format of the file can be selected, before clicking the Export button, from the menu to the right of that button. The exact list of formats which can be used for export is : structure exchange formats (MDL Molfile, SDF, SMILES, SMARTS), structure editor formats for further clean-up of the drawings for publications etc. (ChemDraw CDX) and image downloads (GIF, PNG, SVG, EPS).

Hydrogen Manipulation

Besides its role for file import and export of structure data, the Hydrogen option menu can also be used for direct manipulation of the currently edited structure.

Simply set the menu to the desired operation, and press the Hydrogen button to the left of the menu. The hydrogen status of the drawn structure will be immediately adjusted.

Keyboard Shortcuts

Many of the sketcher modes can be controlled by keyboard shortcuts. This feature allows advanced users to keep the mouse in the drawing area without moving it left and right to switch buttons.

These are the shortcuts:

The mnemonic for element shortcuts is that lowercase letters select the element where the single-letter symbol corresponds to the pressed key. Uppercase letters select the most important element with a two-letter symbol which starts with the pressed key.

There is no 9-membered ring template which could be associated with key 9.

Data Transfer to Caller Forms

A question which has been asked more than once concerns the problem of how to transfer the edited structure data from the sketcher to a linked form which opened the sketcher window.

The answer is simple: There is absolutely nothing a user needs to do to achieve this. Data transfer is automatic, and dynamic. Every structure change is immediately reported to the caller form. There is no button which needs to be clicked in order to transmit the currentl sketch.

Quitting the Sketcher

As described above, there is no need for any user action to transmit the structure data to an originating form for further processing. The sketcher can thus be quit at any time, without fear of data loss, simply by closing its window by means of the standard mechanisms of the client platform, such as clicking on the cross-shaped close icon on the upper right of the windows on MS Windows.

Nevertheless, since in our experience many users appear to be more comfortable if they can hit a dedicated, clearly labelled button to finish the arduous task of inputting an important query structure, we have added a big Done button to the sketcher button set. It is located to the right of the Export controls.

This prominent button simply closes the sketcher window and does nothing else.