How to use ChemPrice

ChemPrice is a software designed to simplify the gathering of pricing data from more than 100 suppliers by integrating with ChemSpace, Mcule, and Molport platforms. It ensures uniformity in pricing units, providing comprehensive and optimized pricing details for specified compounds.

Getting started

First, let’s create a list of molecules in SMILES notation to be searched:

smiles_list = ["CC(=O)NC1=CC=C(C=C1)O", "CC(C)CC1=CC=C(C=C1)C(C)C(=O)O", "O=C(C)Oc1ccccc1C(=O)O"]

Next, create an instance from the PriceCollector class. Using this instance, we’ll be able to connect to the various integrators and then launch a search on the list of SMILES entered.

from chemprice import PriceCollector

pc = PriceCollector()

Requesting an API key

To access integrators’ data, we need to be able to connect to their API.

If you don’t have an API key yet, you can request one via the following links : Molport, ChemSpace and MCule.

Enter the API key for each integrator

Now that the PriceCollector class has been created, we need to connect to one or more integrators via an API key.

Connection to Molport via API key (the following credentials are examples from Molport API documentations, and users need to obtain their personal credentials from Molport platform):

pc.setMolportApiKey("880d8343-8ui2-418c-9g7a-68b4e2e78c8b")

In the case of Molport, it’s also possible to log in with a login and password. ChemSpace and Mcule support only API keys.

pc.setMolportUsername("john.spade")
pc.setMolportPassword("fasdga34a3")

To check the status of each key, run the :

pc.status()

Possible Outputs

# Username/Password and API Key are Set:
Status: Molport: both credentials are set.

# Only Username/Password or API Key is Set:
Status: Molport: credential is set.

# No Credential is Set:
Status: Molport: no credential is set.

In these examples, we’re only talking about the Molport connection; for ChemSpace and MCule, the approach is the same. You need to use the setChemSpaceApiKey() and setMCuleApiKey() functions, such as :

pc.setChemSpaceApiKey(<chemspace_api_key>)
pc.setMCuleApiKey(<mcule_api_key>)