What do chemicals look like?
sdftosvg is an NPM package for rendering chemical structures
If you look at the structures of chemicals within a family, you can see striking similarities. Take PCBs, which are industrial chemicals that were banned in the 1970s, as an example:
We wanted a way to generate beautiful chemical structure visualizations, like the ones you see above, for use in our materials. We developed a lightweight tool called
sdftosvg that does just that: it takes as input SDF files, downloadable from repositories like PubChem, and outputs SVG renderings.
sdftosvg is available as an NPM package.
The chemical triclosan is used as an anti-microbial in soaps, oral care products, and other consumer products. The PubChem page for triclosan has an SDF file available that defines triclosan’s structure. We can convert the SDF to an svg using
Full documentation for the project is available on the project’s Github page.