Class DensityMapResult
java.lang.Object
org.biojava.nbio.structure.io.density.DensityMapResult
A density map that was successfully obtained, together with everything a
caller needs to know in order to use it.
Which source answered matters to the caller and is therefore part of the
result: the file might be a full CCP4 grid, a downsampled volume slice, or
— if non-renderable formats were allowed — a set of structure
factors that must be Fourier-transformed before anything can be drawn. See
isRenderable().
Every field is persisted to a .meta sidecar beside the cached
file, so a result can be reconstructed later without contacting any server.
That is what lets the cache serve
LocalPDBDirectory.FetchBehavior.LOCAL_ONLY
requests fully offline.
- Since:
- 7.3.0
- Author:
- Amr ALHOSSARY
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDensityMapResult(File file, DensityMapSource source, DensityFileFormat format, DensityMapKind kind, PdbId pdbId, String emdbId, String sourceUrl, boolean fromCache, Double recommendedContourLevel, Double sigma) -
Method Summary
Modifier and TypeMethodDescriptionThe recommended contour expressed in multiples of sigma, for viewers that prefer to work that way.getFile()longgetKind()getPdbId()The contour level recommended by the depositors, in absolute map units.getSigma()booleanbooleanWhether a viewer can contour this file as it stands.static FilemetaFileFor(File mapFile) The metadata sidecar file for a cached map.static DensityMapResultReconstructs a result from a cached file and its metadata sidecar.toString()voidWrites this result's metadata beside the cached file, so that it can be reconstructed later without any network access.
-
Field Details
-
META_EXT
Extension of the metadata sidecar written beside every cached map.- See Also:
-
-
Constructor Details
-
DensityMapResult
public DensityMapResult(File file, DensityMapSource source, DensityFileFormat format, DensityMapKind kind, PdbId pdbId, String emdbId, String sourceUrl, boolean fromCache, Double recommendedContourLevel, Double sigma) - Parameters:
file- the cached map filesource- which service supplied itformat- the file formatkind- what the values mean; neverDensityMapKind.AUTOpdbId- the PDB entry, may benullemdbId- the EMDB entry, may benullsourceUrl- the URL it came fromfromCache- whether it was already on disk rather than freshly downloadedrecommendedContourLevel- the author-recommended contour level in absolute map units, ornullif unknownsigma- the RMS deviation of the map, ornullif unknown
-
-
Method Details
-
getFile
- Returns:
- the cached map file
-
getSource
- Returns:
- which service supplied the map
-
getFormat
- Returns:
- the file format
-
getKind
- Returns:
- what the map values mean; never
DensityMapKind.AUTO
-
getPdbId
- Returns:
- the PDB entry, or
null
-
getEmdbId
- Returns:
- the EMDB entry, or
null
-
getSourceUrl
- Returns:
- the URL the map was fetched from
-
isFromCache
public boolean isFromCache()- Returns:
trueif the file was already cached rather than downloaded now
-
isRenderable
public boolean isRenderable()Whether a viewer can contour this file as it stands.- Returns:
falsefor map coefficients, which need a Fourier transform first- See Also:
-
getRecommendedContourLevel
The contour level recommended by the depositors, in absolute map units. Normally only available for EMDB maps, where it is the conventional way to contour rather than a multiple of sigma.- Returns:
- the level, or
nullif unknown
-
getSigma
- Returns:
- the RMS deviation of the map values, or
nullif unknown
-
getContourInSigma
The recommended contour expressed in multiples of sigma, for viewers that prefer to work that way.- Returns:
- the level divided by sigma, or
nullif either is unknown or sigma is zero
-
getFileSizeBytes
public long getFileSizeBytes()- Returns:
- the size of the cached file in bytes, or 0 if it is missing
-
metaFileFor
The metadata sidecar file for a cached map.- Parameters:
mapFile- the cached map- Returns:
- the sidecar path, which need not exist
-
writeMeta
public void writeMeta()Writes this result's metadata beside the cached file, so that it can be reconstructed later without any network access. -
readMeta
Reconstructs a result from a cached file and its metadata sidecar.- Parameters:
mapFile- the cached map- Returns:
- the reconstructed result, or
nullif the sidecar is missing or unusable
-
toString
-