Wolfram Language
Wolfram Language
For Chemistry and Bioscience Computation
Outline
Outline
Motivation
Motivation
Necessity of computation in modern research and teaching
Introductory Examples
Introductory Examples
Bio-Sequence Computation
Optimized Clustering of Noble Gas Atoms
Built-in Molecular Data Objects
Intermediate Examples
Intermediate Examples
Spectral Lines
Counting Rings in a Molecule
Genomic Analysis
Functional Groups at a Glance
Advanced Examples
Advanced Examples
Segmentation and Classification of Cells
A Family Tree of Drugs
A Solubility Model in a Few Lines
Motivation
Motivation
What Is Computation?
What Is Computation?
Computation ⊃ {Chemical Formulae, Chemical Visualisation, Machine Learning, Optimisation, Probability, ODE & PDE Modelling, Molecular Dynamics, Calculus, Chemical & Drug Data, Signal Processing, Graphs & Networks, Mathematics, Agent-Based Simulation, Random Processes, Geo-Computation, Combinatorics, Control Theory, Functional Analysis…
Computation ⊃ {Chemical Formulae, Chemical Visualisation, Machine Learning, Optimisation, Probability, ODE & PDE Modelling, Molecular Dynamics, Calculus, Chemical & Drug Data, Signal Processing, Graphs & Networks, Mathematics, Agent-Based Simulation, Random Processes, Geo-Computation, Combinatorics, Control Theory, Functional Analysis…
Introductory Examples
Introductory Examples
Bio-Sequence Computation
Bio-Sequence Computation
Represent a DNA sequence:
seq=BioSequence["DNA","CTTTTCGAGATCTCGGCGTCA"]
Translate the sequence to a peptide:
pep=BioSequenceTranslate[seq]
Find out what the corresponding molecule is:
Molecule[pep]
Visualize it in 3D:
MoleculePlot3D[Molecule[pep]]
Look at a longer sequence and compare:
gene=BioSequence
LongestCommonSubsequence[seq,gene]["SequenceString"]
Introductory Examples
Introductory Examples
Optimized Clustering of Noble Gas Atoms
Optimized Clustering of Noble Gas Atoms
The Lennard-Jones potential is an intermolecular potential that describes the potential energy of pairs of interacting atoms.
Create a function to model the potential:
ClearAll[ljPotential];ljPotential[r_,ϵ_:1.0,σ_:1.0]:=4ϵ-;
12
σ
r
6
σ
r
Plot the potential energy as a function of (the distance between a pair of atoms):
V
LJ
r
Plot[ljPotential[r],{r,0.7,2.5},Frame->True,FrameLabel->{"r",""},ImageSize->500]
V
LJ
Create a function to calculate the total potential energy of a cluster of atoms:
ClearAll[clusterEnergy];clusterEnergy[coords_List,potential_:ljPotential]:=Total[Map[potential,MapApply[EuclideanDistance,Subsets[coords,{2}]]]]
Set up a random cluster and calculate its potential energy:
Create a function to find a configuration that minimizes the potential energy of a cluster:
Plot the random cluster in a minimal configuration:
Introductory Examples
Introductory Examples
Built-in Molecular Data Objects
Built-in Molecular Data Objects
Wolfram Language has a variety of data objects to represent chemical objects.
ChemicalFormula
ChemicalFormula
Sometimes all you have is a chemical formula, which allows a considerable amount to be computed:
“Chemical” Entities
“Chemical” Entities
An entity in our knowledgebase with a host of curated data behind it:
Molecule
Molecule
The number of chemical entities is large but finite, but the number of possible molecular structures is not. Molecule allows you to create any structure you want:
Often you have a chemical name or SMILES string, both of which can be interpreted by Molecule:
Or you have an image snipped from a paper:
We can look a little more closely at that SMILES string:
You don’t have to start with a name or any other information—you can just draw the molecule from scratch:
And then you can generate 3D coordinates and plot it:
MoleculePattern
MoleculePattern
Wolfram Language allows searching for and highlighting arbitrarily defined substructures within a Molecule object:
Use MoleculePattern to represent complex patterns like a carboxylic ester, using a combination of atoms and bonds:
Intermediate Examples
Intermediate Examples
Spectral Lines
Spectral Lines
Use built-in spectral line data to get the properties of an atomic line for carbon near 600 nm:
Get the state transitions for tungsten within the visible spectrum:
Extract the wavelengths (and convert the magnitudes from angstroms to nanometers):
Plot the results:
Compare with the results for hydrogen:
Intermediate Examples
Intermediate Examples
Counting Rings in a Molecule
Counting Rings in a Molecule
In chemistry and cheminformatics, counting rings in a molecule helps describe its structure, stability and reactivity. Ring counts are used in predicting properties like aromaticity, classifying compounds and generating molecular descriptors for drug design and materials science. Chemists use the smallest set of smallest rings (SSSR) as a consistent measure for the number of rings in a molecule.
Start with biphenyl, a small molecule with two benzene rings joined by a single bond:
Naphthalene has two rings that are fused together by a shared bond:
Why do chemists use the SSSR instead of enumerating all cycles in the graph? There is both a chemical and a practical answer. Consider a larger structure like this cycloamylose:
The SSSR for this molecule has eight rings with six atoms and 24 rings with 40 atoms:
Enumerating all possible cycles increases the number of 40-atom rings to 256:
By looking at only the SSSR, a greater emphasis is placed on the smaller rings, which are much more relevant to the overall chemistry of this molecule. This alone makes the SSSR count a more useful topological descriptor for property prediction models. Another reason to prefer the SSSR is practical: namely, that it can be computed much more efficiently. For example, finding the SSSR for buckminsterfullerene is done very quickly:
All of the five- and six-membered rings are contained in the SSSR:
By contrast, the number of total cycles in buckminsterfullerene is exponentially large and not countable in a reasonable time:
Intermediate Examples
Intermediate Examples
Genomic Analysis
Genomic Analysis
We can use a resource function to perform a sequence similarity search for a nucleotide sequence, targeting the human genome:
Compare the original with the aligned sequence:
Get information on the identified gene including location, associated biological activities, molecular functions, SNPs and biological pathways:
Find the protein structure associated with the gene:
Visualize the protein structure:
Find the biological pathway associated with the gene:
Get information on pathways:
Visualize one of the pathways:
Intermediate Examples
Intermediate Examples
Functional Groups at a Glance
Functional Groups at a Glance
Fingerprint a handful of familiar drugs:
Everything the fingerprint found in lidocaine, the local anesthetic. Its secondary amide and tertiary amine are both there, along with the six aromatic atoms of its benzene ring and six rotatable bonds:
Which contain a tertiary aliphatic amine, the basic nitrogen found in many drugs?
Advanced Examples
Advanced Examples
Segmentation and Classification of Cells
Segmentation and Classification of Cells
Look at an image of stained cells from a rat brain, some of which have fluorescent marker uptake:
Stained rat brain cells are visible in the blue image channel:
Extract a background mask with automatic pixel intensity thresholding:
Find a seed point for every cell by looking for maxima at a given scale:
Obtain a cell segmentation via a watershed algorithm:
The fluorescent marker is visible in the green channel. Measure the amount of fluorescence in each cell segment:
Estimate the distribution:
Visualize all the cells with more than a certain fluorescent uptake:
Advanced Examples
Advanced Examples
A Family Tree of Drugs
A Family Tree of Drugs
Molecules with similar fingerprints have similar structures. Here we fingerprint 15 drugs from five therapeutic classes and cluster them by the Jaccard (Tanimoto) distance between their fingerprints. The clustering is never told the classes; we only use them to color the labels afterward:
Color each drug's label by its class:
The opioids, benzodiazepines, beta blockers and NSAIDs each form their own branch. Simvastatin doesn't join the other statins: it's derived from a fungal natural product and looks nothing like the fully synthetic atorvastatin and rosuvastatin. The fingerprint sees structure, not pharmacology.
Advanced Examples
Advanced Examples
A Solubility Model in a Few Lines
A Solubility Model in a Few Lines
Machine learning functions like Predict need every example to be the same kind of object, usually a fixed-length vector. A fingerprint turns any molecule, whatever its size, into exactly that.
We encode each molecule with MACCS keys. This is a classic fingerprint of 166 yes-or-no questions about a molecule's structure, such as whether it contains a ring or an OH group. Those are the kinds of features that affect solubility, so this small fingerprint works well here.
We train on 900 randomly chosen molecules and hold out the rest for testing:
How does the model do on the 228 molecules it hasn't seen? In the comparison plot, a perfect model would put every point on the dashed diagonal. The R² score is typically around 0.6 and varies a little with the random split:
Summary
Summary
Unified solution for chemistry and bioscience students, researchers and professionals
State-of-the-art symbolic and numerical computation
Access to real-world data
Powerful and immediate visualization tools
Next Steps
Next Steps
Become a Wolfram Language User
Become a Wolfram Language User
Start a free 15-day trial
Check if you have access through your organization here
Explore interactive courses on Wolfram U
References
References
See our Public Resources here
Chemistry Core Areas page
Wolfram Solution for Biosciences