Macs in Chemistry

Insanely great science

 

Accessing ZINC supplier information

ZINC is a free database of commercially-available compounds for virtual screening. ZINC contains over 100 million purchasable compounds in ready-to-dock, 3D formats. Sterling and Irwin, J. Chem. Inf. Model, 2015. This is an invaluable resource for any type of virtual screening or for anyone looking to create a physical screening collection.

Once you have done the virtual screening you will rapidly realise that the really time-consuming a tedious part now lies ahead. Finding out which vendors stock a particular molecule and then ordering them. Looking up the vendor details for individual compounds is extremely tedious and so this Vortex script may be very useful.

Much of the information within the database is also accessible via a selection of web services http://wiki.bkslab.org/index.php/ZINC15:examples:public.

For example to find vendors for a particular ZincID we use

http://zinc15.docking.org/substances/ZINC72314545/catitems/subsets/for-sale.json?count=all

The results are returned in JSON format.

[{"suppliercode": "Z26291125", "zincid": "ZINC000000000007", "catalogshortname": "enamine"},{"suppliercode": "Z26291125", "zincid": "ZINC000000000007", "catalogshortname": "enamine-v"},{"suppliercode": "MolPort-028-079-862", "zincid": "ZINC000000000007", "catalogshortname": "molport"},{"suppliercode": "305-13-5", "zincid": "ZINC000000000007", "catalogshortname": "bocscibb"},{"suppliercode": "AKOS017030631", "zincid": "ZINC000000000007", "catalogshortname": "akos-v"}]

We can parse this data, create a column for each vendor and then populate the workspace

The first part of the script displays a dialog box to allow the user to select the column containing the ZincID, for each row we then construct the URL and submit it to the web service. The returned data is parsed, one of the nice things is that using the command

vtable.findColumnWithName(supplier, 1)

If a column is not found it is automatically created.

Vortex Script

#ZINC suppliers
#Authored by Chris Swain (http://www.macinchem.org)
#All rights reserved.
#http://pubs.acs.org/doi/abs/10.1021/acs.jcim.5b00559

# Python imports
import urllib2
import urllib
from com.xhaus.jyson import JysonCodec as json

# Standard Vortex imports
import com.dotmatics.vortex.util.Util as Util
import com.dotmatics.vortex.mol2img.jni.genImage as genImage
import com.dotmatics.vortex.mol2img.Mol2Img as mol2Img
import jarray
import binascii
import string
import os


input_label = swing.JLabel("ZINC ID (for input)")
input_cb = workspace.getColumnComboBox()

panel = swing.JPanel()

layout.fill(panel, input_label, 0, 0)
layout.fill(panel, input_cb,    1, 0)

ret = vortex.showInDialog(panel, "Choose ZINC column")

if ret == vortex.OK:
    input_idx = input_cb.getSelectedIndex()

    if input_idx == 0:
        vortex.alert("you must choose a column")
    else:
        col     = vtable.getColumn(input_idx - 1)

        rows = vtable.getRealRowCount()
        for r in range(0, int(rows)):
            zincID = col.getValueAsString(r)
        try:
                mystr = "http://zinc15.docking.org/substances/" + zincID + "/catitems/subsets/for-sale.json?count=all"
                myreturn = urllib2.urlopen(mystr).read()
                j = json.loads(myreturn)
                for supplier_data in j:
                    code = supplier_data['supplier_code']
                    supplier = supplier_data['catalog_short_name']
                    resultCol = vtable.findColumnWithName(supplier, 1)
                    resultCol.setValueFromString(r, code)
            except Exception:
                continue

The results can be seen in the image below.

suppliers

The script can be downloaded here https://macinchem.org/reviews/vortex_scripts/GetSuppliers.vpy.zip

Page Updated 11 July2016