2

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?

1 Answers1

4
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

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198