The Learning Framework – Chemoinformatics – (Aspirin also known as Acetylsalicylic acid)
Description
This learning framework introduces the fundamental concepts of cheminformatics using aspirin (acetylsalicylic acid) as a model compound. The objective is to understand how computational methods, chemistry, mathematics, and Python programming work together in modern drug discovery.
Files
Steps to reproduce
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats from sklearn.linear_model import LinearRegression from sklearn.metrics import r2_score import itertools plt.style.use("ggplot") # Molecular Formula # C9H8O4 MW_CARBON = 9 * 12.011 MW_HYDROGEN = 8 * 1.008 MW_OXYGEN = 4 * 15.999 MW_ASPIRIN = MW_CARBON + MW_HYDROGEN + MW_OXYGEN carbon_fraction = MW_CARBON / MW_ASPIRIN print("Molecular Weight :", MW_ASPIRIN) print("Carbon Fraction :", carbon_fraction) # Molecular Formula # C9H8O4 MW_CARBON = 9 * 12.011 MW_HYDROGEN = 8 * 1.008 MW_OXYGEN = 4 * 15.999 MW_ASPIRIN = MW_CARBON + MW_HYDROGEN + MW_OXYGEN carbon_fraction = MW_CARBON / MW_ASPIRIN print("Molecular Weight :", MW_ASPIRIN) print("Carbon Fraction :", carbon_fraction) doses = np.array([ 75, 81, 100, 150, 325, 500, 650 ]) carbon = doses * carbon_fraction df = pd.DataFrame({ "Dose_mg":doses, "Carbon_mg":carbon }) df plt.figure(figsize=(8,6)) plt.scatter( df["Dose_mg"], df["Carbon_mg"], s=120 ) plt.xlabel("Dose (mg)") plt.ylabel("Carbon (mg)") plt.title("Carbon Content vs Aspirin Dose") plt.show() plt.bar( df["Dose_mg"].astype(str), df["Carbon_mg"] ) plt.xlabel("Tablet Strength") plt.ylabel("Carbon (mg)") plt.title("Carbon in Various Aspirin Tablets") plt.show() labels=["Carbon","Hydrogen","Oxygen"] weights=[ MW_CARBON, MW_HYDROGEN, MW_OXYGEN ] plt.figure(figsize=(7,7)) plt.pie( weights, labels=labels, autopct="%1.1f%%" ) plt.title("Elemental Composition of Aspirin") plt.show()