Class EmdbMapProvider

java.lang.Object
org.biojava.nbio.structure.io.density.AbstractDensityMapProvider
org.biojava.nbio.structure.io.density.EmdbMapProvider
All Implemented Interfaces:
DensityMapProvider

public class EmdbMapProvider extends AbstractDensityMapProvider
Fetches the full-resolution primary map of an EMDB entry.

These are gzipped CCP4/MRC files, and they are big: the primary map of EMD-0262 is about 106 MB, and gigabyte maps exist. For most display purposes a slice from a density server is a far better trade — a few hundred kilobytes for the same entry — which is why DensityMapCache tries VolumeServerProvider first and only falls back here. Use this source when the full sampling genuinely matters.

The size limit is checked against the size EMDB itself reports before any of the body is transferred, so exceeding it costs one small metadata request rather than a partial download.

Jmol recognises gzip from the file's magic bytes, so the cached .map.gz can be handed to it without decompressing first.

Since:
7.3.0
Author:
Amr ALHOSSARY
  • Field Details

    • DEFAULT_SERVER_URL

      public static final String DEFAULT_SERVER_URL
      Default base URL of the EMDB archive.
      See Also:
    • DEFAULT_MAP_TEMPLATE

      public static final String DEFAULT_MAP_TEMPLATE
      Default path template for an entry's primary map.
      See Also:
  • Constructor Details

    • EmdbMapProvider

      public EmdbMapProvider(File cacheRoot, EmdbEntryResolver resolver)
      Parameters:
      cacheRoot - the BioJava cache directory
      resolver - used to find the EMDB entry for a PDB entry and to read its contour level and size
  • Method Details

    • getServerBaseUrl

      public static String getServerBaseUrl()
      Returns:
      the base URL of the EMDB archive
    • setServerBaseUrl

      public static void setServerBaseUrl(String url)
      Parameters:
      url - the base URL; a trailing slash is added if missing
    • setMapUrlTemplate

      public static void setMapUrlTemplate(String template)
      Parameters:
      template - the path template for an entry's primary map
    • resetToDefaults

      public static void resetToDefaults()
      Restores the default server and template.
    • getSource

      public DensityMapSource getSource()
      Returns:
      which service this provider talks to
    • getFormat

      public DensityFileFormat getFormat()
      Returns:
      the format this provider delivers
    • supports

      public boolean supports(DensityMapKind kind)
      Description copied from interface: DensityMapProvider
      Whether this provider can serve a given kind of map at all. Used to skip requests that could not possibly succeed, such as asking an X-ray map service for a cryo-EM map.
      Specified by:
      supports in interface DensityMapProvider
      Overrides:
      supports in class AbstractDensityMapProvider
      Parameters:
      kind - the kind of map wanted
      Returns:
      true if it is worth trying
    • buildUrl

      public String buildUrl(String emdbId)
      Builds the URL of an entry's primary map without fetching it.
      Parameters:
      emdbId - the EMDB entry, in any accepted form
      Returns:
      the URL as a string
    • fetch

      public DensityMapResult fetch(DensityMapRequest request) throws IOException
      Description copied from interface: DensityMapProvider
      Fetches a map, using the cache if the request's fetch behaviour allows.
      Parameters:
      request - what is wanted. Its kind is always concrete, never DensityMapKind.AUTO.
      Returns:
      the map, or null if this service has nothing for the entry
      Throws:
      IOException - on transport failure; use HttpStatusException so that a missing resource can be told apart from a broken connection