All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Printable, Serializable, EventListener, Accessible

public class JmolPanel extends JPrintPanel implements ActionListener
See Also:
  • Field Details

    • ISOSURFACE_ID_2FOFC

      public static final String ISOSURFACE_ID_2FOFC
      Isosurface id used for the 2mFo-DFc map, so that it can be addressed on its own.
      See Also:
    • ISOSURFACE_ID_FOFC

      public static final String ISOSURFACE_ID_FOFC
      Isosurface id used for the mFo-DFc difference map, drawn as a signed pair of lobes.
      See Also:
    • ISOSURFACE_ID_EM

      public static final String ISOSURFACE_ID_EM
      Isosurface id used for a cryo-EM map.
      See Also:
    • DEFAULT_WITHIN_RADIUS

      public static final double DEFAULT_WITHIN_RADIUS
      Default clipping radius, in Angstroms, around the selected atoms.
      See Also:
  • Constructor Details

    • JmolPanel

      public JmolPanel()
  • Method Details

    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • evalString

      public void evalString(String rasmolScript)
    • openStringInline

      public void openStringInline(String pdbFile)
    • getViewer

      public org.jmol.api.JmolViewer getViewer()
    • getAdapter

      public org.jmol.api.JmolAdapter getAdapter()
    • getStatusListener

      public org.jmol.api.JmolStatusListener getStatusListener()
    • executeCmd

      public void executeCmd(String rasmolScript)
    • setStructure

      public void setStructure(Structure s, boolean useMmtf)
    • setStructure

      public void setStructure(Structure s)
    • loadDensityMap

      public void loadDensityMap(DensityMapResult map)
      Displays a density map fetched through DensityMapCache, clipped to 5.0 Angstroms around the whole model.
      Parameters:
      map - the map to display
      Throws:
      IllegalArgumentException - if the map cannot be displayed without a Fourier transform first
      Since:
      7.3.0
    • loadDensityMap

      public void loadDensityMap(DensityMapResult map, String atomSelection, double withinRadius)
      Displays a density map, clipped to a distance around a selection.

      Contouring follows the convention for each kind of map: the 2mFo-DFc map at 1 sigma in blue, the mFo-DFc difference map as a signed red/green pair at 3 sigma, and a cryo-EM map at the level its depositors recommend when the entry states one, falling back to 3 sigma when it does not.

      Clipping matters for more than tidiness: contouring a whole cryo-EM grid at mesh resolution can take long enough to make the interface appear frozen.

      Parameters:
      map - the map to display
      atomSelection - a Jmol atom expression such as {*} or {ligand}, or null to contour the whole cell
      withinRadius - the clipping radius in Angstroms, ignored when atomSelection is null
      Throws:
      IllegalArgumentException - if the map cannot be displayed without a Fourier transform first
      Since:
      7.3.0
    • loadDensityMap

      public void loadDensityMap(File mapFile, DensityMapKind kind, double level, boolean levelIsSigma, String atomSelection, double withinRadius)
      Displays a density map file directly.
      Parameters:
      mapFile - the map file, in a format Jmol can contour (CCP4/MRC, or a BinaryCIF volume)
      kind - what the map values mean, which decides the colouring and whether a signed pair of surfaces is drawn
      level - the contour level
      levelIsSigma - whether level is a multiple of the map's RMS deviation rather than an absolute value
      atomSelection - a Jmol atom expression, or null to contour the whole cell
      withinRadius - the clipping radius in Angstroms
      Since:
      7.3.0
    • clearDensityMaps

      public void clearDensityMaps()
      Removes any density surfaces this panel has drawn, leaving other isosurfaces alone.
      Since:
      7.3.0
    • toJmolFileUrl

      public static String toJmolFileUrl(File file)
      Converts a file to the URL form Jmol expects.

      Going through File.toURI() percent-encodes spaces and removes backslashes, which Jmol would otherwise read as escape characters in a script string. On Windows the result is a single-slash file:/C:/..., which is normalised here to the usual three-slash form.

      Parameters:
      file - the file
      Returns:
      a URL string safe to embed in a Jmol script
      Since:
      7.3.0
    • jmolColorByChain

      public void jmolColorByChain()
      assign a custom color to the Jmol chains command.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      The user selected one of the Combo boxes...
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JPrintPanel
      Parameters:
      event - an ActionEvent
    • rotateJmol

      public void rotateJmol(Matrix jmolRotation)
    • destroy

      public void destroy()
      Clean up this instance for garbage collection, to avoid memory leaks...