COCONUT - Natural Products
A TMAP of 25,000 natural products sampled from the COCONUT database (738k total), built from Morgan fingerprints (Jaccard metric). Color layers include NP classifier pathway (Terpenoids 7,128; Alkaloids 5,864; Shikimates and Phenylpropanoids 3,948; Fatty acids 2,817; Polyketides 2,078), NP superclass, chemical superclass, molecular weight, ALogP, TPSA, QED drug-likeness, and NP-likeness score. 15.5% of tree edges cross NP pathway boundaries, with mean subtree purity 0.76. Additional layers show sugar content and glycoside classification. SMILES tooltips render structures, and compound names and Murcko scaffolds are searchable. A full-scale version with ~483k compounds (excluding lipids and fatty acids, whose sparse fingerprints collapse the tree layout) is also available.
How it was made
import pandas as pd
from tmap import TMAP
from tmap.utils.chemistry import fingerprints_from_smiles
from tmap.graph.analysis import boundary_edges, subtree_purity
df = pd.read_csv("coconut_csv_lite.csv", nrows=25000)
fps = fingerprints_from_smiles(df["canonical_smiles"].tolist())
model = TMAP(metric="jaccard", n_neighbors=20, seed=42).fit(fps)
# NP pathway boundary analysis
pathways = df["np_classifier_pathway"].fillna("Unclassified").tolist()
be = boundary_edges(model.tree_, np.array(pathways))
purity = subtree_purity(model.tree_, np.array(pathways), min_size=10)
viz = model.to_tmapviz()
viz.add_smiles(df["canonical_smiles"].tolist())
viz.add_color_layout("NP pathway", pathways, categorical=True, color="tab10")
viz.add_color_layout("NP-likeness", df["np_likeness"].tolist(), color="coolwarm")
viz.add_color_layout("MW", df["molecular_weight"].tolist(), color="viridis")
viz.write_html("coconut.html")