Uploading Structured Chemical Data to Wikidata

Sulstice
2 min readSep 29, 2023

--

Coming back to consistent blogging. Wikidata is becoming a common way to transmit structured chemical data across different communities. More available data there is the more we can incite discussions and research. For this showcase, I uploaded the Cannabis Sativa Template

To accomplish this, I started off with the data import guide:

This step is pretty easy and then you arrive at this page.

The data is structured in a Wikidata format, however, in GlobalChem all the formatting is in JSON.

class CannabisAlcohols(object):

def __init__(self):

self.name = 'cannabis_alcohols'

@staticmethod
def get_smiles():

smiles = {
'methanol': 'CO',
'ethanol': 'CCO',
'octanol-1': 'CCCCCCCC(O)',
'octanol-3': 'CCCCCC(O)CC',
'nonanol-1': 'CCCCCCCCC(O)',
'hexadecanol-1': 'CCCCCCCC(O)CCCCCC',
}

return smiles

@staticmethod
def get_smarts():

smarts = {
}

return smarts

Conveniently the conversion was pretty easy with this tool:

This allowed for easy flexibility between the data tables. Moving forward, there is probably a more programmatic way of accomplishing this but I found this little conversion and uploading data to be a bit of a tricky endeavor.

I’m more happy with the result of the page in where it looks cleaner to the average consumer and in a format they are used too because of Wikipedia.

Happy Cheminformatics!

--

--

Sulstice
Sulstice

No responses yet