2
$\begingroup$

When I import protein and ligand from two PDB files and display them together using Show I cannot see the ligand since it is tiny in comparison with protein. How can I zoom the MoleculePlot on ligand automatically?

$\endgroup$
4
  • $\begingroup$ Can you provide example code so that people who want to answer don't have to make up an example on their own? Otherwise, MoleculePlot returns a Graphics object, so the same solutions you use for zooming in a Graphics object can be used here as well. $\endgroup$ Dec 9, 2022 at 13:05
  • $\begingroup$ have you tried Magnify, Magnification ? $\endgroup$
    – nufaie
    Dec 9, 2022 at 13:55
  • $\begingroup$ I cannot provide an example since I cannot attach two large files in pdb format $\endgroup$ Dec 9, 2022 at 15:02
  • $\begingroup$ Magnify, Magnification does not work in this case $\endgroup$ Dec 9, 2022 at 15:06

1 Answer 1

4
$\begingroup$
Clear["Global`*"]

Without a minimal example to work with, I can only suggest a general direction.

img = Import[
   "http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&\
compression=NO&structureId=1tf6", "PDB", ImageSize -> Large]

enter image description here

EDIT: Added control labels and axes and box ratio controls

{{xmin, xmax}, {ymin, ymax}, {zmin, zmax}} = 
  Round[Values@AbsoluteOptions[img, PlotRange][[1]]];

Manipulate[
 Show[
  img,
  PlotRange -> {xint, yint, zint},
  ImageSize -> Large,
  SphericalRegion -> True,
  Axes -> axes,
  AxesLabel -> (Style[#, 14] & /@ {x, y, z}),
  Boxed -> axes,
  BoxRatios -> br],
 {{xint, {xmin, xmax}, "x interval"}, xmin, xmax, Round[(xmax - xmin)/100],
  ControlType -> IntervalSlider,
  ImageSize -> Large,
  Appearance -> "Labeled"},
 Row[{
   Control[
    {{yint, {ymin, ymax}, "y interval"}, ymin, ymax, 
     Round[(ymax - ymin)/100],
     ControlType -> IntervalSlider,
     ImageSize -> Large,
     Appearance -> "Labeled"}],
   Spacer[20],
   Control[
    {{br, Automatic, "Box\nRatio"}, {Automatic, {1, 1, 1}}}]}],
 Row[{
   Control[
    {{zint, {zmin, zmax}, "z interval"}, zmin, zmax, 
     Round[(zmax - zmin)/100],
     ControlType -> IntervalSlider,
     ImageSize -> Large,
     Appearance -> "Labeled"}],
   Spacer[40],
   Control[
    {{axes, False}, {True, False}}]}],
 SynchronousUpdating -> False,
 TrackedSymbols :> All]

enter image description here

$\endgroup$
2
  • $\begingroup$ Unfortunately, this code just cut the molecule, but not zoom on it. I need to enlarge the particular region centered to the ligand. $\endgroup$ Dec 12, 2022 at 14:38
  • $\begingroup$ I don't understand your comment. As the plot range is reduced the remaining image is enlarged, i.e., zoomed in on. $\endgroup$
    – Bob Hanlon
    Dec 12, 2022 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.