Class VolumeServerProvider

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

public class VolumeServerProvider extends AbstractDensityMapProvider
Fetches downsampled volume slices from a Mol* density server.

This is usually the most economical source by a wide margin. For PDB entry 1cbs the coarsest slice is about 210 kB against roughly 2.1 MB for the two pre-computed CCP4 files, and for cryo-EM the difference is far larger still: about 480 kB against the 106 MB primary map of EMD-0262. A single response carries both the 2Fo-Fc and Fo-Fc data blocks for X-ray entries.

Caveats worth knowing. Responses are chunked, with no Content-Length, no ETag and no Last-Modified, so the usual server-provided validation metadata is unavailable; the size recorded for a cached slice is the byte count observed during our own download instead. Detail levels are not linear either — for a small entry the response stops growing past detail 1, while for a large EM map the step from detail 2 to 3 multiplies the size several-fold.

Since:
7.3.0
Author:
Amr ALHOSSARY
  • Field Details

    • DEFAULT_XRAY_CELL_TEMPLATE

      public static final String DEFAULT_XRAY_CELL_TEMPLATE
      Default path template for an X-ray entry's whole unit cell.
      See Also:
    • DEFAULT_EM_CELL_TEMPLATE

      public static final String DEFAULT_EM_CELL_TEMPLATE
      Default path template for an EM entry's whole cell.
      See Also:
  • Constructor Details

    • VolumeServerProvider

      public VolumeServerProvider(File cacheRoot, VolumeServerProvider.Host host)
      Parameters:
      cacheRoot - the BioJava cache directory
      host - which density server to use
  • Method Details

    • getHost

      public VolumeServerProvider.Host getHost()
      Returns:
      which density server this instance uses
    • getBaseUrl

      public String getBaseUrl()
      Returns:
      the base URL in use
    • setBaseUrl

      public void setBaseUrl(String baseUrl)
      Parameters:
      baseUrl - the base URL; a trailing slash is added if missing
    • getDetail

      public int getDetail()
      Returns:
      the detail level requested from the server
    • setDetail

      public void setDetail(int detail)
      Sets the detail level. Higher means a finer grid and a larger download; the relationship is neither linear nor the same for every entry.
      Parameters:
      detail - the level, normally 0 to 6
    • getEncoding

      public String getEncoding()
      Returns:
      the encoding requested, either bcif or cif
    • setEncoding

      public void setEncoding(String encoding)
      Parameters:
      encoding - bcif for BinaryCIF (default, and much smaller) or cif for text
    • 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(DensityMapRequest request)
      Builds the URL for a request without fetching it.
      Parameters:
      request - the request; its kind must be concrete
      Returns:
      the URL as a string, or null if the request cannot be served
    • 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