/chemfill

A Chemical Structure data supplier plugin for Sketch.

Primary LanguageJavaScript

ChemFill

ChemFill

This Sketch Data Plugin fetches a random molecule from the ChEMBL (https://www.ebi.ac.uk/chembl/) API and returns a rendering of its structure as PNG image. This can be incredibly useful when designing software for the life sciences where chemical structures might be a common form of data rendered.

Installation

Requires Sketch >= 3

  • Download the latest release
  • Un-zip
  • Double click the plugin file to install.

Features and Usage

Once you have installed the ChemFill plugin, you can access it from the Sketch Data menu.

Inserting a Random Structure

A common use case is inserting a molecular structure into a shape:

Step 1: Select and right click on the shape you would like to insert a Chemical structure into.

Step 1: Draw and select a rectangular shape

Step 2: Select Data from the context menu.

Step 3: Select the Random Structure action.

Step 4: Enjoy your chemical mastery!

Step 4: Enjoy your chemical mastery

Inserting Random Chemical Data

Another common set of use cases is generating and inserting chemical data as text. This is done much the same way:

Step 1: Select and right click on the text box, or collection of text boxes, you would like to fill.

Step 2: Select the type of data you would like to generate from the ChemFill Data menu.

Step 2: Select the type of data you would like to generate from the ChemFill Data menu.

Step 3: Congratulate yourself for getting this far without a Chemistry PhD.

Developing

Getting Started

Install the dependencies

yarn install

Once the installation is done, you can run some commands inside the project folder:

yarn build

To watch for changes:

yarn run watch

Additionally, if you wish to run the plugin every time it is built:

yarn start

Debugging

To view the output of your console.log, you have a few different options:

  • Use the sketch-dev-tools
  • Open Console.app and look for the sketch logs
  • Look at the ~/Library/Logs/com.bohemiancoding.sketch3/Plugin Output.log file

Skpm provides a convenient way to do the latter:

skpm log

The -f option causes skpm log to not stop when the end of logs is reached, but rather to wait for additional data to be appended to the input