Group Abstract Group Abstract

Message Boards Message Boards

Molecular Heatmaps via weighted Gaussian & rational-blob kernel summation over per-atom descriptors

Posted 21 days ago

Molecular Heatmaps via weighted Gaussian & rational-blob kernel summation over per-atom descriptors

Attachments:
POSTED BY: J. M.
3 Replies

atoms are added in order of decreasing Topological Steric Effect Index, so the most sterically crowded parts of idarubicin contribute first

I added a small animation to show how the heatmap is built rather than just showing the final picture. The atoms are added in order of decreasing Topological Steric Effect Index, so the most sterically crowded parts of idarubicin contribute first. This makes the plot readable in a different way: one can see which atomic neighborhoods dominate.

ClearAll["Global`*"];

mol2 = Molecule[Entity["Chemical", "Idarubicin"]];

coords2da =
  MoleculeValue[
   mol2,
   "AtomDiagramCoordinates",
   IncludeHydrogens -> None
   ];

coords2daAll =
  MoleculeValue[
   mol2,
   "AtomDiagramCoordinates",
   IncludeHydrogens -> All
   ];

rot = RotationTransform[-Pi/2, Mean[coords2da]];

coords2daV = rot /@ coords2da;
coords2daAllV = rot /@ coords2daAll;

mol2V = Molecule[
   mol2,
   AtomDiagramCoordinates -> coords2daAllV
   ];

topid =
  MoleculeValue[
   mol2,
   "TopologicalStericEffectIndex",
   IncludeHydrogens -> None
   ];

order = Ordering[topid, All, Greater];

{{xm, xp}, {ym, yp}} =
  MinMax[#, Scaled[0.1]] & /@ Transpose[coords2daV];

gauss[u_?NumericQ] := If[u > 40, 0., Exp[-u]];

hmfun2[n_Integer][x_?NumericQ, y_?NumericQ] :=
 With[
  {sc = 0.3, ii = order[[;; n]]},
  Total[
   MapThread[
    #2 gauss[
       SquaredEuclideanDistance[{x, y}, #1]/(2 sc^2)
       ] &,
    {coords2daV[[ii]], topid[[ii]]}
    ],
   Method -> "CompensatedSummation"
   ]
  ];

Manipulate[
 Show[
  DensityPlot[
   hmfun2[n][x, y],
   {x, xm, xp},
   {y, ym, yp},
   PerformanceGoal->"Quality",
   AspectRatio -> Automatic,
   ColorFunction->"ValentineTones",
   Frame -> None,
   PlotPoints -> 100,
   PlotRange -> All,
   PlotRangePadding->0,
   ImageSize->550
   ],
  MoleculePlot[mol2V,ColorRules -> {_ -> Directive[White,Thickness[.005]]}]
  ],
 {{n, Length[topid], "atoms included"}, 0, Length[topid], 1,
  Appearance -> "Labeled"}
 ]

frnsTM=ParallelTable[
 Show[
  DensityPlot[
   hmfun2[n][x, y],
   {x, xm, xp},
   {y, ym, yp},
   PerformanceGoal->"Quality",
   AspectRatio -> Automatic,
   ColorFunction->"LightTemperatureMap",
   Frame -> None,
   PlotPoints -> 100,
   PlotRange -> All,
   PlotRangePadding->0,
   ImageSize->550
   ],
  MoleculePlot[mol2V,ColorRules -> {_ -> Directive[Black,Thickness[.005]]}]
  ],
 {n, 0, Length[topid], 1}
 ];//AbsoluteTiming

frnsSC=ParallelTable[
 Show[
  DensityPlot[
   hmfun2[n][x, y],
   {x, xm, xp},
   {y, ym, yp},
   PerformanceGoal->"Quality",
   AspectRatio -> Automatic,
   ColorFunction->"SolarColors",
   Frame -> None,
   PlotPoints -> 100,
   PlotRange -> All,
   PlotRangePadding->0,
   ImageSize->550
   ],
  MoleculePlot[mol2V,ColorRules -> {_ -> Directive[White,Thickness[.005]]}]
  ],
 {n, 0, Length[topid], 1}
 ];//AbsoluteTiming

Export["mollights.gif", ImageAssemble /@ Transpose[{frnsTM, frnsSC}], 
 ImageSize -> 900]
POSTED BY: Vitaliy Kaurov
POSTED BY: Vitaliy Kaurov

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard